Skip to content

Constraints' minimum sizes are not consistent #19

@ptomato

Description

@ptomato

Here's a GJS script that illustrates the bug:

const Emeus = imports.gi.Emeus;
const Gtk = imports.gi.Gtk;
Gtk.init(null);

let view = new Emeus.ConstraintLayout();
let widgets = {
    w1: new Gtk.Button({ label: "Hello" }),
    w2: new Gtk.Button({ label: "world" }),
};
view.add(widgets.w1);
view.add(widgets.w2);

let constraints = Emeus.create_constraints_from_description([
    "|-[w1(200)]-(>=0)-|",
    "|-[w2(300)]-(>=0)-|",
    "V:|-[w1]-(>=100)-[w2]",
], 15, 15, widgets, {});
constraints.forEach(view.add_constraint, view);

let win = new Gtk.Window();
win.add(view);
win.connect('destroy', Gtk.main_quit);
win.show_all();
Gtk.main();

When you run this, the initial size of the window (215x200) is big enough to take the vertical size of the layout and the horizontal size of w1 into account, but not the horizontal size of w2, which is cut off.

If you drag the window's lower right resize grip around in circles, you can get into one of two states: either (1) the window will not size smaller vertically than 200 pixels but will size horizontally down to 1 pixel wide, or (2) the window will not size smaller than 215x200 pixels. It's unclear to me how to reproducibly get into each state, but each time you restart the program and drag the resize grip around, you will get into one of the two. (Very rarely, you can even change by just frenetically dragging the resize grip without restarting the program.)

It seems to me that the minimum size should be more like 315x200 (to take w2 into account) and should be consistent no matter how many times you resize the window.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions