ui: the readouts strip is also shown in a collapsed window
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
3526ce0541
commit
1d144663b9
4 files changed
+36
-22
No files matched your search
+8
-4
@@ -4013,10 +4013,14 @@ gboolean tick(gpointer user) {
|
||||
app->sidebar_syncing = false;
|
||||
}
|
||||
}
|
||||
// The readouts strip is on screen exactly when the dock is not. Decided here, right after the wish was
|
||||
// re-asserted and *before* the collapsing below (which makes the split view write `show-sidebar`
|
||||
// false itself until the next frame re-asserts it): read after it, the strip would show for one frame
|
||||
// each time the window narrowed.
|
||||
// The readouts strip is on screen when the dock is not beside the plot: `!show-sidebar || collapsed`.
|
||||
// Decided here, right after the wish was re-asserted and *before* the collapsing below (which makes
|
||||
// the split view write `show-sidebar` false itself until the next frame re-asserts it): read after
|
||||
// it, `show-sidebar` would be that transient false. The strip reads `collapsed` too, and here that is
|
||||
// the previous frame's value (`set_collapsed()` follows): on a collapse or a widening the strip
|
||||
// changes one tick after the split view does, but never to a wrong state -- `show-sidebar` is always
|
||||
// the re-asserted wish and `collapsed` a settled value -- so it does not flash. Moving the call after
|
||||
// `set_collapsed()` would bring back the transient `show-sidebar` for nothing.
|
||||
sync_readouts_strip(*app);
|
||||
const int window_w = gtk_widget_get_width(app->window);
|
||||
if (window_w > 0) {
|
||||
|
||||
+5
-4
@@ -610,8 +610,8 @@ struct App {
|
||||
GtkWidget* dock_measures_edit = nullptr;
|
||||
/// One value label per measurement, in `measures` order (the dock's copy of `measure_labels`).
|
||||
std::vector<GtkWidget*> dock_measure_labels;
|
||||
/// The readouts strip under the plot (`main-window.ui` `readouts_strip`, `src/ui_dock.cpp`): shown only
|
||||
/// while the dock is not. Its value labels mirror the dock's one for one -- `strip_cursor_deltas` the
|
||||
/// The readouts strip under the plot (`main-window.ui` `readouts_strip`, `src/ui_dock.cpp`): shown
|
||||
/// whenever the dock is not beside the plot (`!show-sidebar || collapsed`). Its value labels mirror the dock's one for one -- `strip_cursor_deltas` the
|
||||
/// `d` cell of each `dock_cursor_lines` entry, `strip_measure_labels` each of `dock_measure_labels` --
|
||||
/// and `strip_cursor_who` the cursor lines' `who` cells, all written from the dock setters' arguments.
|
||||
GtkWidget* readouts_strip = nullptr;
|
||||
@@ -1797,8 +1797,9 @@ void dock_cursor_cell(App& app, std::size_t line, const std::string& a, const st
|
||||
void dock_measure_value(App& app, std::size_t i, const std::string& text);
|
||||
/// The readouts strip under the plot (`src/ui_dock.cpp`): the third reader of the same strings. It is
|
||||
/// filled by the `dock_*` rebuilds and written by the `dock_*` setters above (so nothing here formats),
|
||||
/// and shown exactly when the dock is not: `sync_readouts_strip()` is called by the tick after the
|
||||
/// show-sidebar reconciliation. `dock_set_cursors_sensitive()` is the one writer of the cursor readouts'
|
||||
/// and shown whenever the dock is not beside the plot (`!show-sidebar || collapsed`, a collapsed dock being
|
||||
/// an overlay on it): `sync_readouts_strip()` is called by the tick after the show-sidebar reconciliation
|
||||
/// and before `set_collapsed()`, so it reads the previous frame's `collapsed`. `dock_set_cursors_sensitive()` is the one writer of the cursor readouts'
|
||||
/// sensitivity, for the dock's grid and the strip's chips together.
|
||||
void sync_readouts_strip(App& app);
|
||||
void dock_set_cursors_sensitive(App& app, bool on);
|
||||
|
||||
+10
-5
@@ -11,7 +11,8 @@
|
||||
//
|
||||
// The same strings are shown a third time in the readouts strip under the plot (`readouts_strip`, one
|
||||
// fixed-height line: a "Cursors" button, one chip per cursor line with its delta, a "Measures" button, one
|
||||
// chip per measurement with its value), which is on screen exactly when the dock is not. The setters below
|
||||
// chip per measurement with its value), which is on screen whenever the dock is not beside the plot (hidden
|
||||
// with the Dock button, or the window collapsed and the dock an overlay). The setters below
|
||||
// write the strip's labels in the same call as the dock's, from the same argument, so there is still one
|
||||
// string and no second formatter.
|
||||
//
|
||||
@@ -345,10 +346,14 @@ void dock_set_cursors_sensitive(App& app, bool on) {
|
||||
|
||||
void sync_readouts_strip(App& app) {
|
||||
if (app.readouts_strip == nullptr || app.side_view == nullptr) return;
|
||||
// The strip is on screen exactly when the dock is not: `show-sidebar` is false when the dock is hidden
|
||||
// with the Dock button, and when the window is collapsed and the dock is not currently overlaid.
|
||||
const bool want =
|
||||
!adw_overlay_split_view_get_show_sidebar(ADW_OVERLAY_SPLIT_VIEW(app.side_view));
|
||||
// The strip is on screen whenever the dock is not *beside* the plot: hidden with the Dock button, or
|
||||
// the window collapsed (compact mode), where the dock overlays the plot -- even while the overlay is
|
||||
// open -- and is not a readout you can keep an eye on while looking at the trace. `collapsed` is the
|
||||
// split view's value from the previous frame (the tick calls this before `set_collapsed()`), so the
|
||||
// strip follows a collapse or a widening one tick late; `show-sidebar` is the wish just re-asserted.
|
||||
AdwOverlaySplitView* split = ADW_OVERLAY_SPLIT_VIEW(app.side_view);
|
||||
const bool want = !adw_overlay_split_view_get_show_sidebar(split) ||
|
||||
adw_overlay_split_view_get_collapsed(split);
|
||||
if ((gtk_widget_get_visible(app.readouts_strip) != FALSE) != want) {
|
||||
gtk_widget_set_visible(app.readouts_strip, want);
|
||||
}
|
||||
|
||||
+13
-9
@@ -4338,8 +4338,10 @@ static int dock_width_fits(App& a, int* dock_w, int* side_w) {
|
||||
}
|
||||
|
||||
/// The readouts strip against the dock it mirrors: `same_text=1` when every strip label's text equals the
|
||||
/// dock's (the cursors' `who` and delta cells, the measurements' values) and the counts agree. `visible` must
|
||||
/// be the opposite of `dock_shown` (`show-sidebar`), and `h` the strip's fixed 26 whenever it is visible.
|
||||
/// dock's (the cursors' `who` and delta cells, the measurements' values) and the counts agree. The strip is
|
||||
/// shown whenever the dock is not beside the plot, so `expected` is `!dock_shown || collapsed` (`dock_shown`
|
||||
/// is `show-sidebar`, `collapsed` the split view's, both read in the same frame as `visible`), `visible_ok`
|
||||
/// is `visible == expected`, and `h` is the strip's fixed 26 whenever it is visible.
|
||||
/// `sens_same` is the strip's cursor chips sharing the dock grid's sensitivity.
|
||||
static void strip_report(App& a, const char* tag, const char* what) {
|
||||
const auto text = [](GtkWidget* w) { return std::string(gtk_label_get_text(GTK_LABEL(w))); };
|
||||
@@ -4363,13 +4365,15 @@ static void strip_report(App& a, const char* tag, const char* what) {
|
||||
const bool collapsed =
|
||||
a.side_view != nullptr &&
|
||||
adw_overlay_split_view_get_collapsed(ADW_OVERLAY_SPLIT_VIEW(a.side_view)) != FALSE;
|
||||
const bool expected = !dock_shown || collapsed;
|
||||
const bool sens_same =
|
||||
a.strip_cursor_box != nullptr && a.dock_cursor_grid != nullptr &&
|
||||
gtk_widget_get_sensitive(a.strip_cursor_box) == gtk_widget_get_sensitive(a.dock_cursor_grid);
|
||||
std::fprintf(stderr,
|
||||
"[%s-probe] %-14s strip: visible=%d dock_shown=%d cursors=%zu measures=%zu same_text=%d "
|
||||
"h=%d sens_same=%d collapsed=%d window=%d\n",
|
||||
tag, what, visible ? 1 : 0, dock_shown ? 1 : 0, a.strip_cursor_deltas.size(),
|
||||
"[%s-probe] %-14s strip: visible=%d expected=%d visible_ok=%d dock_shown=%d cursors=%zu "
|
||||
"measures=%zu same_text=%d h=%d sens_same=%d collapsed=%d window=%d\n",
|
||||
tag, what, visible ? 1 : 0, expected ? 1 : 0, visible == expected ? 1 : 0,
|
||||
dock_shown ? 1 : 0, a.strip_cursor_deltas.size(),
|
||||
a.strip_measure_labels.size(), same, a.readouts_strip != nullptr
|
||||
? gtk_widget_get_height(a.readouts_strip) : -1,
|
||||
sens_same ? 1 : 0, collapsed ? 1 : 0,
|
||||
@@ -4378,10 +4382,10 @@ static void strip_report(App& a, const char* tag, const char* what) {
|
||||
|
||||
/// Puts the dock away through the wish the tick re-asserts and reads the strip with it hidden
|
||||
/// (`<tag>-probe ... strip:`: visible must be 1, h 26, same_text 1), then restores the wish and reads it
|
||||
/// again (visible must be 0). Under `xvfb-run` the window is 756 px wide, below `kSidebarRoom`, so the split
|
||||
/// view is `collapsed` on every line: both legs are the collapsed case (the tick keeps a wished dock
|
||||
/// overlaid, a hidden one off), and `collapsed=0` is not reachable from a probe -- a window with no
|
||||
/// manager cannot be resized by `gtk_window_set_default_size()`.
|
||||
/// again. Under `xvfb-run` the window is 756 px wide, below `kSidebarRoom`, so the split view is `collapsed`
|
||||
/// on every line and the strip is visible on every line, the restored one included (the tick keeps a wished
|
||||
/// dock overlaid, a hidden one off); the wide case, where the restored dock hides the strip, is not reachable
|
||||
/// from a probe -- a window with no manager cannot be resized by `gtk_window_set_default_size()`.
|
||||
struct StripDrive {
|
||||
App* app;
|
||||
const char* tag;
|
||||
|
||||
Reference in new issue
Block a user