I am a novice to GTK+ development, and I am trying to port the XBoard Chess interface from the old Xt/Xaw widget setto GTK. ButI run into a pesky problem that I don't understand at all:
Whenever I pack a gtk_drawing_area into something else (be it a table cell or a frame) there is this extra space at the bottom of it. Even when I specify the height of the gtk_drawing_area explicitly with gtk_widget_set_size_request, the frame doesn't fit tightly around it, but there is this extra empty space below it, which can then be squeezed out by sizing the window. Until the frame touches the drawing area, after which it refuses to size any smaller (as expected).

After creation of the window I used gtk_widget_get_allocation to get the sizes of the drawing_area, and it tells me that it indeed has the small size (i.e. not including the empty space). I really have no idea what makes GTK think it would be a good idea to just throw in some extra space. This problem is very annoying to me, because WinBoard uses the sizes of the top-level window and the board image to calculate the margin that is needed for the rest (clock widgets, menu bar, window decorations), so that it can calculate later (after the user resizes the window) how large it should draw the pieces ad board squares to have the board fit. It has no way to know that part of that difference is just unnecessary filler, so it always draws the board too small:

The code I use to create the drawing area (on Ubuntu 10.04) is:
Code:
case Graph:
option[i].handle = (void*) (graph = gtk_drawing_area_new());
// gtk_widget_set_size_request(graph, option[i].max, option[i].value);
g_signal_connect (graph, "expose-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
gtk_widget_add_events(GTK_WIDGET(graph), GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK);
g_signal_connect (graph, "button-press-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
g_signal_connect (graph, "button-release-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
g_signal_connect (graph, "motion-notify-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
if(1) { // Surround by frame, to isolate the sizing problem and make it visually obvious
GtkWidget *frame = gtk_frame_new(NULL);
gtk_container_add(GTK_CONTAINER(frame), graph);
graph = frame;
}
Pack(hbox, table, graph, left, left+r, top, GTK_EXPAND);
Any help or suggestions on this would be welcome, as I am currently at a total loss.