mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-15 10:08:06 -05:00
Make the current code compile again under GTK1.
Apparently I haven't tested this compile mode in a while: I had a couple of compile errors due to new code not properly #ifdeffed (the true-colour mode has to be effectively disabled in the palette-based GTK1 graphics model) and one for an unused static function (get_monitor_geometry is only used in GTK2 and above, and with -Werror that means I mustn't even _define_ it in GTK1). With these changes, I still didn't get a clean compile unless I also configured CFLAGS=-std=gnu89, due to the GTK1 headers having an outdated set of ifdefs to figure out the compiler's semantics of 'inline'. (They seem to expect old-style gcc, which inconveniently treats 'inline' and 'extern inline' more or less the opposite way round from the version standardised by C99.)
This commit is contained in:
parent
f1eeeff8cf
commit
9909077be1
@ -3039,11 +3039,16 @@ static void draw_set_colour(struct draw_ctx *dctx, int col, int dim)
|
|||||||
#ifdef DRAW_TEXT_GDK
|
#ifdef DRAW_TEXT_GDK
|
||||||
if (dctx->uctx.type == DRAWTYPE_GDK) {
|
if (dctx->uctx.type == DRAWTYPE_GDK) {
|
||||||
if (dim) {
|
if (dim) {
|
||||||
|
#if GTK_CHECK_VERSION(2,0,0)
|
||||||
GdkColor color;
|
GdkColor color;
|
||||||
color.red = dctx->inst->cols[col].red * 2 / 3;
|
color.red = dctx->inst->cols[col].red * 2 / 3;
|
||||||
color.green = dctx->inst->cols[col].green * 2 / 3;
|
color.green = dctx->inst->cols[col].green * 2 / 3;
|
||||||
color.blue = dctx->inst->cols[col].blue * 2 / 3;
|
color.blue = dctx->inst->cols[col].blue * 2 / 3;
|
||||||
gdk_gc_set_rgb_fg_color(dctx->uctx.u.gdk.gc, &color);
|
gdk_gc_set_rgb_fg_color(dctx->uctx.u.gdk.gc, &color);
|
||||||
|
#else
|
||||||
|
/* Poor GTK1 fallback */
|
||||||
|
gdk_gc_set_foreground(dctx->uctx.u.gdk.gc, &dctx->inst->cols[col]);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
gdk_gc_set_foreground(dctx->uctx.u.gdk.gc, &dctx->inst->cols[col]);
|
gdk_gc_set_foreground(dctx->uctx.u.gdk.gc, &dctx->inst->cols[col]);
|
||||||
}
|
}
|
||||||
@ -3064,6 +3069,7 @@ static void draw_set_colour_rgb(struct draw_ctx *dctx, optionalrgb orgb,
|
|||||||
{
|
{
|
||||||
#ifdef DRAW_TEXT_GDK
|
#ifdef DRAW_TEXT_GDK
|
||||||
if (dctx->uctx.type == DRAWTYPE_GDK) {
|
if (dctx->uctx.type == DRAWTYPE_GDK) {
|
||||||
|
#if GTK_CHECK_VERSION(2,0,0)
|
||||||
GdkColor color;
|
GdkColor color;
|
||||||
color.red = orgb.r * 256;
|
color.red = orgb.r * 256;
|
||||||
color.green = orgb.g * 256;
|
color.green = orgb.g * 256;
|
||||||
@ -3074,6 +3080,10 @@ static void draw_set_colour_rgb(struct draw_ctx *dctx, optionalrgb orgb,
|
|||||||
color.blue = color.blue * 2 / 3;
|
color.blue = color.blue * 2 / 3;
|
||||||
}
|
}
|
||||||
gdk_gc_set_rgb_fg_color(dctx->uctx.u.gdk.gc, &color);
|
gdk_gc_set_rgb_fg_color(dctx->uctx.u.gdk.gc, &color);
|
||||||
|
#else
|
||||||
|
/* Poor GTK1 fallback */
|
||||||
|
gdk_gc_set_foreground(dctx->uctx.u.gdk.gc, &dctx->inst->cols[256]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef DRAW_TEXT_CAIRO
|
#ifdef DRAW_TEXT_CAIRO
|
||||||
@ -4374,6 +4384,7 @@ static void start_backend(struct gui_data *inst)
|
|||||||
gtk_widget_set_sensitive(inst->restartitem, FALSE);
|
gtk_widget_set_sensitive(inst->restartitem, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if GTK_CHECK_VERSION(2,0,0)
|
||||||
static void get_monitor_geometry(GtkWidget *widget, GdkRectangle *geometry)
|
static void get_monitor_geometry(GtkWidget *widget, GdkRectangle *geometry)
|
||||||
{
|
{
|
||||||
#if GTK_CHECK_VERSION(3,4,0)
|
#if GTK_CHECK_VERSION(3,4,0)
|
||||||
@ -4397,6 +4408,7 @@ static void get_monitor_geometry(GtkWidget *widget, GdkRectangle *geometry)
|
|||||||
geometry->height = gdk_screen_height();
|
geometry->height = gdk_screen_height();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct gui_data *new_session_window(Conf *conf, const char *geometry_string)
|
struct gui_data *new_session_window(Conf *conf, const char *geometry_string)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user