Fix warnings on GTK+ display driver with GTK+ 3.

This commit is contained in:
Brandon Wright 2017-12-07 11:36:24 -06:00
parent 886ea13daf
commit ec2b9a5165
1 changed files with 27 additions and 0 deletions

View File

@ -108,7 +108,15 @@ S9xGTKDisplayDriver::output (void *src,
height,
24);
#ifndef USE_GTK3
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (drawing_area));
#else
cairo_rectangle_int_t rect = { x, y, dst_width, dst_height };
cairo_region_t *region = cairo_region_create_rectangle (&rect);
GdkDrawingContext *context = gdk_window_begin_draw_frame (gtk_widget_get_window (drawing_area),
region);
cairo_t *cr = gdk_drawing_context_get_cairo_context (context);
#endif
gdk_cairo_set_source_pixbuf (cr, pixbuf, x, y);
@ -132,7 +140,12 @@ S9xGTKDisplayDriver::output (void *src,
cairo_rectangle (cr, x, y, dst_width, dst_height);
cairo_fill (cr);
#ifndef USE_GTK3
cairo_destroy (cr);
#else
gdk_window_end_draw_frame (gtk_widget_get_window (drawing_area), context);
cairo_region_destroy (region);
#endif
window->set_mouseable_area (x, y, width, height);
@ -206,7 +219,15 @@ S9xGTKDisplayDriver::clear (void)
width = allocation.width;
height = allocation.height;
#ifndef USE_GTK3
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (drawing_area));
#else
cairo_rectangle_int_t rect = { 0, 0, width, height };
cairo_region_t *region = cairo_region_create_rectangle (&rect);
GdkDrawingContext *context = gdk_window_begin_draw_frame (gtk_widget_get_window (drawing_area),
region);
cairo_t *cr = gdk_drawing_context_get_cairo_context (context);
#endif
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
@ -243,7 +264,13 @@ S9xGTKDisplayDriver::clear (void)
}
cairo_fill (cr);
#ifndef USE_GTK3
cairo_destroy (cr);
#else
gdk_window_end_draw_frame (gtk_widget_get_window (drawing_area), context);
cairo_region_destroy (region);
#endif
return;
}