mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-09 23:28:06 -05:00
GTK3 port: condition out all uses of GdkColormap.
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.
This commit is contained in:
parent
0ffc564351
commit
ccd7097330
@ -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);
|
||||
|
@ -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. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user