Re: [gtk-list] [patch] gtkviewport design bug.
- From: Jay Painter <jpaint serv net>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] [patch] gtkviewport design bug.
- Date: Sat, 17 Jan 1998 09:29:52 -0800 (PST)
I wasn't able to find your patch, so I don't know exactly what it does,
but I came up with probably one of the shortest solutions to this problem,
and it seems to be pretty bullet-proof.
In the container_add function, do
gtk_signal_connect_after (GTK_OBJECT (clist->column[i].button),
"realize",
(GtkSignalFunc) button_realize,
(gpointer) clist);
Then the function is:
static void
gtk_clist_column_button_realize (GtkWidget * widget,
gpointer data)
{
GtkCList *clist;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_CLIST (data));
clist = GTK_CLIST (data);
if (widget->window && clist->title_window)
gdk_window_reparent (widget->window, clist->title_window,
widget->allocation.x, 0);
}
This is a good technique to keep in mind if you are composing a new widget
with multiple windows of it's own, and you want to put widgets into those
windows which are not widget->window.
-----------------------------------------------------------------------
Jay Painter -- jpaint@serv.net -- jpaint@gimp.org -- jpaint@real.com
http://www.serv.net/~jpaint
On Sat, 17 Jan 1998, Patrice Fortier wrote:
>
> Sorry Owen but I really wanted to get rid of this bug :).
>
> Extract form gtk-fortier-980117-0.patch.README:
>
> 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.
>
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]