1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Clean up a 'void *' in a unix.h typedef.

'struct draw_ctx' has a structure tag inside gtkwin.c, so as per this
week's standard practice, let's expose the tag elsewhere so that
pointers declared that way can't be confused with anything else.
This commit is contained in:
Simon Tatham 2018-09-14 08:30:09 +01:00
parent 9738e042f9
commit 7efa4a5305
3 changed files with 8 additions and 16 deletions

View File

@ -73,11 +73,7 @@ void set_sbar(Frontend *frontend, int a, int b, int c) { }
void ldisc_send(Ldisc *ldisc, const void *buf, int len, int interactive) {} void ldisc_send(Ldisc *ldisc, const void *buf, int len, int interactive) {}
void ldisc_echoedit_update(Ldisc *ldisc) {} void ldisc_echoedit_update(Ldisc *ldisc) {}
Context get_ctx(Frontend *frontend) { Context get_ctx(Frontend *frontend) { return NULL; }
static char x;
return &x;
}
void free_ctx(Context ctx) { } void free_ctx(Context ctx) { }
void palette_set(Frontend *frontend, int a, int b, int c, int d) { } void palette_set(Frontend *frontend, int a, int b, int c, int d) { }
void palette_reset(Frontend *frontend) { } void palette_reset(Frontend *frontend) { }

View File

@ -3481,9 +3481,8 @@ Context get_ctx(Frontend *inst)
return dctx; return dctx;
} }
void free_ctx(Context ctx) void free_ctx(Context dctx)
{ {
struct draw_ctx *dctx = (struct draw_ctx *)ctx;
/* Frontend *inst = dctx->inst; */ /* Frontend *inst = dctx->inst; */
#ifdef DRAW_TEXT_GDK #ifdef DRAW_TEXT_GDK
if (dctx->uctx.type == DRAWTYPE_GDK) { if (dctx->uctx.type == DRAWTYPE_GDK) {
@ -3796,10 +3795,9 @@ static void draw_backing_rect(Frontend *inst)
* *
* We are allowed to fiddle with the contents of `text'. * We are allowed to fiddle with the contents of `text'.
*/ */
void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len, void do_text_internal(Context dctx, int x, int y, wchar_t *text, int len,
unsigned long attr, int lattr, truecolour truecolour) unsigned long attr, int lattr, truecolour truecolour)
{ {
struct draw_ctx *dctx = (struct draw_ctx *)ctx;
Frontend *inst = dctx->inst; Frontend *inst = dctx->inst;
int ncombining; int ncombining;
int nfg, nbg, t, fontid, shadow, rlen, widefactor, bold; int nfg, nbg, t, fontid, shadow, rlen, widefactor, bold;
@ -3953,14 +3951,13 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len,
} }
} }
void do_text(Context ctx, int x, int y, wchar_t *text, int len, void do_text(Context dctx, int x, int y, wchar_t *text, int len,
unsigned long attr, int lattr, truecolour truecolour) unsigned long attr, int lattr, truecolour truecolour)
{ {
struct draw_ctx *dctx = (struct draw_ctx *)ctx;
Frontend *inst = dctx->inst; Frontend *inst = dctx->inst;
int widefactor; int widefactor;
do_text_internal(ctx, x, y, text, len, attr, lattr, truecolour); do_text_internal(dctx, x, y, text, len, attr, lattr, truecolour);
if (attr & ATTR_WIDE) { if (attr & ATTR_WIDE) {
widefactor = 2; widefactor = 2;
@ -3983,10 +3980,9 @@ void do_text(Context ctx, int x, int y, wchar_t *text, int len,
len*widefactor*inst->font_width, inst->font_height); len*widefactor*inst->font_width, inst->font_height);
} }
void do_cursor(Context ctx, int x, int y, wchar_t *text, int len, void do_cursor(Context dctx, int x, int y, wchar_t *text, int len,
unsigned long attr, int lattr, truecolour truecolour) unsigned long attr, int lattr, truecolour truecolour)
{ {
struct draw_ctx *dctx = (struct draw_ctx *)ctx;
Frontend *inst = dctx->inst; Frontend *inst = dctx->inst;
int active, passive, widefactor; int active, passive, widefactor;
@ -4001,7 +3997,7 @@ void do_cursor(Context ctx, int x, int y, wchar_t *text, int len,
active = 1; active = 1;
} else } else
active = 0; active = 0;
do_text_internal(ctx, x, y, text, len, attr, lattr, truecolour); do_text_internal(dctx, x, y, text, len, attr, lattr, truecolour);
if (attr & TATTR_COMBINING) if (attr & TATTR_COMBINING)
len = 1; len = 1;

View File

@ -65,7 +65,7 @@ struct FontSpec {
}; };
struct FontSpec *fontspec_new(const char *name); struct FontSpec *fontspec_new(const char *name);
typedef void *Context; /* FIXME: probably needs changing */ typedef struct draw_ctx *Context;
extern const struct Backend_vtable pty_backend; extern const struct Backend_vtable pty_backend;