tests: Connect to draw signal in testoffscreenwindow
This commit is contained in:
parent
0ad2f57332
commit
f8b420783d
@ -1,23 +1,16 @@
|
|||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
da_expose (GtkWidget *widget,
|
da_draw (GtkWidget *widget,
|
||||||
GdkEventExpose *event,
|
cairo_t *cr,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkOffscreenWindow *offscreen = (GtkOffscreenWindow *)user_data;
|
GtkOffscreenWindow *offscreen = (GtkOffscreenWindow *)user_data;
|
||||||
cairo_surface_t *surface;
|
|
||||||
cairo_t *cr;
|
|
||||||
|
|
||||||
if (gtk_widget_is_drawable (widget))
|
cairo_set_source_surface (cr,
|
||||||
{
|
gtk_offscreen_window_get_surface (offscreen),
|
||||||
surface = gtk_offscreen_window_get_surface (offscreen);
|
50, 50);
|
||||||
|
|
||||||
cr = gdk_cairo_create (gtk_widget_get_window (widget));
|
|
||||||
cairo_set_source_surface (cr, surface, 50, 50);
|
|
||||||
cairo_paint (cr);
|
cairo_paint (cr);
|
||||||
cairo_destroy (cr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -73,8 +66,8 @@ main (int argc, char **argv)
|
|||||||
gtk_container_add (GTK_CONTAINER (window), da);
|
gtk_container_add (GTK_CONTAINER (window), da);
|
||||||
|
|
||||||
g_signal_connect (da,
|
g_signal_connect (da,
|
||||||
"expose-event",
|
"draw",
|
||||||
G_CALLBACK (da_expose),
|
G_CALLBACK (da_draw),
|
||||||
offscreen);
|
offscreen);
|
||||||
|
|
||||||
g_signal_connect (offscreen,
|
g_signal_connect (offscreen,
|
||||||
|
Loading…
Reference in New Issue
Block a user