problems with widget's size in gtk box gtk

Viewed 41

for some reason button expands fully from up to bottom, but fill and expand are set to false, so it shouldn't be the case, right?

this is how it looks

and code:

#include <gtk/gtk.h>

int main() {
    GtkWidget* window;
    GtkWidget* box;
    GtkWidget* frame;
        
    gtk_init(NULL, NULL);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    gtk_window_set_default_size(GTK_WINDOW(window), 400, 400);

    frame = gtk_frame_new("box");
    gtk_container_add(GTK_CONTAINER(window), frame);

    box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);

    gtk_container_add(GTK_CONTAINER(frame), box);

    GtkWidget* button = gtk_button_new_with_mnemonic("test");

    gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0);

    gtk_widget_set_hexpand(button, 0);
    gtk_widget_set_vexpand(button, 0);

    gtk_widget_show_all(window);

    gtk_main();
}

forcing widget size with gtk_widget_set_size_request only affects the button's width.

0 Answers
Related