Skip to content

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

@Zachiah

Description

@Zachiah

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
    '';
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions