mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-10 07:38:06 -05:00
Further fiddlings with the size reconfiguration stuff; now
everything seems to work right even when the only thing changed was the window border. [originally from svn r3109]
This commit is contained in:
parent
a9b6ceb700
commit
eaaef4573c
45
unix/pterm.c
45
unix/pterm.c
@ -364,40 +364,45 @@ gint configure_area(GtkWidget *widget, GdkEventConfigure *event, gpointer data)
|
||||
{
|
||||
struct gui_data *inst = (struct gui_data *)data;
|
||||
int w, h, need_size = 0;
|
||||
GdkGC *gc;
|
||||
|
||||
/*
|
||||
* See if the terminal size has changed, in which case we must
|
||||
* let the terminal know.
|
||||
*/
|
||||
w = (event->width - 2*inst->cfg.window_border) / inst->font_width;
|
||||
h = (event->height - 2*inst->cfg.window_border) / inst->font_height;
|
||||
|
||||
if (w != inst->width || h != inst->height) {
|
||||
if (inst->pixmap) {
|
||||
gdk_pixmap_unref(inst->pixmap);
|
||||
inst->pixmap = NULL;
|
||||
}
|
||||
inst->cfg.width = inst->width = w;
|
||||
inst->cfg.height = inst->height = h;
|
||||
need_size = 1;
|
||||
}
|
||||
if (!inst->pixmap) {
|
||||
GdkGC *gc;
|
||||
|
||||
inst->pixmap = gdk_pixmap_new(widget->window,
|
||||
(inst->cfg.width * inst->font_width +
|
||||
2*inst->cfg.window_border),
|
||||
(inst->cfg.height * inst->font_height +
|
||||
2*inst->cfg.window_border), -1);
|
||||
|
||||
gc = gdk_gc_new(inst->area->window);
|
||||
gdk_gc_set_foreground(gc, &inst->cols[18]); /* default background */
|
||||
gdk_draw_rectangle(inst->pixmap, gc, 1, 0, 0,
|
||||
inst->cfg.width * inst->font_width + 2*inst->cfg.window_border,
|
||||
inst->cfg.height * inst->font_height + 2*inst->cfg.window_border);
|
||||
gdk_gc_unref(gc);
|
||||
if (inst->pixmap) {
|
||||
gdk_pixmap_unref(inst->pixmap);
|
||||
inst->pixmap = NULL;
|
||||
}
|
||||
|
||||
if (need_size) {
|
||||
inst->pixmap = gdk_pixmap_new(widget->window,
|
||||
(inst->cfg.width * inst->font_width +
|
||||
2*inst->cfg.window_border),
|
||||
(inst->cfg.height * inst->font_height +
|
||||
2*inst->cfg.window_border), -1);
|
||||
|
||||
gc = gdk_gc_new(inst->area->window);
|
||||
gdk_gc_set_foreground(gc, &inst->cols[18]); /* default background */
|
||||
gdk_draw_rectangle(inst->pixmap, gc, 1, 0, 0,
|
||||
inst->cfg.width * inst->font_width + 2*inst->cfg.window_border,
|
||||
inst->cfg.height * inst->font_height + 2*inst->cfg.window_border);
|
||||
gdk_gc_unref(gc);
|
||||
|
||||
if (need_size && inst->term) {
|
||||
term_size(inst->term, h, w, inst->cfg.savelines);
|
||||
}
|
||||
|
||||
if (inst->term)
|
||||
term_invalidate(inst->term);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user