We all "know" that some GtkWidgets have their own GdkWindows (ie GtkButtons), and some do not (ie GtkLabels). At least, that's what the documentation tells us. As I understand it, for GtkWidget* widget, widget->window is this GdkWindow*, if so assigned. ++ I was working on writing a method to expose this in the Java bindings, and was somewhat surprised to find that all the Widgets in my little test app had the _same_ GdkWindow. Huh? So I poked around some more, and in C found the same thing: #include <gtk/gtk.h> int main(int argc, char **argv) { GtkWidget *window; GtkWidget *button; GtkWidget *vbox; GtkWidget *label; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); label = gtk_label_new("Hello"); button = gtk_button_new_with_label("Press Me!"); vbox = gtk_vbox_new(0, FALSE); gtk_container_add(GTK_CONTAINER(vbox), label); gtk_container_add(GTK_CONTAINER(vbox), button); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_widget_show_all(window); g_print("0x%X\n", window->window); g_print("0x%X\n", vbox->window); g_print("0x%X\n", label->window); g_print("0x%X\n", button->window); } gives me: $ ./demo 0x8067D10 0x8067D10 0x8067D10 0x8067D10 $ I really would have expected the GtkButton and GtkLabel to have different GdkWindows. According to this, they're all writing to the same one. {shrug} This is not a problem; I'm just not sure how to explain it (and in turn document our binding of GdkWindow). My guess is either a) my app is too simple, or b) GTK is doing something smart under the hood and the original Xlib <-> GDK wrapping has long been superseded, perhaps by the Cairo drawing layer. Have things evolved from when the original API documentation was written, or am I just doing something really silly? AfC Sydney
Attachment:
signature.asc
Description: This is a digitally signed message part