]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
GTK3 port: condition out all uses of GdkColormap.
authorSimon Tatham <anakin@pobox.com>
Sun, 16 Aug 2015 13:22:14 +0000 (14:22 +0100)
committerSimon Tatham <anakin@pobox.com>
Sun, 16 Aug 2015 13:50:48 +0000 (14:50 +0100)
The entire concept has gone away in GTK3, which assumes that everyone
is now using modern true-colour video modes and so there's no longer
any reason you shouldn't just casually make up any RGB triple you like
without bothering to ask the display system's permission.

unix/gtkfont.c
unix/gtkwin.c

index b67dd8e3de63b8165fac2f9301ea385633ed7e66..bb6afc5fcd203c34ded1d6d79d6aafcea31038e4 100644 (file)
@@ -3110,10 +3110,12 @@ unifontsel *unifontsel_new(const char *wintitle)
     fs->preview_fg.pixel = fs->preview_bg.pixel = 0;
     fs->preview_fg.red = fs->preview_fg.green = fs->preview_fg.blue = 0x0000;
     fs->preview_bg.red = fs->preview_bg.green = fs->preview_bg.blue = 0xFFFF;
+#if !GTK_CHECK_VERSION(3,0,0)
     gdk_colormap_alloc_color(gdk_colormap_get_system(), &fs->preview_fg,
                             FALSE, FALSE);
     gdk_colormap_alloc_color(gdk_colormap_get_system(), &fs->preview_bg,
                             FALSE, FALSE);
+#endif
 #if GTK_CHECK_VERSION(3,0,0)
     g_signal_connect(G_OBJECT(fs->preview_area), "draw",
                      G_CALLBACK(unifontsel_draw_area), fs);
index f4fcd42b552933a837900adac8c320389bc301fc..5c45a0a735603700be7be64be28d147118d377fd 100644 (file)
@@ -93,7 +93,9 @@ struct gui_data {
 #endif
     GdkCursor *rawcursor, *textcursor, *blankcursor, *waitcursor, *currcursor;
     GdkColor cols[NALLCOLOURS];
+#if !GTK_CHECK_VERSION(3,0,0)
     GdkColormap *colmap;
+#endif
     wchar_t *pastein_data;
     int direct_to_font;
     int pastein_data_len;
@@ -1821,18 +1823,21 @@ void request_resize(void *frontend, int w, int h)
 
 static void real_palette_set(struct gui_data *inst, int n, int r, int g, int b)
 {
-    gboolean success[1];
-
     inst->cols[n].red = r * 0x0101;
     inst->cols[n].green = g * 0x0101;
     inst->cols[n].blue = b * 0x0101;
 
-    gdk_colormap_free_colors(inst->colmap, inst->cols + n, 1);
-    gdk_colormap_alloc_colors(inst->colmap, inst->cols + n, 1,
-                             FALSE, TRUE, success);
-    if (!success[0])
-       g_error("%s: couldn't allocate colour %d (#%02x%02x%02x)\n", appname,
-               n, r, g, b);
+#if !GTK_CHECK_VERSION(3,0,0)
+    {
+        gboolean success[1];
+        gdk_colormap_free_colors(inst->colmap, inst->cols + n, 1);
+        gdk_colormap_alloc_colors(inst->colmap, inst->cols + n, 1,
+                                  FALSE, TRUE, success);
+        if (!success[0])
+            g_error("%s: couldn't allocate colour %d (#%02x%02x%02x)\n",
+                    appname, n, r, g, b);
+    }
+#endif
 }
 
 void set_window_background(struct gui_data *inst)
@@ -1871,16 +1876,17 @@ void palette_reset(void *frontend)
        0, 8, 1, 9, 2, 10, 3, 11,
        4, 12, 5, 13, 6, 14, 7, 15
     };
-    gboolean success[NALLCOLOURS];
     int i;
 
     assert(lenof(ww) == NCFGCOLOURS);
 
+#if !GTK_CHECK_VERSION(3,0,0)
     if (!inst->colmap) {
        inst->colmap = gdk_colormap_get_system();
     } else {
        gdk_colormap_free_colors(inst->colmap, inst->cols, NALLCOLOURS);
     }
+#endif
 
     for (i = 0; i < NCFGCOLOURS; i++) {
        inst->cols[ww[i]].red =
@@ -1905,16 +1911,21 @@ void palette_reset(void *frontend)
        }
     }
 
-    gdk_colormap_alloc_colors(inst->colmap, inst->cols, NALLCOLOURS,
-                             FALSE, TRUE, success);
-    for (i = 0; i < NALLCOLOURS; i++) {
-       if (!success[i])
-           g_error("%s: couldn't allocate colour %d (#%02x%02x%02x)\n",
-                    appname, i,
-                   conf_get_int_int(inst->conf, CONF_colours, i*3+0),
-                   conf_get_int_int(inst->conf, CONF_colours, i*3+1),
-                   conf_get_int_int(inst->conf, CONF_colours, i*3+2));
+#if !GTK_CHECK_VERSION(3,0,0)
+    {
+        gboolean success[NALLCOLOURS];
+        gdk_colormap_alloc_colors(inst->colmap, inst->cols, NALLCOLOURS,
+                                  FALSE, TRUE, success);
+        for (i = 0; i < NALLCOLOURS; i++) {
+            if (!success[i])
+                g_error("%s: couldn't allocate colour %d (#%02x%02x%02x)\n",
+                        appname, i,
+                        conf_get_int_int(inst->conf, CONF_colours, i*3+0),
+                        conf_get_int_int(inst->conf, CONF_colours, i*3+1),
+                        conf_get_int_int(inst->conf, CONF_colours, i*3+2));
+        }
     }
+#endif
 
     /* Since Default Background may have changed, ensure that space
      * between text area and window border is refreshed. */