This patch corrects a design bug of the gtkviewport widget. Currently the viewport widget cannot be subclassed because of its windows' layout. First let me explain how the viewport widget works. It's composed of 3 windows, and 1 widget (the child in the viewport). +--------main_window------------+ | | | +-----view_window---------+ | | | | | | | +------window----------|- -|- - + | | | | | | | | | | | | | | | | | | | | child widget in | | | | | "window" | | | | | | | | | | | | | | | | | | | | | | | | | | +-------------------------+ | | | | | | | +-------------------------------+ | | | +- - - - - - - - - - - - - - - -+ the main_window is just this, the main window of the widget. the view_window is used to clip the content of window, which contains the child widget, so you see only the right part. In the current implementation the embbeding (?) window of the child widget is the widget->window of the viewport widget. So if you want to subclass the viewport to extend its functionnalities, like adding a widget, the widget will be added in the child widget's "window" instead of the main_window. This behaviour is totally normal as the viewport is the only widget in which the widget->window is misplaced: The widget->window is always the main window (and in viewport, it's main_window). This patch corrects this. The main window is now widget->window, and the window embbeding the child widget is called bin_window (the child widget is called viewport->bin). I added the function gtk_viewport_reparent_bin_window() which tells a widget that its parent window isn't widget->parent->window but another one. This function is called when the realize() function is called and there is a child widget, or by the viewport_add() function when we assign a child widget to the viewport. This function is based on the reparent() code, so I don't think it will break to much things :). I also made a couple of cleanups. The patch is against 0.99.2 version. Patrice.