ui: the signal badge is the drag handle (to a plot row, or to reorder); the list rows stop dragging
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
f27925da59
commit
ca10dfb323
9 files changed
+230
-109
No files matched your search
+18
-30
@@ -101,10 +101,9 @@ gboolean exit_probe_step3b(gpointer user) {
|
||||
// the page is open and the reveal has run.
|
||||
a->dbg_signal_w = gtk_widget_get_width(a->signal_panel);
|
||||
a->dbg_signal_h = gtk_widget_get_height(a->signal_panel);
|
||||
// How many rows of the signal list carry a drag source: dragging a signal onto a plot is how a plot is
|
||||
// filled, so it has to survive both pane modes -- the locked list drops the tick, the menu and the `+`,
|
||||
// and this is the reading that says it did not drop the drag with them. One row is the `MATH` divider,
|
||||
// which is not draggable: the count must be `rows - 1`.
|
||||
// How many rows of the signal list carry a drag source: none. Dragging a signal onto a plot is the signal
|
||||
// badge's job (and survives the pane lock, since the badges do not follow it); the list's rows only open
|
||||
// the signal's page. The reading says the list did not grow a second, competing handle.
|
||||
if (a->signal_list != nullptr) {
|
||||
int sources = 0;
|
||||
for (GtkWidget* r = gtk_widget_get_first_child(a->signal_list); r != nullptr;
|
||||
@@ -119,34 +118,23 @@ gboolean exit_probe_step3b(gpointer user) {
|
||||
}
|
||||
a->dbg_signal_drag_sources = sources;
|
||||
}
|
||||
// A drag out of an *overlaid* sidebar: the sidebar has to step aside or the drop has nowhere to land.
|
||||
// The state is forced the way the sidebar probe forces it -- collapsed is what a window with no room
|
||||
// beside the plot produces -- and the drag is begun through the *source*, so the handler is the one a
|
||||
// real drag reaches.
|
||||
if (a->side_view != nullptr && a->signal_list != nullptr) {
|
||||
AdwOverlaySplitView* split = ADW_OVERLAY_SPLIT_VIEW(a->side_view);
|
||||
GtkWidget* row = gtk_widget_get_first_child(a->signal_list);
|
||||
adw_overlay_split_view_set_collapsed(split, TRUE);
|
||||
adw_overlay_split_view_set_show_sidebar(split, TRUE);
|
||||
if (row != nullptr) {
|
||||
GListModel* controllers = gtk_widget_observe_controllers(row);
|
||||
const guint n = controllers != nullptr ? g_list_model_get_n_items(controllers) : 0;
|
||||
for (guint i = 0; i < n; ++i) {
|
||||
GObject* c = G_OBJECT(g_list_model_get_item(controllers, i));
|
||||
if (GTK_IS_DRAG_SOURCE(c)) {
|
||||
g_signal_emit_by_name(c, "drag-begin", nullptr);
|
||||
a->dbg_drag_hid_sidebar =
|
||||
adw_overlay_split_view_get_show_sidebar(split) == FALSE ? 1 : 0;
|
||||
row_drag_sidebar(*a, false);
|
||||
a->dbg_drag_restored_sidebar =
|
||||
adw_overlay_split_view_get_show_sidebar(split) != FALSE ? 1 : 0;
|
||||
}
|
||||
g_object_unref(c);
|
||||
// A drag out of a badge with a slide-over open: the panel covers the plot's right edge, so it has to step
|
||||
// aside or part of the plot is not a place to drop. The drag is begun through the *source*, so the handler
|
||||
// is the one a real drag reaches; the page that was open is put back so the readings after it stand.
|
||||
if (!a->badges.signal_badges.empty() && slideover_has_page(*a, "signals")) {
|
||||
const std::string was = slideover_page(*a);
|
||||
slideover_open(*a, "signals");
|
||||
GListModel* controllers = gtk_widget_observe_controllers(a->badges.signal_badges.front()->button);
|
||||
const guint n = controllers != nullptr ? g_list_model_get_n_items(controllers) : 0;
|
||||
for (guint i = 0; i < n; ++i) {
|
||||
GObject* c = G_OBJECT(g_list_model_get_item(controllers, i));
|
||||
if (GTK_IS_DRAG_SOURCE(c)) {
|
||||
g_signal_emit_by_name(c, "drag-begin", nullptr);
|
||||
a->dbg_drag_closed_slideover = slideover_page(*a).empty() ? 1 : 0;
|
||||
}
|
||||
g_object_unref(c);
|
||||
}
|
||||
// Left as the window's own width decides, so the readings taken before this are the ones that stand.
|
||||
adw_overlay_split_view_set_collapsed(split, FALSE);
|
||||
adw_overlay_split_view_set_show_sidebar(split, TRUE);
|
||||
if (!was.empty()) slideover_open(*a, was);
|
||||
}
|
||||
// The panes' own switches, and *both* directions of the sync: the header bar's trigger button is
|
||||
// flipped here and the pane's switch has to follow, then the cursors' switch is driven from the
|
||||
|
||||
Reference in new issue
Block a user