tests: replace gdk_draw_drawable() with Cairo calls in testinput

This commit is contained in:
Benjamin Otte 2010-07-14 23:10:31 +02:00
parent 17bd528df5
commit a625e587a3

View File

@ -55,12 +55,13 @@ update_cursor (GtkWidget *widget, gdouble x, gdouble y)
if (cursor_present && (cursor_present != state || if (cursor_present && (cursor_present != state ||
x != cursor_x || y != cursor_y)) x != cursor_x || y != cursor_y))
{ {
gdk_draw_drawable (widget->window, cairo_t *cr = gdk_cairo_create (widget->window);
widget->style->fg_gc[gtk_widget_get_state (widget)],
pixmap, gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
cursor_x - 5, cursor_y - 5, cairo_rectangle (cr, cursor_x - 5, cursor_y - 5, 10, 10);
cursor_x - 5, cursor_y - 5, cairo_fill (cr);
10, 10);
cairo_destroy (cr);
} }
cursor_present = state; cursor_present = state;
@ -82,18 +83,20 @@ update_cursor (GtkWidget *widget, gdouble x, gdouble y)
static gint static gint
configure_event (GtkWidget *widget, GdkEventConfigure *event) configure_event (GtkWidget *widget, GdkEventConfigure *event)
{ {
cairo_t *cr;
if (pixmap) if (pixmap)
g_object_unref (pixmap); g_object_unref (pixmap);
pixmap = gdk_pixmap_new(widget->window, pixmap = gdk_pixmap_new(widget->window,
widget->allocation.width, widget->allocation.width,
widget->allocation.height, widget->allocation.height,
-1); -1);
gdk_draw_rectangle (pixmap, cr = gdk_cairo_create (pixmap);
widget->style->white_gc,
TRUE, cairo_set_source_rgb (cr, 1, 1, 1);
0, 0, cairo_paint (cr);
widget->allocation.width,
widget->allocation.height); cairo_destroy (cr);
return TRUE; return TRUE;
} }
@ -102,12 +105,13 @@ configure_event (GtkWidget *widget, GdkEventConfigure *event)
static gint static gint
expose_event (GtkWidget *widget, GdkEventExpose *event) expose_event (GtkWidget *widget, GdkEventExpose *event)
{ {
gdk_draw_drawable (widget->window, cairo_t *cr = gdk_cairo_create (widget->window);
widget->style->fg_gc[gtk_widget_get_state (widget)],
pixmap, gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
event->area.x, event->area.y, gdk_cairo_rectangle (cr, &event->area);
event->area.x, event->area.y, cairo_fill (cr);
event->area.width, event->area.height);
cairo_destroy (cr);
return FALSE; return FALSE;
} }