-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Make debug windows right edge sticky #455
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportBase: 86.71% // Head: 86.71% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## master #455 +/- ##
=======================================
Coverage 86.71% 86.71%
=======================================
Files 83 83
Lines 3981 3981
=======================================
Hits 3452 3452
Misses 529 529 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
650f702
to
ed19a7f
Compare
browser/gui/app.cpp
Outdated
NULL, | ||
}; | ||
|
||
int delta = k_width - size.width; |
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 is UB on the first call to this function since k_width isn't initialized.
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.
Aren't integer members 0 if NOS in c++?
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.
No, unless set in e.g. a constructor they're uninitialized and reading from them is UB.
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.
good enough?
break; | ||
} | ||
ImGuiWindow *win = ImGui::FindWindowByName(name); | ||
if (!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.
Isn't this a programming error if it ever happens? Until we have a saner way of keeping the names in sync, just assert()
that we have the window we're looking for.
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.
Isn't this a programming error if it ever happens?
No, because we might decide that windows are ephemeral. I can think of plenty of reasons we might want to destroy some # of them at runtime.
Assert will crash the app, window stickiness should be a "best effort" feature. No reason to make the app user hostile when it doesn't need to be.
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.
Right now, all windows always exist. If that changes in the future it will be because a developer changes it and they probably need to have a look at this code and think about what they're doing.
Since you made me look at the imgui internals now, did you have a look at using GImGui.Windows
for this so we don't have to hard-code a list of window names?
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.
yes/no?
1b8ca1e
to
20866b7
Compare
Now when the right edge of any debug window in the list is at the edge of the viewport width, it will stick there through resizes. There's a bug where if the resize change is enough to "capture" a window that wasn't intended to be sticky it will capture. Given this didn't happen much during testing, I don't think the extra state + code required is worth it for these windows.
Now when the right edge of any debug window in the list is at the edge
of the viewport width, it will stick there through resizes.
There's a bug where if the resize change is enough to "capture" a window
that wasn't intended to be sticky it will capture. Given this didn't
happen much during testing, I don't think the extra state + code
required is worth it for these windows.