Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Stop hard-coding a nonstandard font. We now default to `fixed', and pick up the font's real width and height. This means I now _can't_ use my font of choice until I implement some command-line options; I wonder what feature will appear next :-) |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
3628bd7d8c721d3f9b730fc96d566872 |
| User & Date: | simon 2002-10-10 09:42:56.000 |
Context
|
2002-10-11
| ||
| 07:29 | Initialise some members of the Proxy_Socket structure that were left uninitialised. This problem only showed up with mingw builds of PuTTY (maybe MSVCRT is more forgiving with malloc initialisation than CRTDLL?). The 'error' field was causing me most trouble, and I think the other two were necessary too before things started working. Note however that I don't fully understand the code, and that there are more uninitialised fields in the structure. check-in: d8e30b5284 user: jacob tags: trunk | |
|
2002-10-10
| ||
| 09:42 | Stop hard-coding a nonstandard font. We now default to `fixed', and pick up the font's real width and height. This means I now _can't_ use my font of choice until I implement some command-line options; I wonder what feature will appear next :-) check-in: 3628bd7d8c user: simon tags: trunk | |
| 09:39 | Update to reflect 0.53 release. check-in: 79f1b92c1c user: jacob tags: trunk | |
Changes
Changes to settings.c.
| ︙ | ︙ | |||
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 |
gppi(sesskey, "DECOriginMode", 0, &cfg->dec_om);
gppi(sesskey, "AutoWrapMode", 1, &cfg->wrap_mode);
gppi(sesskey, "LFImpliesCR", 0, &cfg->lfhascr);
gppi(sesskey, "WinNameAlways", 0, &cfg->win_name_always);
gpps(sesskey, "WinTitle", "", cfg->wintitle, sizeof(cfg->wintitle));
gppi(sesskey, "TermWidth", 80, &cfg->width);
gppi(sesskey, "TermHeight", 24, &cfg->height);
gpps(sesskey, "Font", "Courier New", cfg->font, sizeof(cfg->font));
gppi(sesskey, "FontIsBold", 0, &cfg->fontisbold);
#ifdef _WINDOWS
gppi(sesskey, "FontCharSet", ANSI_CHARSET, &cfg->fontcharset);
#endif
gppi(sesskey, "FontHeight", 10, &cfg->fontheight);
#ifdef _WINDOWS
if (cfg->fontheight < 0) {
| > > > > | 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
gppi(sesskey, "DECOriginMode", 0, &cfg->dec_om);
gppi(sesskey, "AutoWrapMode", 1, &cfg->wrap_mode);
gppi(sesskey, "LFImpliesCR", 0, &cfg->lfhascr);
gppi(sesskey, "WinNameAlways", 0, &cfg->win_name_always);
gpps(sesskey, "WinTitle", "", cfg->wintitle, sizeof(cfg->wintitle));
gppi(sesskey, "TermWidth", 80, &cfg->width);
gppi(sesskey, "TermHeight", 24, &cfg->height);
#ifdef _WINDOWS
gpps(sesskey, "Font", "Courier New", cfg->font, sizeof(cfg->font));
#else
gpps(sesskey, "Font", "fixed", cfg->font, sizeof(cfg->font));
#endif
gppi(sesskey, "FontIsBold", 0, &cfg->fontisbold);
#ifdef _WINDOWS
gppi(sesskey, "FontCharSet", ANSI_CHARSET, &cfg->fontcharset);
#endif
gppi(sesskey, "FontHeight", 10, &cfg->fontheight);
#ifdef _WINDOWS
if (cfg->fontheight < 0) {
|
| ︙ | ︙ |
Changes to unix/pterm.c.
| ︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
GtkWidget *area;
GdkPixmap *pixmap;
GdkFont *fonts[2]; /* normal and bold (for now!) */
GdkCursor *rawcursor, *textcursor;
GdkColor cols[NCOLOURS];
GdkColormap *colmap;
GdkGC *black_gc, *white_gc;
};
static struct gui_data the_inst;
static struct gui_data *inst = &the_inst; /* so we always write `inst->' */
static int send_raw_mouse;
void ldisc_update(int echo, int edit)
| > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
GtkWidget *area;
GdkPixmap *pixmap;
GdkFont *fonts[2]; /* normal and bold (for now!) */
GdkCursor *rawcursor, *textcursor;
GdkColor cols[NCOLOURS];
GdkColormap *colmap;
GdkGC *black_gc, *white_gc;
int font_width, font_height;
};
static struct gui_data the_inst;
static struct gui_data *inst = &the_inst; /* so we always write `inst->' */
static int send_raw_mouse;
void ldisc_update(int echo, int edit)
|
| ︙ | ︙ | |||
169 170 171 172 173 174 175 |
gint configure_area(GtkWidget *widget, GdkEventConfigure *event, gpointer data)
{
struct gui_data *inst = (struct gui_data *)data;
if (inst->pixmap)
gdk_pixmap_unref(inst->pixmap);
| | > > < < | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
gint configure_area(GtkWidget *widget, GdkEventConfigure *event, gpointer data)
{
struct gui_data *inst = (struct gui_data *)data;
if (inst->pixmap)
gdk_pixmap_unref(inst->pixmap);
inst->pixmap = gdk_pixmap_new(widget->window,
cfg.width * inst->font_width,
cfg.height * inst->font_height, -1);
inst->black_gc = widget->style->black_gc;
inst->white_gc = widget->style->white_gc;
/*
* Set up the colour map.
*/
inst->colmap = gdk_colormap_get_system();
|
| ︙ | ︙ | |||
218 219 220 221 222 223 224 |
/* struct gui_data *inst = (struct gui_data *)data; */
/*
* Pass the exposed rectangle to terminal.c, which will call us
* back to do the actual painting.
*/
term_paint(NULL,
| | > | | | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
/* struct gui_data *inst = (struct gui_data *)data; */
/*
* Pass the exposed rectangle to terminal.c, which will call us
* back to do the actual painting.
*/
term_paint(NULL,
event->area.x / inst->font_width,
event->area.y / inst->font_height,
(event->area.x + event->area.width - 1) / inst->font_width,
(event->area.y + event->area.height - 1) / inst->font_height);
return TRUE;
}
#define KEY_PRESSED(k) \
(inst->keystate[(k) / 32] & (1 << ((k) % 32)))
gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
| ︙ | ︙ | |||
763 764 765 766 767 768 769 |
nbg++;
if (attr & TATTR_ACTCURS) {
nfg = NCOLOURS-2;
nbg = NCOLOURS-1;
}
gdk_gc_set_foreground(gc, &inst->cols[nbg]);
| | > > | | | | | | > | > > | > > | > > | 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 |
nbg++;
if (attr & TATTR_ACTCURS) {
nfg = NCOLOURS-2;
nbg = NCOLOURS-1;
}
gdk_gc_set_foreground(gc, &inst->cols[nbg]);
gdk_draw_rectangle(inst->pixmap, gc, 1,
x*inst->font_width, y*inst->font_height,
len*inst->font_width, inst->font_height);
gdk_gc_set_foreground(gc, &inst->cols[nfg]);
gdk_draw_text(inst->pixmap, inst->fonts[0], gc, x*inst->font_width,
y*inst->font_height + inst->fonts[0]->ascent, text, len);
if (attr & ATTR_UNDER) {
int uheight = inst->fonts[0]->ascent + 1;
if (uheight >= inst->font_height)
uheight = inst->font_height - 1;
gdk_draw_line(inst->pixmap, gc, x*inst->font_width,
y*inst->font_height + uheight,
(x+len)*inst->font_width-1, y*inst->font_height+uheight);
}
gdk_draw_pixmap(inst->area->window, gc, inst->pixmap,
x*inst->font_width, y*inst->font_height,
x*inst->font_width, y*inst->font_height,
len*inst->font_width, inst->font_height);
}
void do_cursor(Context ctx, int x, int y, char *text, int len,
unsigned long attr, int lattr)
{
int passive;
GdkGC *gc = (GdkGC *)ctx;
/*
* NYI: cursor shapes other than block
*/
if (attr & TATTR_PASCURS) {
attr &= ~TATTR_PASCURS;
passive = 1;
} else
passive = 0;
do_text(ctx, x, y, text, len, attr, lattr);
if (passive) {
gdk_gc_set_foreground(gc, &inst->cols[NCOLOURS-1]);
gdk_draw_rectangle(inst->pixmap, gc, 0,
x*inst->font_width, y*inst->font_height,
len*inst->font_width-1, inst->font_height-1);
gdk_draw_pixmap(inst->area->window, gc, inst->pixmap,
x*inst->font_width, y*inst->font_height,
x*inst->font_width, y*inst->font_height,
len*inst->font_width, inst->font_height);
}
}
void modalfatalbox(char *p, ...)
{
va_list ap;
fprintf(stderr, "FATAL ERROR: ");
|
| ︙ | ︙ | |||
824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 |
GtkWidget *window;
extern int pty_master_fd; /* declared in pty.c */
gtk_init(&argc, &argv);
do_defaults(NULL, &cfg);
init_ucs();
back = &pty_backend;
back->init(NULL, 0, NULL, 0);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
inst->area = gtk_drawing_area_new();
gtk_drawing_area_size(GTK_DRAWING_AREA(inst->area),
| > > > > > | > | 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 |
GtkWidget *window;
extern int pty_master_fd; /* declared in pty.c */
gtk_init(&argc, &argv);
do_defaults(NULL, &cfg);
inst->fonts[0] = gdk_font_load(cfg.font);
inst->fonts[1] = NULL; /* FIXME: what about bold font? */
inst->font_width = gdk_char_width(inst->fonts[0], ' ');
inst->font_height = inst->fonts[0]->ascent + inst->fonts[0]->descent;
init_ucs();
back = &pty_backend;
back->init(NULL, 0, NULL, 0);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
inst->area = gtk_drawing_area_new();
gtk_drawing_area_size(GTK_DRAWING_AREA(inst->area),
inst->font_width * cfg.width,
inst->font_height * cfg.height);
gtk_container_add(GTK_CONTAINER(window), inst->area);
gtk_signal_connect(GTK_OBJECT(window), "destroy",
GTK_SIGNAL_FUNC(destroy), inst);
gtk_signal_connect(GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC(delete_window), inst);
|
| ︙ | ︙ |