Libadwaita bottom sheet breaks when the bottom bar is too tall

i’ve noticed an issue in libadwaita 1.6.1 that i can’t currently report to the gitlab as it is down. essentially, the new bottom sheet widget fails to expand at all when the bottom bar widget is over a certain height. i’ve narrowed down the problem to this snippet:

#include <adwaita.h>

// set low enough and the bottom sheet will work
// set high enough and it will break on pull
#define BOTTOM_BAR_HEIGHT 100

static void activate_cb (GtkApplication *app) {
  GtkWidget *window, *bottom_sheet, *content, *sheet, *bottom_bar;

  bottom_bar = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  gtk_widget_set_size_request (bottom_bar, 0, BOTTOM_BAR_HEIGHT);

  content = gtk_label_new ("content");
  sheet = gtk_label_new ("sheet");

  bottom_sheet = adw_bottom_sheet_new ();
  adw_bottom_sheet_set_content (ADW_BOTTOM_SHEET (bottom_sheet), content);
  adw_bottom_sheet_set_sheet (ADW_BOTTOM_SHEET (bottom_sheet), sheet);
  adw_bottom_sheet_set_bottom_bar (ADW_BOTTOM_SHEET (bottom_sheet), bottom_bar);

  window = gtk_application_window_new (app);
  gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
  gtk_window_set_child (GTK_WINDOW (window), bottom_sheet);

  gtk_window_present (GTK_WINDOW (window));
}

int main (int argc, char **argv) {
  g_autoptr (AdwApplication) app = NULL;
  app = adw_application_new ("com.example.test", G_APPLICATION_DEFAULT_FLAGS);
  g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL);
  return g_application_run (G_APPLICATION (app), argc, argv);
}

additionally, when building libadwaita with clang integer ubsan, the following gets reported in the failing case:

../src/adw-bottom-sheet.c:569:16: runtime error: signed integer overflow: 564 - -2147483648 cannot be represented in type 'int'

here’s the bottom bar height at 10, working properly:

and here it is at 100:

the bottom sheet is essentially invisible and will instantly revert back to the bottom bar if the content is clicked, and the content area isn’t ever shadowed. (i had attached more screenshots at first but the platform does not allow me to submit them)

can you report a bug? Issues · GNOME / libadwaita · GitLab

That is a bug, not much to say here.

Bottom bar being taller than the sheet is quite an edge case tho… not sure how to handle that at all

ah! so it’s not triggered by the bottom bar being too tall on its own, but rather being taller than the sheet. that makes sense, and won’t be the blocker i imagined

i had some trouble signing up to the gitlab, but as soon as it’s sorted out i will submit an issue there

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.