-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle offset on UI when graphics driver is not updated #2546
Conversation
common/model-views.h
Outdated
@@ -855,6 +855,8 @@ namespace rs2 | |||
|
|||
void popup_if_error(ImFont* font, std::string& error_message); | |||
|
|||
void popup_if_ui_not_aligned(ImFont* font); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tabs
void popup_if_ui_not_aligned(ImFont* font); | |
void popup_if_ui_not_aligned(ImFont* font); |
common/model-views.h
Outdated
@@ -904,6 +906,8 @@ namespace rs2 | |||
float dim_level = 1.f; | |||
|
|||
rs2::asynchronous_syncer s; | |||
|
|||
bool continue_with_ui_not_aligned = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool continue_with_ui_not_aligned = false; | |
bool continue_with_ui_not_aligned = false; |
common/ux-alignment.cpp
Outdated
{ | ||
auto hwn = glfwGetWin32Window(win); | ||
if (hwn == nullptr) | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you encounter error during check I'd expect the function to return true
, not false
because you have zero evidence to support UI-misalignment
common/ux-alignment.cpp
Outdated
|
||
auto DrawList = ImGui::GetWindowDrawList(); | ||
if (DrawList == nullptr) | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
|
||
#define MAGIC 250 | ||
|
||
bool is_gui_aligned(GLFWwindow *win) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function deserves and requires a great comment.
There is no way to guess from the code what you are trying to do and why
common/ux-window.h
Outdated
@@ -92,5 +94,7 @@ namespace rs2 | |||
bool _fullscreen_pressed = false; | |||
bool _fullscreen = false; | |||
std::string _title; | |||
|
|||
bool _is_ui_aligned = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool _is_ui_aligned = false; | |
bool _is_ui_aligned = false; |
tools/depth-quality/CMakeLists.txt
Outdated
@@ -48,6 +48,8 @@ endif() | |||
../../third-party/imgui/imgui_impl_glfw.cpp | |||
../../third-party/imgui/imgui-fonts-karla.hpp | |||
../../third-party/imgui/imgui-fonts-fontawesome.hpp | |||
../../common/ux-alignment.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tabs
@@ -434,6 +434,10 @@ namespace rs2 | |||
|
|||
void tool_model::render(ux_window& win) | |||
{ | |||
if (!win.is_ui_aligned()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tabs
@@ -45,13 +45,15 @@ endif() | |||
../../common/model-views.cpp | |||
../../common/ux-window.h | |||
../../common/ux-window.cpp | |||
../../common/ux-alignment.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tabs
@@ -273,6 +273,10 @@ int main(int argv, const char** argc) try | |||
// Closing the window | |||
while (window) | |||
{ | |||
if (!window.is_ui_aligned()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tabs
When graphics driver is not up to date there is sometimes misalignment in the viewer UI:

In this PR I added code that detects this situation, notifies the user and suggests a link to the updated driver:
