linebender / linebender/druid

assertion 'width >= -1' failed on NixOS/Sway

Open
#2,396 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
9.7k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

When trying to run one of the examples from the book, the window is created, but no widgets render:

use druid::widget::Label;
use druid::{AppLauncher, Widget, WindowDesc};

fn build_ui() -> impl Widget<()> {
    Label::new("Hello world")
}

fn main() {
    let main_window = WindowDesc::new(build_ui())
        .window_size((600.0, 400.0))
        .title("My first Druid App");
    let initial_data = ();

    AppLauncher::with_window(main_window)
        .launch(initial_data)
        .expect("Failed to launch application");
}

In the console I get this error:

(rust-plugin-try:190043): Gtk-CRITICAL **: 16:10:25.770: gtk_window_set_default_size: assertion 'width >= -1' failed

I apologize if this isn't the right place to put this issue, but I haven't had any issues running apps so far so It seems to be specific to this project? I'm willing to provide any version numbers/environment variables asked of me, but here are some basics:

Rust: 1.75.0
Druid: 0.8.3
Sway: 1.8.1
Nix: 2.18.1
Neofetch (logo removed):

zachiahsawyer@nixos
-------------------
OS: NixOS 23.11.2413.32f63574c85f (Tapir) x86_64
Host: LENOVO LNVNB161216
Kernel: 6.6.8
Uptime: 20 hours, 25 mins
Packages: 763 (nix-system), 1008 (nix-user)
Shell: zsh 5.9
Resolution: 3072x1920
WM: sway
Theme: Catppuccin-Macchiato-Compact-Pink-Dark [GTK2/3]
Terminal: alacritty
CPU: AMD Ryzen 7 6800HS Creator Edition (16) @ 4.785GHz
GPU: AMD ATI Radeon 680M
GPU: NVIDIA GeForce RTX 3050 Mobile
Memory: 11912MiB / 13669MiB

Also, I don't know how relevant it is, but I'm using a shell.nix file to setup the environment

which looks like this:
{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
    buildInputs = [
        pkgs.alsaLib
        pkgs.pkg-config
        pkgs.pango
        pkgs.cairo
        pkgs.gdk-pixbuf
        pkgs.gtk3
    ];
    shellHook = ''
        export PKG_CONFIG_PATH=${pkgs.alsaLib}/lib/pkgconfig:${pkgs.pango}/lib/pkgconfig:${pkgs.cairo}/lib/pkgconfig:${pkgs.gdk-pixbuf}/lib/pkgconfig:${pkgs.gtk3}/lib/pkgconfig:$PKG_CONFIG_PATH
    '';
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the book's minimal example with Rust 1.75.0 and Druid 0.8.3 on NixOS 23.11 under Sway, using the reported shell.nix dependencies. Investigate the window-creation path around the GTK assertion; done means the example displays its widget without the assertion.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, rust
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.