Skip to content

Commit

Permalink
Minor bugfix: use GLFW instead of ImGui for hiding cursor.
Browse files Browse the repository at this point in the history
This applies mainly to the interaction modes. Not sure if an something was changed with an ImGui update, but the current solution using `io.MouseDrawCursor` did not seem to work correctly anymore.
  • Loading branch information
GPMueller committed Apr 6, 2021
1 parent e1739df commit b8e3697
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ui-cpp/ui-imgui/src/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -930,10 +930,10 @@ void MainWindow::draw_imgui( int display_w, int display_h )
if( ui_shared_state.interaction_mode != UiSharedState::InteractionMode::REGULAR )
{
if( ImGui::IsWindowHovered( ImGuiHoveredFlags_AnyWindow ) )
io.MouseDrawCursor = true;
glfwSetInputMode( glfw_window, GLFW_CURSOR, GLFW_CURSOR_NORMAL );
else
{
io.MouseDrawCursor = false;
glfwSetInputMode( glfw_window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN );

ImU32 color = IM_COL32( 0, 0, 0, 255 );
if( ui_shared_state.interaction_mode == UiSharedState::InteractionMode::DRAG )
Expand Down Expand Up @@ -998,7 +998,7 @@ void MainWindow::draw_imgui( int display_w, int display_h )
ImGui::PopStyleVar();
}
else
io.MouseDrawCursor = true;
glfwSetInputMode( glfw_window, GLFW_CURSOR, GLFW_CURSOR_NORMAL );

// ----------------

Expand Down

0 comments on commit b8e3697

Please sign in to comment.