Re: [PATCH] example for gtk-demo demonstrating offscreen-rendered widgets with reflection-effect
- From: Mirco Müller <macslow bangang de>
- To: gtk-devel-list <gtk-devel-list gnome org>
- Subject: Re: [PATCH] example for gtk-demo demonstrating offscreen-rendered widgets with reflection-effect
- Date: Tue, 25 Dec 2007 16:31:24 +0100
Am Montag, den 24.12.2007, 22:08 -0500 schrieb Matthias Clasen:
> I have some pedantic comments on the patch, but more importantly, I'd like to
> have a better understanding of
>
> + /* if we don't do this, the reflection gets not updated at the right
> + * time */
> + gtk_widget_set_double_buffered (window, FALSE);
>
> If compositing and double-buffering don't work well together, we ought to have
> a good explanation of this in the docs...
What's causing the reflection not to be updated correctly, if double
buffering is enabled for the top-level window, is a mystery to me still.
I tried a lot of different things before the solution you see in the
patch was the one I settled for, because it was the only one I got
working.
For example having double buffering enabled and connecting
window_expose_event() to the expose-event of backbutton, entry and
applybutton like...
g_signal_connect_after (backbutton,
"expose-event",
G_CALLBACK (window_expose_event),
(gpointer) window);
g_signal_connect_after (entry,
"expose-event",
G_CALLBACK (window_expose_event),
(gpointer) window);
g_signal_connect_after (applybutton,
"expose-event",
G_CALLBACK (window_expose_event),
(gpointer) window);
... with a slightly changed window_expose_event() looking like...
static gboolean
window_expose_event (GtkWidget *widget,
GdkEventExpose *event
gpointer data)
{
GtkWidget *child;
GtkWidget *window = (GtkWidget*) data;
cairo_t *cr;
cairo_matrix_t matrix;
cairo_pattern_t *mask;
GtkStyle *style;
/* get our child... here the event-box */
child = gtk_bin_get_child (GTK_BIN (window));
/* create a cairo context to draw to the window */
cr = gdk_cairo_create (window->window);
/* redirect output for double-buffering */
cairo_push_group (cr);
/* write/paint over everything else */
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
/* set clip-region to windows dimensions */
cairo_rectangle (cr,
(gdouble) window->allocation.x,
(gdouble) window->allocation.y,
(gdouble) window->allocation.width,
(gdouble) window->allocation.height);
cairo_clip (cr);
/* get theme background-color and clear/paint the context with it */
style = gtk_widget_get_style (window);
gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
...
... does not work. Widgets just don't update as I would expect.
Best regards...
Mirco
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]