Skip to content
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

Merged
merged 2 commits into from
Oct 21, 2018

Conversation

aangerma
Copy link
Contributor

@aangerma aangerma commented Oct 17, 2018

When graphics driver is not up to date there is sometimes misalignment in the viewer UI:
image

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

@@ -855,6 +855,8 @@ namespace rs2

void popup_if_error(ImFont* font, std::string& error_message);

void popup_if_ui_not_aligned(ImFont* font);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabs

Suggested change
void popup_if_ui_not_aligned(ImFont* font);
void popup_if_ui_not_aligned(ImFont* font);

@@ -904,6 +906,8 @@ namespace rs2
float dim_level = 1.f;

rs2::asynchronous_syncer s;

bool continue_with_ui_not_aligned = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool continue_with_ui_not_aligned = false;
bool continue_with_ui_not_aligned = false;

{
auto hwn = glfwGetWin32Window(win);
if (hwn == nullptr)
return false;
Copy link
Contributor

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


auto DrawList = ImGui::GetWindowDrawList();
if (DrawList == nullptr)
return false;
Copy link
Contributor

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)
Copy link
Contributor

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

@@ -92,5 +94,7 @@ namespace rs2
bool _fullscreen_pressed = false;
bool _fullscreen = false;
std::string _title;

bool _is_ui_aligned = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool _is_ui_aligned = false;
bool _is_ui_aligned = false;

@@ -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
Copy link
Contributor

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())
Copy link
Contributor

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
Copy link
Contributor

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())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabs

@dorodnic dorodnic merged commit 76d7d90 into IntelRealSense:development Oct 21, 2018
@aangerma aangerma deleted the ui_bug branch November 7, 2019 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants