c - gtk_window_set_default_size doesn't work -
i have code:
#define false false #define true true #include <gtk/gtk.h> int main( int argc, char *argv[]){ gtkwidget *window; gtk_init(&argc, &argv); window = gtk_window_new(gtk_window_toplevel); gtk_window_set_title(gtk_window(window), "window"); gtk_window_set_default_size(gtk_window(window), 230, 150); gtk_window_set_resizable(gtk_window(window), false); gtk_window_set_position(gtk_window(window), gtk_win_pos_center); g_signal_connect(g_object(window), "destroy", g_callback(gtk_main_quit), 0); gtk_widget_show(window); gtk_main(); return 0; }
when compile code line below , run it, window ends being 1x1px
gcc src/main.c -o test -wall -o2 `pkg-config --libs --cflags gtk+-3.0`
if remove gtk_window_set_resizable
line, starts working again.
why happen? missing something?
so reading this question's answer, learned gtk_window_set_default_size
doesn't work, replaced gtk_window_set_default_size
instead:
gdkgeometry windowproperties; windowproperties.min_width = 230; windowproperties.min_height = 150; gtk_window_set_geometry_hints(gtk_window(window), null, &windowproperties, gdk_hint_min_size);
Comments
Post a Comment