Re: Calling gtk_window_set_resizable minimizes GtkWindow to a point

Hi Lex,

2011/7/29 Lex Trotman <elextr gmail com>
On 29 July 2011 13:30, fykcee1 gmail com <fykcee1 gmail com> wrote:
> Hi all,
> After did a�gtk_window_set_resizable, �my window didn't render as expected
> (minimizes to a point).

Resizes to its contents which is nothing. �Put something in the window
and try again.

Got it, thanks.
> Attachment is the test code.
> Any idea?
> BTW, It seems�gtk_window_set_resizable not only stop the user to resize the
> window, but also the program?

The program doesn't try to resize it.
I added a timeout source, which fails to change the size of window though gtk_window_resize() if a window isn't resizable.

I guess a gtk_widget_set_size_request() should be used instead of�gtk_window_resize() here.


- cee1

#include <gtk/gtk.h>

static GtkWidget *do_win ()
	GtkWidget *win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	GtkWidget *label = gtk_label_new ("Hello world!!!!");

	gtk_widget_set_size_request (win, 640, 480);
	gtk_window_set_position (GTK_WINDOW (win), GTK_WIN_POS_CENTER_ALWAYS);
	gtk_container_set_border_width (GTK_CONTAINER (win), 0);
	gtk_container_add (GTK_CONTAINER (win), label);
	gtk_window_set_decorated (GTK_WINDOW (win), FALSE);
	gtk_widget_show_all (win);

	gtk_window_set_resizable (GTK_WINDOW (win), FALSE);

	return win;

static gboolean resize(GtkWidget *win)
//	gtk_widget_set_size_request (win, 140, 180);
	gtk_window_resize (GTK_WINDOW (win), 130, 180);
	return FALSE;

int main (int argc, char *argv[])
	GtkWidget *win;
	gtk_init (&argc, &argv);
	win = do_win ();
	g_timeout_add (2000, (GSourceFunc) resize, win);
	gtk_main ();

	return 0;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]