[Drape] Introduce developer sandbox app for rendering debugging and developement #10052

Merged
renderexpert merged 4 commits from dev_sandbox into master 2025-03-13 04:14:17 +00:00
34 changed files with 2169 additions and 1 deletions

View file

@ -61,6 +61,10 @@ jobs:
libgl1-mesa-dev \
libglvnd-dev \
libharfbuzz-dev \
libxrandr-dev \
libxinerama-dev \
libxcursor-dev \
libxi-dev \
qt6-base-dev \
libqt6svg6-dev \
qt6-positioning-dev \
@ -128,6 +132,10 @@ jobs:
libgl1-mesa-dev \
libglvnd-dev \
libharfbuzz-dev \
libxrandr-dev \
libxinerama-dev \
libxcursor-dev \
libxi-dev \
qt6-base-dev \
libqt6svg6-dev \
qt6-positioning-dev \

9
.gitmodules vendored
View file

@ -59,3 +59,12 @@
[submodule "3party/utfcpp"]
path = 3party/utfcpp
url = https://github.com/nemtrif/utfcpp.git
[submodule "3party/glfw"]
path = 3party/glfw
url = https://github.com/glfw/glfw.git
[submodule "3party/CMake-MetalShaderSupport"]
path = 3party/CMake-MetalShaderSupport
url = https://github.com/dpogue/CMake-MetalShaderSupport.git
[submodule "3party/imgui/imgui"]
path = 3party/imgui/imgui
url = https://github.com/ocornut/imgui

@ -0,0 +1 @@
Subproject commit 989857d2e5e54869c35ad06fb21a67d12a2dbc67

View file

@ -66,4 +66,19 @@ add_subdirectory(vulkan_wrapper)
if (PLATFORM_DESKTOP)
add_subdirectory(libtess2)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "")
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "")
set(GLFW_BUILD_TESTS OFF CACHE BOOL "")
set(GLFW_INSTALL OFF CACHE BOOL "")
set(GLFW_VULKAN_STATIC OFF CACHE BOOL "")
set(GLFW_BUILD_WAYLAND OFF CACHE BOOL "")
# Disable ARC for glfw and re-enable after it because it's globally set in the root CMakeLists.txt
set(CMAKE_OBJC_FLAGS "")
add_subdirectory(glfw)
set_target_properties(glfw PROPERTIES UNITY_BUILD OFF)
set_target_properties(glfw PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC NO)
set(CMAKE_OBJC_FLAGS -fobjc-arc)
add_subdirectory(imgui)
endif()

1
3party/glfw Submodule

@ -0,0 +1 @@
Subproject commit 21fea01161e0d6b70c0c5c1f52dc8e7a7df14a50

View file

@ -0,0 +1,16 @@
project(imgui)
set(SRC
imgui/imgui_draw.cpp
imgui/imgui_tables.cpp
imgui/imgui_widgets.cpp
imgui/imgui.cpp
imgui/backends/imgui_impl_glfw.cpp
)
add_library(${PROJECT_NAME} ${SRC})
target_include_directories(${PROJECT_NAME}
PRIVATE ${OMIM_ROOT}/3party/glfw/include
PUBLIC ${OMIM_ROOT}/3party/imgui/imgui
PUBLIC .
)

1
3party/imgui/imgui Submodule

@ -0,0 +1 @@
Subproject commit 6982ce43f5b143c5dce5fab0ce07dd4867b705ae

View file

@ -90,6 +90,19 @@ else()
message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}")
endif()
if(${PLATFORM_MAC})
set(XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
# Metal language support
list(APPEND CMAKE_MODULE_PATH ${OMIM_ROOT}/3party/CMake-MetalShaderSupport/cmake)
include(CheckLanguage)
include(MetalShaderSupport)
check_language(Metal)
if(CMAKE_Metal_COMPILER)
enable_language(Metal)
endif()
endif()
# Sanitizer
if (PLATFORM_DESKTOP)
# https://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
@ -384,6 +397,7 @@ if (PLATFORM_DESKTOP)
add_subdirectory(qt)
omim_add_tool_subdirectory(skin_generator)
endif()
add_subdirectory(dev_sandbox)
endif()
omim_add_test_subdirectory(qt_tstfrm)

View file

@ -155,6 +155,12 @@
<li><a href="https://chromium.googlesource.com/chromium/src/courgette/">Chromium's Courgette</a>;
<a href="#bsd3-license" class="license">BSD License</a></li>
<li><a href="https://github.com/dpogue/CMake-MetalShaderSupport">CMake Metal support files</a><br>
&copy; 2024 Darryl Pogue and Contributors;<a href="#cmake-support-license" class="license">License</a></li>
<li><a href="https://github.com/ocornut/imgui">Dear ImGui</a><br>
&copy; 2014-2025 Omar Cornut; <a href="#mit-license" class="license">MIT License</a></li>
<li><a href="https://libexpat.github.io">Expat</a><br>&copy; 1998&ndash;2000 Thai Open Source Software Center Ltd and Clark Cooper,
&copy; 2001&ndash;2019 Expat maintainers; <a href="#mit-license" class="license">MIT License</a></li>
@ -164,6 +170,9 @@
<li><a href="http://www.freetype.org">FreeType</a><br>
&copy; 2013 The FreeType Project; <a href="#freetype-license" class="license">FTL</a></li>
<li><a href="https://www.glfw.org/">GLFW</a><br>
&copy; 2002-2006 Marcus Geelnard;2006-2019 Camilla Löwy; <a href="#zlib-license" class="license">Zlib License</a></li>
<li><a href="http://www.g-truc.net/project-0016.html">GLM</a><br>
&copy; 2005&ndash;2014 G-Truc Creation; <a href="#mit-license" class="license">MIT License</a></li>
@ -1058,6 +1067,54 @@ of the copyright holder.</p>
</div>
<div class="section">
<h2 id="cmake-support-license">CMake Metal support files</h2>
<p>Copyright 2024 Darryl Pogue and Contributors</p>
<p>All rights reserved.</p>
<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p>
<p>* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</p>
<p>* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</p>
<p>* Neither the name of Kitware, Inc. nor the names of Contributors may be used to endorse or promote products derived from this software without specific prior written permission.</p>
<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
<p>------------------------------------------------------------------------------</p>
<p>See version control history for details of individual contributions.</p>
<p>The above copyright and license notice applies to distributions of
CMake in source and binary form. Third-party software packages supplied
with CMake under compatible licenses provide their own copyright notices
documented in corresponding subdirectories or source files.</p>
<p>------------------------------------------------------------------------------</p>
<p>CMake was initially developed by Kitware with the following sponsorship:</p>
<p>* National Library of Medicine at the National Institutes of Health as part of the Insight Segmentation and Registration Toolkit (ITK).</p>
<p>* US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel Visualization Initiative.</p>
<p>* National Alliance for Medical Image Computing (NAMIC) is funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149.</p>
<p>* Kitware, Inc.</p>
</div>
<div class="section">
<h2 id="freetype-license">The FreeType Project License</h2>

File diff suppressed because one or more lines are too long

Binary file not shown.

134
dev_sandbox/CMakeLists.txt Normal file
View file

@ -0,0 +1,134 @@
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
project(dev_sandbox)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
set(SRC
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
main.cpp
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
imgui_renderer.cpp
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
imgui_renderer.hpp
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
if (${PLATFORM_MAC})
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
append(SRC
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
main.mm
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
../iphone/Maps/Classes/MetalContextFactory.h
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
../iphone/Maps/Classes/MetalContextFactory.mm
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
file(GLOB_RECURSE SHADER_SOURCES_FILES ${OMIM_ROOT}/shaders/Metal/*.metal)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
add_metal_shader_library(shaders_metal
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
${SHADER_SOURCES_FILES}
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
endif()
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
if (${PLATFORM_LINUX})
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
append(SRC
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
main_linux.cpp
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
endif()
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
omim_add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${SRC})
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
target_link_libraries(${PROJECT_NAME}
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
generator # For borders::LoadBorders
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
map
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
gflags::gflags
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
glfw
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
imgui
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
# Installing Vulkan SDK is optional, however without it Vulkan dynamic libraries
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
# should be discovered via system paths and validation layers may not be available
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
find_package(Vulkan QUIET)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
if (Vulkan_FOUND)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
message(STATUS "Vulkan found")
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
target_link_libraries(${PROJECT_NAME} Vulkan::Vulkan)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
endif()
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
if(PLATFORM_MAC)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
target_embed_metal_shader_libraries(${PROJECT_NAME} shaders_metal)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
endif()
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
target_compile_definitions(${PROJECT_NAME} PUBLIC GL_SILENCE_DEPRECATION)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
if (PLATFORM_MAC)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
set_target_properties(${PROJECT_NAME} PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
endif()
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
if (PLATFORM_LINUX)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
target_compile_definitions(${PROJECT_NAME} PRIVATE VK_USE_PLATFORM_XLIB_KHR)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
endif()
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
target_include_directories(${PROJECT_NAME} PUBLIC ${OMIM_ROOT}/3party/glfw/include)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
target_include_directories(${PROJECT_NAME} PUBLIC ${OMIM_ROOT}/3party/imgui)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
set(BUNDLE_NAME "OMapsDevSandbox")
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
set(BUNDLE_DISPLAY_NAME "Organic Maps: Developer Sandbox")
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${BUNDLE_NAME})
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
set(BUNDLE_EXECUTABLE ${BUNDLE_NAME})
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
set(BUNDLE_FOLDER ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${BUNDLE_NAME}.app)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
set(RESOURCES_FOLDER ${BUNDLE_FOLDER}/Contents/Resources)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
set(DATA_DIR ${OMIM_ROOT}/data)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
execute_process(
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
COMMAND mkdir -p ${RESOURCES_FOLDER}/shaders_compiler
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
function(copy_resources)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
foreach(file ${ARGN})
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
execute_process(
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
COMMAND cp -r ${DATA_DIR}/${file} ${RESOURCES_FOLDER}
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
endforeach()
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
endfunction()
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
copy_resources(
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

How about vulkan shaders folder? Is the app going to support Vulkan?

How about vulkan shaders folder? Is the app going to support Vulkan?
renderexpert commented 2025-02-24 22:22:18 +00:00 (Migrated from github.com)
Review

Good catch!

Good catch!
countries-strings
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
resources-default
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
resources-mdpi_light
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
resources-hdpi_light
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
resources-xhdpi_light
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
resources-xxhdpi_light
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
resources-xxxhdpi_light
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
resources-6plus_light
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
vulkan_shaders
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
categories.txt
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
categories_cuisines.txt
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
classificator.txt
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
colors.txt
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
countries.txt
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
drules_proto_default_light.bin
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
drules_proto_default_dark.bin
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
drules_proto_vehicle_light.bin
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
drules_proto_vehicle_dark.bin
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
editor.config
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
fonts_blacklist.txt
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
fonts_whitelist.txt
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
packed_polygons.bin
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
patterns.txt
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
transit_colors.txt
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
types.txt
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
unicode_blocks.txt
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
World.mwm
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
WorldCoasts.mwm
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
00_NotoNaskhArabic-Regular.ttf
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
00_NotoSansBengali-Regular.ttf
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
00_NotoSansHebrew-Regular.ttf
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
00_NotoSansMalayalam-Regular.ttf
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
00_NotoSansThai-Regular.ttf
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
00_NotoSerifDevanagari-Regular.ttf
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
01_dejavusans.ttf
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
02_droidsans-fallback.ttf
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
03_jomolhari-id-a3d.ttf
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
04_padauk.ttf
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
05_khmeros.ttf
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
06_code2000.ttf
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
07_roboto_medium.ttf
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
if (NOT PLATFORM_LINUX)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
# On Linux, ICU data is loaded from the shared library.
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
copy_resources(icudt75l.dat)
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests
endif()
Review

Is it needed? Shaders compiler is used only in tests

Is it needed? Shaders compiler is used only in tests

View file

@ -0,0 +1,257 @@
#include "imgui_renderer.hpp"
#include "base/logging.hpp"
#include "base/macros.hpp"
#include <drape_frontend/render_state_extension.hpp>
#include <shaders/program_manager.hpp>
#include <imgui/imgui.h>
#include <cstring>
#include <limits>
ImguiRenderer::ImguiRenderer()
: m_state(df::CreateRenderState(gpu::Program::ImGui, df::DepthLayer::GuiLayer))
{
m_state.SetDepthTestEnabled(false);
m_state.SetBlending(dp::Blending(true));
}
void ImguiRenderer::Render(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::TextureManager> textureManager,
ref_ptr<gpu::ProgramManager> programManager)
{
std::lock_guard<std::mutex> lock(m_bufferMutex);
size_t renderDataIndex = (m_updateIndex + 1) % m_uiDataBuffer.size();
UiDataBuffer & dataBuffer = m_uiDataBuffer[renderDataIndex];
auto gpuProgram = programManager->GetProgram(m_state.GetProgram<gpu::Program>());
bool needUpdate = true;
if (!m_mesh || dataBuffer.m_vertices.size() > m_vertexCount || dataBuffer.m_indices.size() > m_indexCount)
{
while (dataBuffer.m_vertices.size() > m_vertexCount)
m_vertexCount *= 2;
while (dataBuffer.m_indices.size() > m_indexCount)
m_indexCount *= 2;
m_indexCount = std::min(m_indexCount, static_cast<uint32_t>(std::numeric_limits<uint16_t>::max()));
dataBuffer.m_vertices.resize(m_vertexCount);
dataBuffer.m_indices.resize(m_indexCount);
m_mesh = make_unique_dp<dp::MeshObject>(context, dp::MeshObject::DrawPrimitive::Triangles, "imGui");
m_mesh->SetBuffer(0, std::move(dataBuffer.m_vertices));
m_mesh->SetAttribute("a_position", 0, 0 /* offset */, 2);
m_mesh->SetAttribute("a_texCoords", 0, 2 * sizeof(float) /* offset */, 2);
m_mesh->SetAttribute("a_color", 0, 4 * sizeof(float) /* offset */, 4);
m_mesh->SetIndexBuffer(std::move(dataBuffer.m_indices));
m_mesh->Build(context, gpuProgram);
dataBuffer.m_vertices.clear();
dataBuffer.m_indices.clear();
needUpdate = false;
}
if (!m_texture)
{
std::lock_guard<std::mutex> lock(m_textureMutex);
if (!m_textureData.empty())
{
m_texture = make_unique_dp<dp::StaticTexture>();
m_texture->Create(context,
dp::Texture::Params{
.m_width = m_textureWidth,
.m_height = m_textureHeight,
.m_format = dp::TextureFormat::RGBA8,
.m_allocator = textureManager->GetTextureAllocator(),
},
m_textureData.data());
m_textureData.clear();
m_state.SetColorTexture(make_ref(m_texture));
}
else
{
// Can't render without texture.
return;
}
}
if (dataBuffer.m_drawCalls.empty())
return;
if (needUpdate && !dataBuffer.m_vertices.empty() && !dataBuffer.m_indices.empty())
{
m_mesh->UpdateBuffer(context, 0, dataBuffer.m_vertices);
m_mesh->UpdateIndexBuffer(context, dataBuffer.m_indices);
dataBuffer.m_vertices.clear();
dataBuffer.m_indices.clear();
}
gpu::ImGuiProgramParams const params{.m_projection = m_projection};
context->PushDebugLabel("ImGui Rendering");
m_mesh->Render(context, gpuProgram, m_state, programManager->GetParamsSetter(), params,
[&, this]()
{
context->SetCullingEnabled(false);
for (auto const & drawCall : dataBuffer.m_drawCalls)
{
uint32_t y = drawCall.clipRect.y;
if (context->GetApiVersion() == dp::ApiVersion::OpenGLES3)
y = dataBuffer.m_height - y - drawCall.clipRect.w;
context->SetScissor(drawCall.clipRect.x, y, drawCall.clipRect.z, drawCall.clipRect.w);
m_mesh->DrawPrimitivesSubsetIndexed(context, drawCall.indexCount, drawCall.startIndex);
}
context->SetCullingEnabled(true);
context->SetScissor(0, 0, dataBuffer.m_width, dataBuffer.m_height);
});
context->PopDebugLabel();
}
void ImguiRenderer::Update(std::function<void()> const & uiCallback)
{
CHECK(uiCallback, ());
ImGuiIO & io = ImGui::GetIO();
if (!io.Fonts->IsBuilt())
io.Fonts->Build();
if (!m_texture)
UpdateTexture();
ImGui::NewFrame();
uiCallback();
ImGui::Render();
UpdateBuffers();
}
void ImguiRenderer::Reset()
{
{
std::lock_guard<std::mutex> lock(m_textureMutex);
m_texture.reset();
}
{
std::lock_guard<std::mutex> lock(m_bufferMutex);
m_mesh.reset();
}
}
void ImguiRenderer::UpdateTexture()
{
std::lock_guard<std::mutex> lock(m_textureMutex);
unsigned char * pixels;
int width, height;
ImGui::GetIO().Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
auto const sizeInBytes = width * height * sizeof(uint32_t);
m_textureData.resize(sizeInBytes);
memcpy(m_textureData.data(), pixels, sizeInBytes);
m_textureWidth = static_cast<uint32_t>(width);
m_textureHeight = static_cast<uint32_t>(height);
}
void ImguiRenderer::UpdateBuffers()
{
UiDataBuffer & dataBuffer = m_uiDataBuffer[m_updateIndex];
dataBuffer.m_drawCalls.clear();
ImDrawData * dd = ImGui::GetDrawData();
auto const fbWidth = static_cast<int>(dd->DisplaySize.x * dd->FramebufferScale.x);
auto const fbHeight = static_cast<int>(dd->DisplaySize.y * dd->FramebufferScale.y);
if (fbWidth <= 0 || fbHeight <= 0 || dd->CmdListsCount == 0 || dd->TotalIdxCount == 0 || dd->TotalVtxCount == 0)
return;
dataBuffer.m_width = static_cast<uint32_t>(fbWidth);
dataBuffer.m_height = static_cast<uint32_t>(fbHeight);
CHECK(dd->TotalVtxCount <= std::numeric_limits<uint16_t>::max(),
("UI is so complex and now requires 32-bit indices. You need to improve dp::MeshObject or simplify UI"));
CHECK((ImGui::GetIO().BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset) == 0, ());
dataBuffer.m_vertices.resize(dd->TotalVtxCount);
dataBuffer.m_indices.resize(dd->TotalIdxCount);
int totalDrawCallsCount = 0;
for (int i = 0; i < dd->CmdListsCount; ++i)
totalDrawCallsCount += dd->CmdLists[i]->CmdBuffer.Size;
dataBuffer.m_drawCalls.reserve(totalDrawCallsCount);
ImVec2 const clipOff = dd->DisplayPos;
ImVec2 const clipScale = dd->FramebufferScale;
uint32_t vertexOffset = 0;
uint32_t indexOffset = 0;
for (int i = 0; i < dd->CmdListsCount; ++i)
{
ImDrawList const * cmdList = dd->CmdLists[i];
for (int j = 0; j < cmdList->VtxBuffer.Size; ++j)
{
dp::Color color(cmdList->VtxBuffer.Data[j].col);
dataBuffer.m_vertices[j + vertexOffset] = {
.position = {cmdList->VtxBuffer.Data[j].pos.x, cmdList->VtxBuffer.Data[j].pos.y},
.texCoords = {cmdList->VtxBuffer.Data[j].uv.x, cmdList->VtxBuffer.Data[j].uv.y},
.color = {color.GetAlphaF(), color.GetBlueF(), color.GetGreenF(),
color.GetRedF()} // Byte order is reversed in imGui
};
}
static_assert(sizeof(uint16_t) == sizeof(ImDrawIdx));
memcpy(dataBuffer.m_indices.data() + indexOffset, cmdList->IdxBuffer.Data,
cmdList->IdxBuffer.Size * sizeof(ImDrawIdx));
for (int j = 0; j < cmdList->IdxBuffer.Size; ++j)
{
uint32_t indexValue = dataBuffer.m_indices[j + indexOffset];
indexValue += vertexOffset;
CHECK(indexValue <= std::numeric_limits<uint16_t>::max(), ());
dataBuffer.m_indices[j + indexOffset] = static_cast<uint16_t>(indexValue);
}
for (int cmdIndex = 0; cmdIndex < cmdList->CmdBuffer.Size; ++cmdIndex)
{
const ImDrawCmd cmd = cmdList->CmdBuffer[cmdIndex];
ImVec2 clipMin((cmd.ClipRect.x - clipOff.x) * clipScale.x, (cmd.ClipRect.y - clipOff.y) * clipScale.y);
ImVec2 clipMax((cmd.ClipRect.z - clipOff.x) * clipScale.x, (cmd.ClipRect.w - clipOff.y) * clipScale.y);
if (clipMin.x < 0.0f)
clipMin.x = 0.0f;
if (clipMin.y < 0.0f)
clipMin.y = 0.0f;
if (clipMax.x > fbWidth)
clipMax.x = static_cast<float>(fbWidth);
if (clipMax.y > fbHeight)
clipMax.y = static_cast<float>(fbHeight);
if (clipMax.x <= clipMin.x || clipMax.y <= clipMin.y)
continue;
dataBuffer.m_drawCalls.emplace_back(DrawCall{
.indexCount = static_cast<uint32_t>(cmd.ElemCount),
.startIndex = static_cast<uint32_t>(indexOffset + cmd.IdxOffset),
.clipRect = {static_cast<uint32_t>(clipMin.x), static_cast<uint32_t>(clipMin.y),
static_cast<uint32_t>(clipMax.x - clipMin.x), static_cast<uint32_t>(clipMax.y - clipMin.y)}});
}
vertexOffset += static_cast<uint32_t>(cmdList->VtxBuffer.Size);
indexOffset += static_cast<uint32_t>(cmdList->IdxBuffer.Size);
}
CHECK(vertexOffset == dataBuffer.m_vertices.size(), ());
CHECK(indexOffset == dataBuffer.m_indices.size(), ());
{
std::lock_guard<std::mutex> lock(m_bufferMutex);
// Projection
float const left = dd->DisplayPos.x;
float const right = dd->DisplayPos.x + dd->DisplaySize.x;
float const top = dd->DisplayPos.y;
float const bottom = dd->DisplayPos.y + dd->DisplaySize.y;
m_projection[0][0] = 2.0f / (right - left);
m_projection[1][1] = 2.0f / (top - bottom);
m_projection[2][2] = -1.0f;
m_projection[3][3] = 1.0f;
m_projection[0][3] = -(right + left) / (right - left);
m_projection[1][3] = -(top + bottom) / (top - bottom);
// Swap buffers
m_updateIndex = (m_updateIndex + 1) % m_uiDataBuffer.size();
}
}

View file

@ -0,0 +1,72 @@
#pragma once
#include "drape/glsl_types.hpp"
#include "drape/graphics_context.hpp"
#include "drape/mesh_object.hpp"
#include "drape/pointers.hpp"
#include "drape/render_state.hpp"
#include "drape/static_texture.hpp"
#include "drape/texture_manager.hpp"
#include <array>
#include <cstdint>
#include <functional>
#include <mutex>
#include <vector>
class ImguiRenderer
{
public:
ImguiRenderer();
void Render(ref_ptr<dp::GraphicsContext> context,
ref_ptr<dp::TextureManager> textureManager,
ref_ptr<gpu::ProgramManager> programManager);
void Update(std::function<void()> const & uiCallback);
void Reset();
private:
void UpdateTexture();
void UpdateBuffers();
struct ImguiVertex
{
glsl::vec2 position;
glsl::vec2 texCoords;
glsl::vec4 color;
};
static_assert(sizeof(ImguiVertex) == 2 * sizeof(glsl::vec4));
struct DrawCall
{
uint32_t indexCount = 0;
uint32_t startIndex = 0;
glsl::uvec4 clipRect{};
};
drape_ptr<dp::MeshObject> m_mesh;
uint32_t m_vertexCount = 2000;
uint32_t m_indexCount = 3000;
drape_ptr<dp::StaticTexture> m_texture;
std::vector<unsigned char> m_textureData;
uint32_t m_textureWidth = 0;
uint32_t m_textureHeight = 0;
dp::RenderState m_state;
struct UiDataBuffer
{
std::vector<ImguiVertex> m_vertices;
std::vector<uint16_t> m_indices;
std::vector<DrawCall> m_drawCalls;
uint32_t m_width;
uint32_t m_height;
};
std::array<UiDataBuffer, 2> m_uiDataBuffer;
size_t m_updateIndex = 0;
glsl::mat4 m_projection;
std::mutex m_bufferMutex;
std::mutex m_textureMutex;
};

683
dev_sandbox/main.cpp Normal file
View file

@ -0,0 +1,683 @@
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include "dev_sandbox/imgui_renderer.hpp"
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include "map/framework.hpp"
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include "platform/platform.hpp"
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include "platform/settings.hpp"
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include "coding/reader.hpp"
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include "base/logging.hpp"
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include "base/macros.hpp"
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include "std/target_os.hpp"
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include <chrono>
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include <functional>
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include <mutex>
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include <optional>
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include <sstream>
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include <string>
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include <string_view>
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include <vector>
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include <gflags/gflags.h>
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_WINDOWS)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#define GLFW_EXPOSE_NATIVE_WIN32
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#elif defined(OMIM_OS_LINUX)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#define GLFW_EXPOSE_NATIVE_X11
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#elif defined(OMIM_OS_MAC)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#define GLFW_EXPOSE_NATIVE_COCOA
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#else
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#error Unsupported plaform
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#define GLFW_INCLUDE_NONE
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include <GLFW/glfw3.h>
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include <GLFW/glfw3native.h>
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include <imgui/backends/imgui_impl_glfw.h>
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#include <imgui/imgui.h>
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
DEFINE_string(data_path, "", "Path to data directory.");
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
DEFINE_string(log_abort_level, base::ToString(base::GetDefaultLogAbortLevel()),
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
"Log messages severity that causes termination.");
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
DEFINE_string(resources_path, "", "Path to resources directory.");
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
DEFINE_string(lang, "", "Device language.");
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_MAC) || defined(OMIM_OS_LINUX)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
drape_ptr<dp::GraphicsContextFactory> CreateContextFactory(GLFWwindow * window, dp::ApiVersion api, m2::PointU size);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
void PrepareDestroyContextFactory(ref_ptr<dp::GraphicsContextFactory> contextFactory);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
void OnCreateDrapeEngine(GLFWwindow * window, dp::ApiVersion api, ref_ptr<dp::GraphicsContextFactory> contextFactory);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
void UpdateContentScale(GLFWwindow * window, float scale);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
void UpdateSize(ref_ptr<dp::GraphicsContextFactory> contextFactory, int w, int h);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_LINUX)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Workaround for storage::Status compilation issue:
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// /usr/include/X11/Xlib.h:83:16: note: expanded from macro 'Status'
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#undef Status
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
namespace
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
bool ValidateLogAbortLevel(char const * flagname, std::string const & value)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (auto level = base::FromString(value); !level)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::cerr << "Invalid value for --" << flagname << ": " << value << ", must be one of: ";
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
auto const & names = base::GetLogLevelNames();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
for (size_t i = 0; i < names.size(); ++i)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (i != 0)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::cerr << ", ";
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::cerr << names[i];
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::cerr << '\n';
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
return false;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
return true;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
bool const g_logAbortLevelDummy = gflags::RegisterFlagValidator(&FLAGS_log_abort_level, &ValidateLogAbortLevel);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
void errorCallback(int error, char const * description) { LOG(LERROR, ("GLFW (", error, "):", description)); }
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
struct WindowHandlers
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::function<void(int w, int h)> onResize;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::function<void(double x, double y, int button, int action, int mods)> onMouseButton;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::function<void(double x, double y)> onMouseMove;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::function<void(double x, double y, double xOffset, double yOffset)> onScroll;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::function<void(int key, int scancode, int action, int mods)> onKeyboardButton;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::function<void(float xscale, float yscale)> onContentScale;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
} handlers;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
df::Touch GetTouch(double x, double y)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
return df::Touch{.m_location = m2::PointF(static_cast<float>(x), static_cast<float>(y)), .m_id = 0};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
df::Touch GetSymmetricalTouch(Framework & framework, df::Touch const & touch)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
m2::PointD const pixelCenter = framework.GetVisiblePixelCenter();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
m2::PointD const symmetricalLocation = pixelCenter + pixelCenter - m2::PointD(touch.m_location);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
df::Touch result;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
result.m_id = touch.m_id + 1;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
result.m_location = symmetricalLocation;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
return result;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
df::TouchEvent GetTouchEvent(Framework & framework, double x, double y, int mods, df::TouchEvent::ETouchType type)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
df::TouchEvent event;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
event.SetTouchType(type);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
event.SetFirstTouch(GetTouch(x, y));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (mods & GLFW_MOD_SUPER)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
event.SetSecondTouch(GetSymmetricalTouch(framework, event.GetFirstTouch()));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
return event;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
void FormatMapSize(uint64_t sizeInBytes, std::string & units, size_t & sizeToDownload)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
int const mbInBytes = 1024 * 1024;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
int const kbInBytes = 1024;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (sizeInBytes > mbInBytes)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
sizeToDownload = (sizeInBytes + mbInBytes - 1) / mbInBytes;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
units = "MB";
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
else if (sizeInBytes > kbInBytes)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
sizeToDownload = (sizeInBytes + kbInBytes - 1) / kbInBytes;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
units = "KB";
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
else
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
sizeToDownload = sizeInBytes;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
units = "B";
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::string_view GetMyPoisitionText(location::EMyPositionMode mode)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
switch(mode)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
case location::EMyPositionMode::PendingPosition: return "Pending";
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
case location::EMyPositionMode::NotFollowNoPosition: return "No position";
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
case location::EMyPositionMode::NotFollow: return "Not follow";
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
case location::EMyPositionMode::Follow: return "Follow";
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
case location::EMyPositionMode::FollowAndRotate: return "Follow and Rotate";
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
return "";
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
dp::ApiVersion GetApiVersion(char const * apiLabel)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::string_view v(apiLabel);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (v == "Metal") return dp::ApiVersion::Metal;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (v == "Vulkan") return dp::ApiVersion::Vulkan;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (v == "OpenGL") return dp::ApiVersion::OpenGLES3;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
return dp::ApiVersion::Invalid;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_LINUX)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
class LinuxGuiThread : public base::TaskLoop
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
public:
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
PushResult Push(Task && task) override
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::lock_guard<std::mutex> lock(m_mutex);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
m_tasks.emplace_back(std::move(task));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
return {true, base::TaskLoop::kNoId};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
PushResult Push(Task const & task) override
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::lock_guard<std::mutex> lock(m_mutex);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
m_tasks.emplace_back(task);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
return {true, base::TaskLoop::kNoId};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
void ExecuteTasks()
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::lock_guard<std::mutex> lock(m_mutex);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
for (auto & task : m_tasks)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
task();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
m_tasks.clear();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
private:
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::vector<Task> m_tasks;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::mutex m_mutex;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
} // namespace
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
int main(int argc, char * argv[])
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Our double parsing code (base/string_utils.hpp) needs dots as a floating point delimiters, not commas.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// TODO: Refactor our doubles parsing code to use locale-independent delimiters.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// For example, https://github.com/google/double-conversion can be used.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// See http://dbaron.org/log/20121222-locale for more details.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
(void)::setenv("LC_NUMERIC", "C", 1);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
Platform & platform = GetPlatform();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
LOG(LINFO, ("Organic Maps: Developer Sandbox", platform.Version(), "detected CPU cores:", platform.CpuCores()));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
gflags::SetUsageMessage("Developer Sandbox.");
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
gflags::SetVersionString(platform.Version());
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
gflags::ParseCommandLineFlags(&argc, &argv, true);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (!FLAGS_resources_path.empty())
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
platform.SetResourceDir(FLAGS_resources_path);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (!FLAGS_data_path.empty())
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
platform.SetWritableDirForTests(FLAGS_data_path);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (auto const logLevel = base::FromString(FLAGS_log_abort_level); logLevel)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
base::g_LogAbortLevel = *logLevel;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
else
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
LOG(LCRITICAL, ("Invalid log level:", FLAGS_log_abort_level));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_LINUX)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
auto guiThread = std::make_unique<LinuxGuiThread>();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
auto guiThreadPtr = guiThread.get();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
platform.SetGuiThread(std::move(guiThread));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Init GLFW.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwSetErrorCallback(errorCallback);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (!glfwInit())
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
return -1;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_WINDOWS)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
auto monitor = glfwGetPrimaryMonitor();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
auto mode = glfwGetVideoMode(monitor);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
GLFWwindow * window =
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwCreateWindow(mode->width, mode->height, "Organic Maps: Developer Sandbox", nullptr, nullptr);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
int fbWidth = 0, fbHeight = 0;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwGetFramebufferSize(window, &fbWidth, &fbHeight);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
float xs = 1.0f, ys = 1.0f;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwGetWindowContentScale(window, &xs, &ys);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
float visualScale = std::max(xs, ys);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwSetGamma(monitor, 1.0f);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
IMGUI_CHECKVERSION();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::CreateContext();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::StyleColorsClassic();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwMaximizeWindow(window);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
platform.SetupMeasurementSystem();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
bool outvalue;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (!settings::Get(settings::kDeveloperMode, outvalue))
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
settings::Set(settings::kDeveloperMode, true);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (!FLAGS_lang.empty())
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
(void)::setenv("LANGUAGE", FLAGS_lang.c_str(), 1);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
FrameworkParams frameworkParams;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
Framework framework(frameworkParams);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImguiRenderer imguiRenderer;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
Framework::DrapeCreationParams drapeParams{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_MAC)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
.m_apiVersion = dp::ApiVersion::Metal,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#else
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
.m_apiVersion = dp::ApiVersion::Vulkan,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
.m_visualScale = visualScale,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
.m_surfaceWidth = fbWidth,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
.m_surfaceHeight = fbHeight,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
.m_renderInjectionHandler = [&](ref_ptr<dp::GraphicsContext> context,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ref_ptr<dp::TextureManager> textureManager,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ref_ptr<gpu::ProgramManager> programManager,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
bool shutdown)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (shutdown)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
imguiRenderer.Reset();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
else
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
imguiRenderer.Render(context, textureManager, programManager);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
gui::Skin guiSkin(gui::ResolveGuiSkinFile("default"), visualScale);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
guiSkin.Resize(fbWidth, fbHeight);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
guiSkin.ForEach([&](gui::EWidget widget, gui::Position const & pos) { drapeParams.m_widgetsInitInfo[widget] = pos; });
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
drapeParams.m_widgetsInitInfo[gui::WIDGET_SCALE_FPS_LABEL] = gui::Position(dp::LeftTop);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
drape_ptr<dp::GraphicsContextFactory> contextFactory;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
auto CreateDrapeEngine = [&](dp::ApiVersion version)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
drapeParams.m_apiVersion = version;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
drapeParams.m_visualScale = visualScale;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
drapeParams.m_surfaceWidth = fbWidth;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
drapeParams.m_surfaceHeight = fbHeight;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
contextFactory = CreateContextFactory(window, drapeParams.m_apiVersion,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
m2::PointU(static_cast<uint32_t>(drapeParams.m_surfaceWidth),
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
static_cast<uint32_t>(drapeParams.m_surfaceHeight)));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
auto params = drapeParams;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.CreateDrapeEngine(make_ref(contextFactory), std::move(params));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
OnCreateDrapeEngine(window, version, make_ref(contextFactory));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.SetRenderingEnabled(nullptr);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
CreateDrapeEngine(drapeParams.m_apiVersion);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
auto DestroyDrapeEngine = [&]()
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.SetRenderingDisabled(true);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.DestroyDrapeEngine();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
PrepareDestroyContextFactory(make_ref(contextFactory));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
contextFactory.reset();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Process resizing.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
handlers.onResize = [&](int w, int h)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
fbWidth = w;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
fbHeight = h;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (fbWidth > 0 && fbHeight > 0)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
UpdateSize(make_ref(contextFactory), fbWidth, fbHeight);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.OnSize(fbWidth, fbHeight);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
guiSkin.Resize(w, h);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
gui::TWidgetsLayoutInfo layout;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
guiSkin.ForEach([&layout](gui::EWidget w, gui::Position const & pos) { layout[w] = pos.m_pixelPivot; });
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.SetWidgetLayout(std::move(layout));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.MakeFrameActive();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwSetFramebufferSizeCallback(window, [](GLFWwindow * wnd, int w, int h) { handlers.onResize(w, h); });
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Process change content scale.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
handlers.onContentScale = [&](float xscale, float yscale)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
visualScale = std::max(xscale, yscale);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.UpdateVisualScale(visualScale);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
int w = 0, h = 0;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwGetWindowSize(window, &w, &h);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_MAC)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
w *= xscale;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
h *= yscale;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (w != fbWidth || h != fbHeight)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_MAC)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
UpdateContentScale(window, xscale);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
fbWidth = w;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
fbHeight = h;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
UpdateSize(make_ref(contextFactory), fbWidth, fbHeight);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.OnSize(fbWidth, fbHeight);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwSetWindowContentScaleCallback(window, [](GLFWwindow *, float xscale, float yscale)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
handlers.onContentScale(xscale, yscale);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
});
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Location handler
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::optional<ms::LatLon> lastLatLon;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
bool bearingEnabled = false;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
float bearing = 0.0f;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
auto setUserLocation = [&]()
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (lastLatLon)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.OnLocationUpdate(
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
location::GpsInfo{.m_source = location::EUser,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
.m_timestamp = static_cast<double>(std::chrono::duration_cast<std::chrono::milliseconds>(
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::chrono::system_clock::now().time_since_epoch())
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
.count()) /
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
1000,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
.m_latitude = lastLatLon->m_lat,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
.m_longitude = lastLatLon->m_lon,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
.m_horizontalAccuracy = 10,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
.m_bearing = bearingEnabled ? bearing : -1.0f});
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (bearingEnabled)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.OnCompassUpdate(location::CompassInfo{.m_bearing = base::DegToRad(bearing)});
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Download maps handler
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::string downloadButtonLabel;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::string retryButtonLabel;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::string downloadStatusLabel;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
storage::CountryId lastCountry;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
auto const onCountryChanged = [&](storage::CountryId const & countryId)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
downloadButtonLabel.clear();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
retryButtonLabel.clear();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
downloadStatusLabel.clear();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
lastCountry = countryId;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Called by Framework in World zoom level.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (countryId.empty())
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
return;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
auto const & storage = framework.GetStorage();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
auto status = storage.CountryStatusEx(countryId);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
auto const & countryName = countryId;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (status == storage::Status::NotDownloaded)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::string units;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
size_t sizeToDownload = 0;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
FormatMapSize(storage.CountrySizeInBytes(countryId).second, units, sizeToDownload);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::stringstream str;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
str << "Download (" << countryName << ") " << sizeToDownload << units;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
downloadButtonLabel = str.str();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
else if (status == storage::Status::InQueue)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::stringstream str;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
str << countryName << " is waiting for downloading";
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
downloadStatusLabel = str.str();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
else if (status != storage::Status::Downloading && status != storage::Status::OnDisk &&
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
status != storage::Status::OnDiskOutOfDate)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::stringstream str;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
str << "Retry to download " << countryName;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
retryButtonLabel = str.str();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.SetCurrentCountryChangedListener(onCountryChanged);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.GetStorage().Subscribe(
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
[&](storage::CountryId const & countryId)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Storage also calls notifications for parents, but we are interested in leafs only.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (framework.GetStorage().IsLeaf(countryId))
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
onCountryChanged(countryId);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
},
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
[&](storage::CountryId const & countryId, downloader::Progress const & progress)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::stringstream str;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
str << "Downloading (" << countryId << ") " << (progress.m_bytesDownloaded * 100 / progress.m_bytesTotal)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
<< "%";
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
downloadStatusLabel = str.str();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.MakeFrameActive();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
});
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Handle mouse buttons.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
bool touchActive = false;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
int touchMods = 0;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
bool setUpLocationByLeftClick = false;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
handlers.onMouseButton = [&](double x, double y, int button, int action, int mods)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_LINUX)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::GetIO().MousePos = ImVec2(x / visualScale, y / visualScale);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (ImGui::GetIO().WantCaptureMouse)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.MakeFrameActive();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
return;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_MAC)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
x *= visualScale;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
y *= visualScale;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
lastLatLon = mercator::ToLatLon(framework.PtoG(m2::PointD(x, y)));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (setUpLocationByLeftClick)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
setUserLocation();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
return;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.TouchEvent(GetTouchEvent(framework, x, y, mods, df::TouchEvent::TOUCH_DOWN));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
touchActive = true;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
touchMods = mods;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (touchActive && action == GLFW_RELEASE)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.TouchEvent(GetTouchEvent(framework, x, y, 0, df::TouchEvent::TOUCH_UP));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
touchActive = false;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
touchMods = 0;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwSetMouseButtonCallback(window,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
[](GLFWwindow * wnd, int button, int action, int mods)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
double x, y;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwGetCursorPos(wnd, &x, &y);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
handlers.onMouseButton(x, y, button, action, mods);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
});
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Handle mouse moving.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
handlers.onMouseMove = [&](double x, double y)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_LINUX)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::GetIO().MousePos = ImVec2(x / visualScale, y / visualScale);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (ImGui::GetIO().WantCaptureMouse)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.MakeFrameActive();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (touchActive)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_MAC)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
x *= visualScale;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
y *= visualScale;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.TouchEvent(
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
GetTouchEvent(framework, x, y, touchMods, df::TouchEvent::TOUCH_MOVE));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwSetCursorPosCallback(window, [](GLFWwindow *, double x, double y)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
handlers.onMouseMove(x, y);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
});
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Handle scroll.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
handlers.onScroll = [&](double x, double y, double xOffset, double yOffset)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_LINUX)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::GetIO().MousePos = ImVec2(x / visualScale, y / visualScale);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (ImGui::GetIO().WantCaptureMouse)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.MakeFrameActive();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
return;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_MAC)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
x *= visualScale;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
y *= visualScale;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:32:53 +00:00 (Migrated from github.com)
Review

This stuff here and above is a bit mind-blowing :) Why do we multiply coordinates on Mac and divide on Linux.

This stuff here and above is a bit mind-blowing :) Why do we multiply coordinates on Mac and divide on Linux.
renderexpert commented 2025-02-22 17:36:06 +00:00 (Migrated from github.com)
Review

Unfortunately, OS are not consistent in terms of visual scale in glfw library (possibly it's native behaviour on this OS). macOS returns width/height in the same units regardless of screen scaling, while on Linux it returns width/height premultiplied to display scaling.

Unfortunately, OS are not consistent in terms of visual scale in glfw library (possibly it's native behaviour on this OS). macOS returns width/height in the same units regardless of screen scaling, while on Linux it returns width/height premultiplied to display scaling.
constexpr double kSensitivity = 0.01;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
double const factor = yOffset * kSensitivity;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.Scale(exp(factor), m2::PointD(x, y), false);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwSetScrollCallback(window,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
[](GLFWwindow * wnd, double xoffset, double yoffset)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
double x, y;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwGetCursorPos(wnd, &x, &y);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
handlers.onScroll(x, y, xoffset, yoffset);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
});
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Keys.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
handlers.onKeyboardButton = [&](int key, int scancode, int action, int mods) {};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwSetKeyCallback(window, [](GLFWwindow *, int key, int scancode, int action, int mods)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
handlers.onKeyboardButton(key, scancode, action, mods);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
});
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// imGui UI
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
bool enableDebugRectRendering = false;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
bool enableAA = false;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
auto imGuiUI = [&]()
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::SetNextWindowPos(ImVec2(5, 20), ImGuiCond_Appearing);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::Begin("Controls", nullptr, ImGuiWindowFlags_AlwaysAutoResize);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Drape controls
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
char const * apiLabels[] = {
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_MAC)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
"Metal",
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
"Vulkan",
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
"OpenGL"
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#elif defined(OMIM_OS_LINUX)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
"Vulkan",
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
"OpenGL"
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
static int currentAPI = 0;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (ImGui::Combo("API", &currentAPI, apiLabels, IM_ARRAYSIZE(apiLabels)))
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
auto const apiVersion = GetApiVersion(apiLabels[currentAPI]);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (framework.GetDrapeEngine()->GetApiVersion() != apiVersion)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
DestroyDrapeEngine();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
CreateDrapeEngine(apiVersion);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (ImGui::Checkbox("Debug rect rendering", &enableDebugRectRendering))
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.EnableDebugRectRendering(enableDebugRectRendering);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (ImGui::Checkbox("Antialiasing", &enableAA))
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.GetDrapeEngine()->SetPosteffectEnabled(df::PostprocessRenderer::Antialiasing, enableAA);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::NewLine();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::Separator();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::NewLine();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Map controls
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (ImGui::Button("Scale +"))
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.Scale(Framework::SCALE_MAG, true);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::SameLine();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (ImGui::Button("Scale -"))
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.Scale(Framework::SCALE_MIN, true);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::Checkbox("Set up location by left click", &setUpLocationByLeftClick);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (setUpLocationByLeftClick)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (ImGui::Checkbox("Bearing", &bearingEnabled))
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
setUserLocation();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::SameLine();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (ImGui::SliderFloat(" ", &bearing, 0.0f, 360.0f, "%.1f"))
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
setUserLocation();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::Text("My positon mode: %s", GetMyPoisitionText(framework.GetMyPositionMode()).data());
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (ImGui::Button("Next Position Mode"))
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.SwitchMyPositionNextMode();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::NewLine();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::Separator();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::NewLine();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// No downloading on Linux at the moment, need to implement http_thread without Qt.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if !defined(OMIM_OS_LINUX)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Download controls
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (!downloadButtonLabel.empty())
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (ImGui::Button(downloadButtonLabel.c_str()))
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.GetStorage().DownloadNode(lastCountry);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (!retryButtonLabel.empty())
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (ImGui::Button(retryButtonLabel.c_str()))
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.GetStorage().RetryDownloadNode(lastCountry);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (!downloadStatusLabel.empty())
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::Text("%s", downloadStatusLabel.c_str());
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
if (!downloadButtonLabel.empty() || !retryButtonLabel.empty() || !downloadStatusLabel.empty())
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::NewLine();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::Separator();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::NewLine();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::End();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
};
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui_ImplGlfw_InitForOther(window, true);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Main loop.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
while (!glfwWindowShouldClose(window))
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
{
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwPollEvents();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_LINUX)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
guiThreadPtr->ExecuteTasks();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Render imGui UI
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui_ImplGlfw_NewFrame();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGuiIO& io = ImGui::GetIO();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#if defined(OMIM_OS_LINUX)
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// Apply correct visual scale on Linux
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// In glfw for Linux, window size and framebuffer size are the same,
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
// even if visual scale is not 1.0. It's different from behaviour on Mac.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
io.DisplaySize = ImVec2(fbWidth / visualScale, fbHeight / visualScale);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
io.DisplayFramebufferScale = ImVec2(visualScale, visualScale);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
double mouseX, mouseY;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwGetCursorPos(window, &mouseX, &mouseY);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
io.AddMousePosEvent((float)mouseX / visualScale, (float)mouseY / visualScale);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
#endif
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
io.IniFilename = nullptr;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
imguiRenderer.Update(imGuiUI);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
std::this_thread::sleep_for(std::chrono::milliseconds(1000 / 30));
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
framework.EnterBackground();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
DestroyDrapeEngine();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui_ImplGlfw_Shutdown();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
ImGui::DestroyContext();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwDestroyWindow(window);
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
glfwTerminate();
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
return 0;
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.
}
vng commented 2025-02-22 10:27:32 +00:00 (Migrated from github.com)
Review

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

nit: I'd prefer to make one Window or App instance here that holds all these callbacks. To have one global object instead of many.

370
dev_sandbox/main.mm Normal file
View file

@ -0,0 +1,370 @@
#include "iphone/Maps/Classes/MetalContextFactory.h"
#include "drape/gl_functions.hpp"
#include "drape/oglcontext.hpp"
#include "drape/metal/metal_base_context.hpp"
#include "drape/vulkan/vulkan_context_factory.hpp"
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#if __APPLE__
#define GLFW_EXPOSE_NATIVE_COCOA
#else
#error Unsupported OS
#endif
#include <GLFW/glfw3native.h>
#import <AppKit/NSOpenGL.h>
#import <Cocoa/Cocoa.h>
#import <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h>
#include <vulkan/vulkan_macos.h>
#include <atomic>
#include <memory>
class MacOSVulkanContextFactory : public dp::vulkan::VulkanContextFactory
{
public:
MacOSVulkanContextFactory()
: dp::vulkan::VulkanContextFactory(1, 33, false) {}
void SetSurface(CAMetalLayer *layer)
{
VkMacOSSurfaceCreateInfoMVK createInfo = {
.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK,
.flags = 0,
.pView = static_cast<const void *>(CFBridgingRetain(layer)),
};
VkResult statusCode;
CHECK(vkCreateMacOSSurfaceMVK, ());
statusCode = vkCreateMacOSSurfaceMVK(m_vulkanInstance, &createInfo, nullptr,
&m_surface);
if (statusCode != VK_SUCCESS)
{
LOG_ERROR_VK_CALL(vkCreateMacOSSurfaceMVK, statusCode);
return;
}
uint32_t const renderingQueueIndex = m_drawContext->GetRenderingQueueFamilyIndex();
VkBool32 supportsPresent;
statusCode = vkGetPhysicalDeviceSurfaceSupportKHR(m_gpu, renderingQueueIndex, m_surface, &supportsPresent);
if (statusCode != VK_SUCCESS)
{
LOG_ERROR_VK_CALL(vkGetPhysicalDeviceSurfaceSupportKHR, statusCode);
return;
}
CHECK_EQUAL(supportsPresent, VK_TRUE, ());
CHECK(QuerySurfaceSize(), ());
if (m_drawContext)
m_drawContext->SetSurface(m_surface, m_surfaceFormat, m_surfaceCapabilities);
}
void ResetSurface()
{
if (m_drawContext)
m_drawContext->ResetSurface(false);
vkDestroySurfaceKHR(m_vulkanInstance, m_surface, nullptr);
}
};
class MacGLContext : public dp::OGLContext
{
public:
MacGLContext(MacGLContext * contextToShareWith)
: m_viewSet(false)
{
NSOpenGLPixelFormatAttribute attributes[] = {
NSOpenGLPFAAccelerated,
NSOpenGLPFAOpenGLProfile,
NSOpenGLProfileVersion4_1Core,
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAColorSize,
24,
NSOpenGLPFAAlphaSize,
8,
NSOpenGLPFADepthSize,
24,
NSOpenGLPFAStencilSize,
8,
0
};
m_pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
CHECK(m_pixelFormat, ("Pixel format is not found"));
m_context = [[NSOpenGLContext alloc] initWithFormat:m_pixelFormat
shareContext:(contextToShareWith ? contextToShareWith->m_context : nil)];
int interval = 1;
[m_context getValues:&interval forParameter:NSOpenGLContextParameterSwapInterval];
}
~MacGLContext()
{
@autoreleasepool {
[m_context clearDrawable];
m_pixelFormat = nil;
m_context = nil;
}
}
bool BeginRendering() override { return m_viewSet; }
void Present() override
{
if (m_viewSet)
{
std::lock_guard<std::mutex> lock(m_updateSizeMutex);
[m_context flushBuffer];
}
}
void MakeCurrent() override
{
[m_context makeCurrentContext];
}
void DoneCurrent() override
{
[NSOpenGLContext clearCurrentContext];
}
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override
{
if (framebuffer)
framebuffer->Bind();
else
GLFunctions::glBindFramebuffer(0);
}
void SetView(NSView* view)
{
[m_context setView: view];
[m_context update];
m_viewSet = true;
}
void UpdateSize(int w, int h)
{
std::lock_guard<std::mutex> lock(m_updateSizeMutex);
[m_context update];
}
private:
NSOpenGLPixelFormat * m_pixelFormat = nil;
NSOpenGLContext* m_context = nil;
std::atomic<bool> m_viewSet;
std::mutex m_updateSizeMutex;
};
class MacGLContextFactory: public dp::GraphicsContextFactory
{
public:
dp::GraphicsContext * GetDrawContext() override
{
bool needNotify = false;
{
std::lock_guard<std::mutex> lock(m_contextAccess);
if (m_drawContext == nullptr)
{
m_drawContext = std::make_unique<MacGLContext>(m_uploadContext.get());
needNotify = true;
}
}
if (needNotify)
NotifyView();
std::lock_guard<std::mutex> lock(m_contextAccess);
return m_drawContext.get();
}
dp::GraphicsContext * GetResourcesUploadContext() override
{
std::lock_guard<std::mutex> lock(m_contextAccess);
if (m_uploadContext == nullptr)
m_uploadContext = std::make_unique<MacGLContext>(m_drawContext.get());
return m_uploadContext.get();
}
void WaitForInitialization(dp::GraphicsContext *) override
{
std::unique_lock<std::mutex> lock(m_initializationMutex);
if (m_isInitialized)
return;
m_initializationCounter++;
if (m_initializationCounter >= kGLThreadsCount)
{
m_isInitialized = true;
m_initializationCondition.notify_all();
}
else
{
m_initializationCondition.wait(lock, [this] { return m_isInitialized; });
}
}
bool IsDrawContextCreated() const override
{
std::lock_guard<std::mutex> lock(m_contextAccess);
return m_drawContext != nullptr;
}
bool IsUploadContextCreated() const override
{
std::lock_guard<std::mutex> lock(m_contextAccess);
return m_uploadContext != nullptr;
}
void SetView(NSView* view)
{
bool needWait;
{
std::lock_guard<std::mutex> lock(m_contextAccess);
needWait = (m_drawContext == nullptr);
}
if (needWait)
{
std::unique_lock<std::mutex> lock(m_viewSetMutex);
m_viewSetCondition.wait(lock, [this] { return m_viewSet; });
}
std::lock_guard<std::mutex> lock(m_contextAccess);
CHECK(m_drawContext, ());
m_drawContext->SetView(view);
}
void UpdateSize(int w, int h)
{
std::lock_guard<std::mutex> lock(m_contextAccess);
if (m_drawContext)
m_drawContext->UpdateSize(w, h);
}
private:
void NotifyView()
{
std::lock_guard<std::mutex> lock(m_viewSetMutex);
m_viewSet = true;
m_viewSetCondition.notify_all();
}
static size_t constexpr kGLThreadsCount = 2;
std::unique_ptr<MacGLContext> m_drawContext;
std::unique_ptr<MacGLContext> m_uploadContext;
mutable std::mutex m_contextAccess;
bool m_isInitialized = false;
size_t m_initializationCounter = 0;
std::condition_variable m_initializationCondition;
std::mutex m_initializationMutex;
bool m_viewSet = false;
std::condition_variable m_viewSetCondition;
std::mutex m_viewSetMutex;
};
drape_ptr<dp::GraphicsContextFactory> CreateContextFactory(GLFWwindow *window, dp::ApiVersion api, m2::PointU size)
{
if (api == dp::ApiVersion::Metal)
{
CAMetalLayer *layer = [CAMetalLayer layer];
layer.device = MTLCreateSystemDefaultDevice();
layer.opaque = YES;
layer.displaySyncEnabled = YES;
NSWindow *nswindow = glfwGetCocoaWindow(window);
NSScreen *screen = [NSScreen mainScreen];
CGFloat factor = [screen backingScaleFactor];
layer.contentsScale = factor;
nswindow.contentView.layer = layer;
nswindow.contentView.wantsLayer = YES;
return make_unique_dp<MetalContextFactory>(layer, size);
}
if (api == dp::ApiVersion::Vulkan)
{
CAMetalLayer *layer = [CAMetalLayer layer];
layer.device = MTLCreateSystemDefaultDevice();
layer.opaque = YES;
layer.displaySyncEnabled = YES;
NSWindow *nswindow = glfwGetCocoaWindow(window);
NSScreen *screen = [NSScreen mainScreen];
CGFloat factor = [screen backingScaleFactor];
layer.contentsScale = factor;
nswindow.contentView.layer = layer;
nswindow.contentView.wantsLayer = YES;
auto contextFactory = make_unique_dp<MacOSVulkanContextFactory>();
contextFactory->SetSurface(layer);
return contextFactory;
}
if (api == dp::ApiVersion::OpenGLES3)
{
NSWindow *nswindow = glfwGetCocoaWindow(window);
[nswindow.contentView setWantsBestResolutionOpenGLSurface:YES];
return make_unique_dp<MacGLContextFactory>();
}
ASSERT(false, ("API is not available yet"));
return nullptr;
}
void OnCreateDrapeEngine(GLFWwindow *window, dp::ApiVersion api,
ref_ptr<dp::GraphicsContextFactory> contextFactory)
{
if (api == dp::ApiVersion::OpenGLES3)
{
NSWindow *nswindow = glfwGetCocoaWindow(window);
ref_ptr<MacGLContextFactory> macosContextFactory = contextFactory;
macosContextFactory->SetView(nswindow.contentView);
}
}
void PrepareDestroyContextFactory(ref_ptr<dp::GraphicsContextFactory> contextFactory)
{
auto const api = contextFactory->GetDrawContext()->GetApiVersion();
if (api == dp::ApiVersion::Metal || api == dp::ApiVersion::OpenGLES3)
{
// Do nothing
}
else if (api == dp::ApiVersion::Vulkan)
{
ref_ptr<MacOSVulkanContextFactory> macosContextFactory = contextFactory;
macosContextFactory->ResetSurface();
}
else
{
ASSERT(false, ("API is not available yet"));
}
}
void UpdateContentScale(GLFWwindow *window, float scale)
{
NSWindow *nswindow = glfwGetCocoaWindow(window);
if (nswindow.contentView.layer)
nswindow.contentView.layer.contentsScale = scale;
}
void UpdateSize(ref_ptr<dp::GraphicsContextFactory> contextFactory, int w, int h)
{
if (!contextFactory || !contextFactory->GetDrawContext())
return;
auto const api = contextFactory->GetDrawContext()->GetApiVersion();
if (api == dp::ApiVersion::OpenGLES3)
{
ref_ptr<MacGLContextFactory> macosContextFactory = contextFactory;
macosContextFactory->UpdateSize(w, h);
}
}

411
dev_sandbox/main_linux.cpp Normal file
View file

@ -0,0 +1,411 @@
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#include "std/target_os.hpp"
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#if !defined(OMIM_OS_LINUX)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#error Unsupported OS
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#endif
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLFW_INCLUDE_NONE
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#include <GLFW/glfw3.h>
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLFW_EXPOSE_NATIVE_X11
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#include <GLFW/glfw3native.h>
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#include <dlfcn.h>
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#include <X11/X.h>
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#include <vulkan_wrapper.h>
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#include <vulkan/vulkan_xlib.h>
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
// Workaround for TestFunction::Always compilation issue:
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
// /usr/include/X11/X.h:441:33: note: expanded from macro 'Always'
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#undef Always
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
// Workaround for storage::Status compilation issue:
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
// /usr/include/X11/Xlib.h:83:16: note: expanded from macro 'Status'
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#undef Status
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#include "drape/vulkan/vulkan_context_factory.hpp"
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#include "drape/gl_functions.hpp"
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#include "drape/gl_includes.hpp"
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#include "drape/oglcontext.hpp"
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#include <array>
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#include <atomic>
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#include <memory>
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
class LinuxVulkanContextFactory : public dp::vulkan::VulkanContextFactory
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
public:
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
LinuxVulkanContextFactory() : dp::vulkan::VulkanContextFactory(1, 33, false) {}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
void SetSurface(Display * display, Window window)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
VkXlibSurfaceCreateInfoKHR const createInfo = {
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
.pNext = nullptr,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
.flags = 0,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
.dpy = display,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
.window = window,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
};
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
VkResult statusCode;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
CHECK(vkCreateXlibSurfaceKHR, ());
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
statusCode = vkCreateXlibSurfaceKHR(m_vulkanInstance, &createInfo, nullptr, &m_surface);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (statusCode != VK_SUCCESS)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
LOG_ERROR_VK_CALL(vkCreateXlibSurfaceKHR, statusCode);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
return;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
uint32_t const renderingQueueIndex = m_drawContext->GetRenderingQueueFamilyIndex();
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
VkBool32 supportsPresent;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
statusCode = vkGetPhysicalDeviceSurfaceSupportKHR(m_gpu, renderingQueueIndex, m_surface, &supportsPresent);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (statusCode != VK_SUCCESS)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
LOG_ERROR_VK_CALL(vkGetPhysicalDeviceSurfaceSupportKHR, statusCode);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
return;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
CHECK_EQUAL(supportsPresent, VK_TRUE, ());
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
CHECK(QuerySurfaceSize(), ());
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (m_drawContext)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_drawContext->SetSurface(m_surface, m_surfaceFormat, m_surfaceCapabilities);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
void ResetSurface()
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (m_drawContext)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_drawContext->ResetSurface(false);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vkDestroySurfaceKHR(m_vulkanInstance, m_surface, nullptr);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
};
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
// Based on: https://github.com/glfw/glfw/blob/master/src/glx_context.c
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_PBUFFER_HEIGHT 0x8040
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_PBUFFER_WIDTH 0x8041
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_DOUBLEBUFFER 5
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_DRAWABLE_TYPE 0x8010
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_RENDER_TYPE 0x8011
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_WINDOW_BIT 0x00000001
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_PBUFFER_BIT 0x00000004
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_RGBA_BIT 0x00000001
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_RED_SIZE 8
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_GREEN_SIZE 9
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_BLUE_SIZE 10
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_ALPHA_SIZE 11
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_DEPTH_SIZE 12
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
#define GLX_STENCIL_SIZE 13
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
typedef XID GLXDrawable;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
typedef struct __GLXcontext * GLXContext;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
typedef XID GLXPbuffer;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
typedef struct __GLXFBConfig * GLXFBConfig;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
typedef void (*__GLXextproc)(void);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
typedef __GLXextproc (*PFNGLXGETPROCADDRESSPROC)(const GLubyte * procName);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
typedef int (*PFNXFREE)(void *);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
typedef GLXFBConfig * (*PFNGLXCHOOSEFBCONFIGPROC)(Display *, int, const int *, int *);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARB)(Display *, GLXFBConfig, GLXContext, Bool, const int *);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
typedef void (*PFNGLXDESTROYCONTEXT)(Display *, GLXContext);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
typedef GLXPbuffer (*PFNGLXCREATEPBUFFERPROC)(Display *, GLXFBConfig, const int *);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
typedef void (*PFNGLXDESTROYPBUFFER)(Display *, GLXPbuffer);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
typedef Bool (*PFNGLXMAKECURRENTPROC)(Display *, GLXDrawable, GLXContext);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
typedef void (*PFNGLXSWAPBUFFERSPROC)(Display *, GLXDrawable);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
struct GLXFunctions
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLXFunctions()
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
std::array<char const *, 3> libs = {
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
"libGLX.so.0",
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
"libGL.so.1",
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
"libGL.so",
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
};
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
for (char const * lib : libs)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_module = dlopen(lib, RTLD_LAZY | RTLD_LOCAL);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (m_module)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
break;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
CHECK(m_module != nullptr, ("Failed to initialize GLX"));
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
XFree = loadFunction<PFNXFREE>("XFree");
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
glXGetProcAddress = loadFunction<PFNGLXGETPROCADDRESSPROC>("glXGetProcAddress");
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
glXGetProcAddressARB = loadFunction<PFNGLXGETPROCADDRESSPROC>("glXGetProcAddressARB");
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
glXChooseFBConfig = loadGlxFunction<PFNGLXCHOOSEFBCONFIGPROC>("glXChooseFBConfig");
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
glXCreateContextAttribsARB = loadGlxFunction<PFNGLXCREATECONTEXTATTRIBSARB>("glXCreateContextAttribsARB");
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
glXDestroyContext = loadGlxFunction<PFNGLXDESTROYCONTEXT>("glXDestroyContext");
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
glXCreatePbuffer = loadGlxFunction<PFNGLXCREATEPBUFFERPROC>("glXCreatePbuffer");
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
glXDestroyPbuffer = loadGlxFunction<PFNGLXDESTROYPBUFFER>("glXDestroyPbuffer");
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
glXMakeCurrent = loadGlxFunction<PFNGLXMAKECURRENTPROC>("glXMakeCurrent");
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
glXSwapBuffers = loadGlxFunction<PFNGLXSWAPBUFFERSPROC>("glXSwapBuffers");
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
~GLXFunctions()
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (m_module)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
dlclose(m_module);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
PFNXFREE XFree = nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
PFNGLXGETPROCADDRESSPROC glXGetProcAddress = nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
PFNGLXGETPROCADDRESSPROC glXGetProcAddressARB = nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
PFNGLXCHOOSEFBCONFIGPROC glXChooseFBConfig = nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
PFNGLXCREATECONTEXTATTRIBSARB glXCreateContextAttribsARB = nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
PFNGLXDESTROYCONTEXT glXDestroyContext = nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
PFNGLXCREATEPBUFFERPROC glXCreatePbuffer = nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
PFNGLXDESTROYPBUFFER glXDestroyPbuffer = nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
PFNGLXMAKECURRENTPROC glXMakeCurrent = nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
PFNGLXSWAPBUFFERSPROC glXSwapBuffers = nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
private:
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
template <typename T>
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
T loadFunction(char const * func)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
auto f = reinterpret_cast<T>(dlsym(m_module, func));
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
ASSERT(f, ("Failed to initialize GLX:", func, "is not found"));
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
return f;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
template <typename T>
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
T loadGlxFunction(char const * func)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (auto f = reinterpret_cast<T>(glXGetProcAddress(reinterpret_cast<GLubyte const *>(func))))
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
return f;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (auto f = reinterpret_cast<T>(glXGetProcAddressARB(reinterpret_cast<GLubyte const *>(func))))
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
return f;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
return loadFunction<T>(func);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
void * m_module = nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
};
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
class LinuxGLContext : public dp::OGLContext
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
public:
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
LinuxGLContext(GLXFunctions const & glx, Display * display, Window window, LinuxGLContext * contextToShareWith,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
bool usePixelBuffer)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
: m_glx(glx), m_display(display), m_window(window)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
int visualAttribs[] = {
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLX_DOUBLEBUFFER, True,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLX_RENDER_TYPE, GLX_RGBA_BIT,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLX_DRAWABLE_TYPE, (usePixelBuffer ? GLX_PBUFFER_BIT : GLX_WINDOW_BIT),
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLX_RED_SIZE, 8,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLX_GREEN_SIZE, 8,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLX_BLUE_SIZE, 8,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLX_ALPHA_SIZE, 8,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLX_DEPTH_SIZE, 24,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLX_STENCIL_SIZE, 8,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
None
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
};
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
int contextAttribs[] = {
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLX_CONTEXT_MAJOR_VERSION_ARB, 4,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLX_CONTEXT_MINOR_VERSION_ARB, 1,
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
None};
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
int fbcount = 0;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (GLXFBConfig * config = m_glx.glXChooseFBConfig(display, DefaultScreen(display), visualAttribs, &fbcount))
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_context =
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_glx.glXCreateContextAttribsARB(display, config[0], contextToShareWith ? contextToShareWith->m_context : 0, True, contextAttribs);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
CHECK(m_context != nullptr, ("Failed to create GLX context"));
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (usePixelBuffer)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
int pbufferAttribs[] = {GLX_PBUFFER_WIDTH, 1, GLX_PBUFFER_HEIGHT, 1, None};
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_pixelBufferHandle = m_glx.glXCreatePbuffer(display, config[0], pbufferAttribs);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
CHECK(m_pixelBufferHandle != 0, ("Failed to create GLX pbuffer"));
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_glx.XFree(config);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
~LinuxGLContext() override
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (m_pixelBufferHandle)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_glx.glXDestroyPbuffer(m_display, m_pixelBufferHandle);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_pixelBufferHandle = 0;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (m_context)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_glx.glXDestroyContext(m_display, m_context);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_context = nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
void Present() override
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (!m_pixelBufferHandle)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_glx.glXSwapBuffers(m_display, m_window);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
void MakeCurrent() override
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (!m_glx.glXMakeCurrent(m_display, m_pixelBufferHandle ? m_pixelBufferHandle : m_window, m_context))
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
LOG(LERROR, ("MakeCurrent(): glXMakeCurrent failed"));
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
void DoneCurrent() override
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (!m_glx.glXMakeCurrent(m_display, None, nullptr))
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
LOG(LERROR, ("DoneCurrent(): glXMakeCurrent failed"));
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (framebuffer)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
framebuffer->Bind();
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
else
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLFunctions::glBindFramebuffer(0);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
private:
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLXFunctions const & m_glx;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
Display * m_display = nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
Window m_window = 0;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLXDrawable m_pixelBufferHandle = 0;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLXContext m_context = nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
};
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
class LinuxContextFactory : public dp::GraphicsContextFactory
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
public:
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
LinuxContextFactory(Display * display, Window window) : m_display(display), m_window(window) {}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
dp::GraphicsContext * GetDrawContext() override
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
std::lock_guard<std::mutex> lock(m_contextAccess);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (m_drawContext == nullptr)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_drawContext = std::make_unique<LinuxGLContext>(m_glx, m_display, m_window, m_uploadContext.get(), false);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
return m_drawContext.get();
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
dp::GraphicsContext * GetResourcesUploadContext() override
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
std::lock_guard<std::mutex> lock(m_contextAccess);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (m_uploadContext == nullptr)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_uploadContext = std::make_unique<LinuxGLContext>(m_glx, m_display, 0, m_drawContext.get(), true);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
return m_uploadContext.get();
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
void WaitForInitialization(dp::GraphicsContext *) override
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
std::unique_lock<std::mutex> lock(m_initializationMutex);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (m_isInitialized)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
return;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_initializationCounter++;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (m_initializationCounter >= kGLThreadsCount)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_isInitialized = true;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_initializationCondition.notify_all();
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
else
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
m_initializationCondition.wait(lock, [this] { return m_isInitialized; });
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
bool IsDrawContextCreated() const override
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
std::lock_guard<std::mutex> lock(m_contextAccess);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
return m_drawContext != nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
bool IsUploadContextCreated() const override
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
std::lock_guard<std::mutex> lock(m_contextAccess);
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
return m_uploadContext != nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
private:
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
static size_t constexpr kGLThreadsCount = 2;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
GLXFunctions m_glx;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
Display * m_display = nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
Window m_window = 0;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
std::unique_ptr<LinuxGLContext> m_drawContext;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
std::unique_ptr<LinuxGLContext> m_uploadContext;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
mutable std::mutex m_contextAccess;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
bool m_isInitialized = false;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
size_t m_initializationCounter = 0;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
std::condition_variable m_initializationCondition;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
std::mutex m_initializationMutex;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
};
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
drape_ptr<dp::GraphicsContextFactory> CreateContextFactory(GLFWwindow * window, dp::ApiVersion api, m2::PointU size)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (api == dp::ApiVersion::Vulkan)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
auto contextFactory = make_unique_dp<LinuxVulkanContextFactory>();
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
contextFactory->SetSurface(glfwGetX11Display(), glfwGetX11Window(window));
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
return contextFactory;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (api == dp::ApiVersion::OpenGLES3)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
return make_unique_dp<LinuxContextFactory>(glfwGetX11Display(), glfwGetX11Window(window));
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
ASSERT(false, ("API is not available yet"));
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
return nullptr;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
void OnCreateDrapeEngine(GLFWwindow * window, dp::ApiVersion api, ref_ptr<dp::GraphicsContextFactory> contextFactory)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
// Do nothing
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
void PrepareDestroyContextFactory(ref_ptr<dp::GraphicsContextFactory> contextFactory)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
auto const api = contextFactory->GetDrawContext()->GetApiVersion();
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
if (api == dp::ApiVersion::OpenGLES3)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
// Do nothing
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
else if (api == dp::ApiVersion::Vulkan)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
ref_ptr<LinuxVulkanContextFactory> linuxContextFactory = contextFactory;
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
linuxContextFactory->ResetSurface();
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
else
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
ASSERT(false, ("API is not available yet"));
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
void UpdateContentScale(GLFWwindow * window, float scale)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
// Do nothing
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
void UpdateSize(ref_ptr<dp::GraphicsContextFactory> contextFactory, int w, int h)
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
{
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
// Do nothing
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here
}
vng commented 2025-02-22 10:39:40 +00:00 (Migrated from github.com)
Review

nit: I suppose static is redundant here

nit: I suppose static is redundant here

View file

@ -115,6 +115,10 @@ sudo apt update && sudo apt install -y \
libqt6positioning6-plugins \
libqt6positioning6 \
libsqlite3-dev \
libxrandr-dev \
libxinerama-dev \
libxcursor-dev \
libxi-dev \
zlib1g-dev
```

View file

@ -84,6 +84,7 @@ Automatically [generated](TRANSLATIONS.md#technical-details):
- `cmake/` - CMake helper files.
- `coding/` - I/O classes and data processing.
- `descriptions/` -
- `dev_sandbox/` - developer tool for debugging rendering.
- `drape_frontend/` - scene and resource manager for the Drape library.
- `drape/` - the new graphics library core.
- `editor/` - built-in OSM data editor.

View file

@ -6,6 +6,7 @@
#include <functional>
#include <string>
#include <variant>
#include <vector>
namespace osm

10
shaders/GL/imgui.fsh.glsl Normal file
View file

@ -0,0 +1,10 @@
varying vec2 v_texCoords;
varying vec4 v_color;
uniform sampler2D u_colorTex;
void main()
{
LOW_P vec4 color = texture2D(u_colorTex, v_texCoords);
gl_FragColor = color * v_color;
}

19
shaders/GL/imgui.vsh.glsl Normal file
View file

@ -0,0 +1,19 @@
attribute vec2 a_position;
attribute vec2 a_texCoords;
attribute vec4 a_color;
varying vec2 v_texCoords;
varying vec4 v_color;
uniform mat4 u_projection;
void main()
{
v_texCoords = a_texCoords;
v_color = a_color;
gl_Position = vec4(a_position, 0, 1) * u_projection;
#ifdef VULKAN
gl_Position.y = -gl_Position.y;
gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5;
#endif
}

View file

@ -53,3 +53,4 @@ TrafficCircle traffic_circle.vsh.glsl traffic_circle.fsh.glsl
SmaaEdges smaa_edges.vsh.glsl smaa_edges.fsh.glsl
SmaaBlendingWeight smaa_blending_weight.vsh.glsl smaa_blending_weight.fsh.glsl
SmaaFinal smaa_final.vsh.glsl smaa_final.fsh.glsl
ImGui imgui.vsh.glsl imgui.fsh.glsl

39
shaders/Metal/imgui.metal Normal file
View file

@ -0,0 +1,39 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
typedef struct
{
float2 a_position [[attribute(0)]];
float2 a_texCoords [[attribute(1)]];
float4 a_color [[attribute(2)]];
} Vertex_T;
typedef struct
{
float4 position [[position]];
float2 texCoords;
float4 color;
} Fragment_T;
typedef struct
{
float4x4 u_projection;
} Uniforms_T;
vertex Fragment_T vsImGui(const Vertex_T in [[stage_in]],
constant Uniforms_T & uniforms [[buffer(1)]])
{
Fragment_T out;
out.position = float4(in.a_position, 0.0, 1.0) * uniforms.u_projection;
out.texCoords = in.a_texCoords;
out.color = in.a_color;
return out;
}
fragment float4 fsImGui(const Fragment_T in [[stage_in]],
texture2d<float> u_colorTex [[texture(0)]],
sampler u_colorTexSampler [[sampler(0)]])
{
return in.color * u_colorTex.sample(u_colorTexSampler, in.texCoords);
}

View file

@ -230,4 +230,14 @@ void GLProgramParamsSetter::Apply(ref_ptr<dp::GraphicsContext> context,
Parameter::CheckApply(guard, "u_framebufferMetrics", params.m_framebufferMetrics);
}
void GLProgramParamsSetter::Apply(ref_ptr<dp::GraphicsContext> context,
ref_ptr<dp::GpuProgram> program,
ImGuiProgramParams const & params)
{
UNUSED_VALUE(context);
UniformsGuard guard(program, params);
Parameter::CheckApply(guard, "u_projection", params.m_projection);
}
} // namespace gpu

View file

@ -29,5 +29,7 @@ public:
ref_ptr<dp::GpuProgram> program, ScreenQuadProgramParams const & params) override;
void Apply(ref_ptr<dp::GraphicsContext> context,
ref_ptr<dp::GpuProgram> program, SMAAProgramParams const & params) override;
void Apply(ref_ptr<dp::GraphicsContext> context,
ref_ptr<dp::GpuProgram> program, ImGuiProgramParams const & params) override;
};
} // namespace gpu

View file

@ -31,6 +31,8 @@ public:
ScreenQuadProgramParams const & params) override;
void Apply(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
SMAAProgramParams const & params) override;
void Apply(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
ImGuiProgramParams const & params) override;
};
} // namespace metal
} // namespace gpu

View file

@ -101,5 +101,12 @@ void MetalProgramParamsSetter::Apply(ref_ptr<dp::GraphicsContext> context,
{
ApplyBytes(context, program, params);
}
void MetalProgramParamsSetter::Apply(ref_ptr<dp::GraphicsContext> context,
ref_ptr<dp::GpuProgram> program,
ImGuiProgramParams const & params)
{
ApplyBytes(context, program, params);
}
} // namespace metal
} // namespace gpu

View file

@ -102,6 +102,7 @@ std::array<ProgramInfo, static_cast<size_t>(Program::ProgramsCount)> const kMeta
ProgramInfo("vsSmaaEdges", "fsSmaaEdges", {{0, 1}}), // SmaaEdges
ProgramInfo("vsSmaaBlendingWeight", "fsSmaaBlendingWeight", {{0, 1}}), // SmaaBlendingWeight
ProgramInfo("vsSmaaFinal", "fsSmaaFinal", {{0, 1}}), // SmaaFinal
ProgramInfo("vsImGui", "fsImGui", {{0, 2}}), // ImGui
}};
MTLVertexFormat GetFormatByDataType(MTLDataType dataType)

View file

@ -18,6 +18,7 @@ void ProgramParams::Init()
DebugRectProgramParams::BindPrograms(m_boundParams);
ScreenQuadProgramParams::BindPrograms(m_boundParams);
SMAAProgramParams::BindPrograms(m_boundParams);
ImGuiProgramParams::BindPrograms(m_boundParams);
}
// static

View file

@ -222,6 +222,14 @@ struct ALIGNMENT SMAAProgramParams
Program::SmaaFinal)
};
struct ALIGNMENT ImGuiProgramParams
{
glsl::mat4 m_projection;
BIND_PROGRAMS(ImGuiProgramParams,
Program::ImGui)
};
#undef ALIGNMENT
class ProgramParamsSetter
@ -248,5 +256,7 @@ public:
ref_ptr<dp::GpuProgram> program, ScreenQuadProgramParams const & params) = 0;
virtual void Apply(ref_ptr<dp::GraphicsContext> context,
ref_ptr<dp::GpuProgram> program, SMAAProgramParams const & params) = 0;
virtual void Apply(ref_ptr<dp::GraphicsContext> context,
ref_ptr<dp::GpuProgram> program, ImGuiProgramParams const & params) = 0;
};
} // namespace gpu

View file

@ -65,6 +65,7 @@ enum class Program
SmaaEdges,
SmaaBlendingWeight,
SmaaFinal,
ImGui,
ProgramsCount
};
@ -128,6 +129,7 @@ inline std::string DebugPrint(Program p)
case Program::SmaaEdges: return "SmaaEdges";
case Program::SmaaBlendingWeight: return "SmaaBlendingWeight";
case Program::SmaaFinal: return "SmaaFinal";
case Program::ImGui: return "ImGui";
case Program::ProgramsCount:
CHECK(false, ("Try to output ProgramsCount"));

View file

@ -229,5 +229,12 @@ void VulkanProgramParamsSetter::Apply(ref_ptr<dp::GraphicsContext> context,
{
ApplyImpl(context, program, params);
}
void VulkanProgramParamsSetter::Apply(ref_ptr<dp::GraphicsContext> context,
ref_ptr<dp::GpuProgram> program,
ImGuiProgramParams const & params)
{
ApplyImpl(context, program, params);
}
} // namespace vulkan
} // namespace gpu

View file

@ -55,6 +55,8 @@ public:
ScreenQuadProgramParams const & params) override;
void Apply(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
SMAAProgramParams const & params) override;
void Apply(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
ImGuiProgramParams const & params) override;
private:
template<typename T>