shithub: puzzles

Download patch

ref: 88b38f51689fa363f665bd136242938d9107b484
parent: d6210656b8ee6e182a9f879a4089d7e6f3fdf570
author: Simon Tatham <anakin@pobox.com>
date: Sat Oct 3 08:28:17 EDT 2015

GTK 3 port: use GdkRGBA for the window background colour.

Suits our internal API better, anyway, with RGB components being
floats ranging from 0 to 1.

--- a/gtk.c
+++ b/gtk.c
@@ -268,6 +268,15 @@
 
 static void set_window_background(frontend *fe, int colour)
 {
+#if GTK_CHECK_VERSION(3,0,0)
+    GdkRGBA rgba;
+    rgba.red = fe->colours[3*colour + 0];
+    rgba.green = fe->colours[3*colour + 1];
+    rgba.blue = fe->colours[3*colour + 2];
+    rgba.alpha = 1.0;
+    gdk_window_set_background_rgba(gtk_widget_get_window(fe->area), &rgba);
+    gdk_window_set_background_rgba(gtk_widget_get_window(fe->window), &rgba);
+#else
     GdkColormap *colmap;
 
     colmap = gdk_colormap_get_system();
@@ -283,6 +292,7 @@
                               &fe->background);
     gdk_window_set_background(gtk_widget_get_window(fe->window),
                               &fe->background);
+#endif
 }
 
 static PangoLayout *make_pango_layout(frontend *fe)