From db26b3afc1a5651b8a882128b141e2c4e4c42fa9 Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 13 May 2003 18:14:14 +0000 Subject: [PATCH] Debian bug #193013 points out that the (default-)one-pixel border is not redrawn when the window background colour is reconfigured mid- session. In addition, the Official Window Background is not reset, meaning that opaque resizes etc will flicker in the old background colour. This checkin should fix both. git-svn-id: svn://svn.tartarus.org/sgt/putty@3190 cda61777-01e9-0310-a592-d414129be87e --- unix/pterm.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/unix/pterm.c b/unix/pterm.c index 5649fe0a..8b6cd222 100644 --- a/unix/pterm.c +++ b/unix/pterm.c @@ -368,11 +368,20 @@ static void show_mouseptr(struct gui_data *inst, int show) inst->mouseptr_visible = show; } +void draw_backing_rect(struct gui_data *inst) +{ + GdkGC *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); +} + 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 @@ -397,12 +406,7 @@ gint configure_area(GtkWidget *widget, GdkEventConfigure *event, gpointer data) (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); + draw_backing_rect(inst); if (need_size && inst->term) { term_size(inst->term, h, w, inst->cfg.savelines); @@ -2634,10 +2638,21 @@ void change_settings_menuitem(GtkMenuItem *item, gpointer data) for (i = 0; i < NCOLOURS; i++) { if (oldcfg.colours[ww[i]][0] != cfg2.colours[ww[i]][0] || oldcfg.colours[ww[i]][1] != cfg2.colours[ww[i]][1] || - oldcfg.colours[ww[i]][2] != cfg2.colours[ww[i]][2]) + oldcfg.colours[ww[i]][2] != cfg2.colours[ww[i]][2]) { real_palette_set(inst, i, cfg2.colours[ww[i]][0], cfg2.colours[ww[i]][1], cfg2.colours[ww[i]][2]); + + /* + * If the default background has changed, we must + * repaint the space in between the window border + * and the text area. + */ + if (i == 18) { + set_window_background(inst); + draw_backing_rect(inst); + } + } } /* @@ -2698,6 +2713,12 @@ void change_settings_menuitem(GtkMenuItem *item, gpointer data) } term_invalidate(inst->term); + + /* + * We do an explicit full redraw here to ensure the window + * border has been redrawn as well as the text area. + */ + gtk_widget_queue_draw(inst->area); } sfree(title); } -- 2.11.0