Window(title, width, height, flags) ignores the flags argument
Checklist
- I have searched for similar issues.
- For Python issues, I have tested with the latest development wheel.
- I have checked the release documentation and the latest documentation (for
mainbranch).
Describe the issue
The two convenience constructors of open3d::visualization::gui::Window drop the flags parameter when delegating to the main constructor. As a result, Window::FLAG_HIDDEN and Window::FLAG_TOPMOST have no effect when using these overloads.
Code (cpp/open3d/visualization/gui/Window.cpp): Window::Window(const std::string& title, int flags /= 0/) : Window(title, CENTERED_X, CENTERED_Y, AUTOSIZE_WIDTH, AUTOSIZE_HEIGHT) {} // ^^^^^ flags not forwarded
Window::Window(const std::string& title, int width, int height, int flags /= 0/) : Window(title, CENTERED_X, CENTERED_Y, width, height) {} // ^^^^^ flags not forwarded
Window::Window(const std::string& title, int x, int y, int width, int height, int flags /= 0/) : impl_(new Window::Impl()) { // ... bool visible = (!(flags & FLAG_HIDDEN) && (impl_->wants_auto_size_ || impl_->wants_auto_center_)); int ws_flags = 0; if (!visible) { ws_flags |= WindowSystem::FLAG_HIDDEN; } // ... }
Steps to reproduce the bug
auto window = std::make_shared<open3d::visualization::gui::Window>(
"test", 800, 600, open3d::visualization::gui::Window::FLAG_HIDDEN);
// Expect: window is created hidden
// Actual: window is created visibleError message
No response
Expected behavior
Observed behavior:
Window::IsVisible() returns true immediately after construction, and the native window is shown on screen.
Expected behavior:
Window::IsVisible() should return false, and the native window should not be shown until Show(true) is called.
Root cause:
In the first two constructors, the flags parameter is not passed to the delegated constructor. The compiler uses the default value 0 for flags, so FLAG_HIDDEN / FLAG_TOPMOST are silently ignored.
Open3D, Python and System information
Open3D version: 0.20.0 (prebuilt devel package)
OS: Windows 10 / 11
Compiler: MSVC 2022
Usage: Open3D GUI embedded into a WPF host via SetParent; the hidden flag is needed to avoid a visible flash before the native window is reparented.Additional information
No response
Source: isl-org/Open3D