On Sun, 2011-11-20 at 12:29 +0100, Bernhard Schuster wrote: > 2011/11/20 Dipesh Sudershan <d1p3shn0...@gmail.com>: > > On Sun, 2011-11-20 at 11:55 +0100, Bernhard Schuster wrote: > >> Screw it, replace the "|" with an "&". Sorry screwed this up. > >> > >> Regards > > > > This is working fine. But i still can't solve the problem i have. > > > > I have a gtkimage inside an eventbox. the eventbox inside a gtklayout > > and finally the gtklayout inside a scrolledwindow. When the toplevel > > window is maximized, i requested for allocated size of the gtkimage, > > eventbox, gtklayout and scrolledwindow. the allocated sizes were the > > same as when the window was unmaximized. When the window is maximized, > > shouldn't the sizes of the childwidgets expand? > > > > gtk_box_pack_start(GTK_BOX(vbox), scrolledwindow, TRUE, TRUE, 0); > > > > This is how the scrolledwindow is packed into the main window. > > > > > > > > > > To get the size in Gtk 2.x you need to create a workaround as shown in > this examples (code I wrote & used some time ago for a legacy gtk2 > project), size allocation returns not what you desire: > http://pastie.org/2892251 & http://pastie.org/2892254 > > In the gtk3 there is a simple function call: http://pastie.org/2892267 > > Both work just fine > > Regards > > > Bernhard Schuster
I'm using gtk-3.0. gtk_widget_get_allocated width and gtk_widget_get_allocated height are not working. I'm not get getting the size of the child widgets when the main window is maximized. I will try to explain better.. I have a gtkwindow which contains the scrolled window. I have connected configure-event with the gtkwindow and that works fine. I get correct allocated sizeds from the functions mentioned above. But with the window-state-event, i'm not getting correct values. here's the code for the window-state-event handler function.. static gboolean window_state_event_handler(gtkWidget *widget, GdkEventWindowState *event) { if ( event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED ) { int width, height; //GtkAllocation allocate; //gtk_widget_get_allocation(currentjob->mw->scrolledwindow,&allocate); //width = allocate.width; //height = allocate.height; width = gtk_widget_get_allocated_width(currentjob->mw->layout); height = gtk_widget_get_allocated_height(currentjob->mw->layout); printf("%dx%d\n", width, height); } return FALSE; } _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list