From af082c9a22398e18bc759c47bdf18f7e7dfaee38 Mon Sep 17 00:00:00 2001 From: Michael Jennings Date: Wed, 16 Feb 2000 03:37:34 +0000 Subject: [PATCH] Tue Feb 15 19:31:04 PST 2000 Michael Jennings The buttonbar can now be toggled on and off both in the config file and via an escape sequence. The themes in CVS use Ctrl-Shift-Button3. You can also specify in the config file whether to dock the buttonbar at the top or the bottom of the Eterm window. You can't move it on the fly yet, but that will come. I also fixed resizing so that the term window didn't redraw itself unnecessarily. Hopefully I didn't break anything in the process. :-) Plus, I fixed poor handling of X-generated ConfigureNotify events, and the terminfo stuff is now done at install time instead of build time. SVN revision: 2077 --- ChangeLog | 15 ++++++++ doc/Makefile.am | 6 ++-- src/buttons.c | 71 +++++++++++++++++++++++++++++++------ src/buttons.h | 6 ++++ src/events.c | 10 +++--- src/options.c | 26 ++++++++++++++ src/screen.c | 9 ++++- src/scrollbar.c | 12 ++++--- src/scrollbar.h | 6 +++- src/startup.c | 4 +-- src/system.c | 5 ++- src/term.c | 19 ++++++++-- src/windows.c | 61 ++++++++++++++----------------- themes/Eterm/theme.cfg.in | 1 + themes/auto/theme.cfg.in | 1 + themes/cEterm/theme.cfg.in | 1 + themes/chooser/theme.cfg.in | 1 + themes/emacs/theme.cfg.in | 1 + themes/irc/theme.cfg.in | 1 + themes/mutt/theme.cfg.in | 1 + themes/trans/theme.cfg.in | 1 + 21 files changed, 192 insertions(+), 66 deletions(-) diff --git a/ChangeLog b/ChangeLog index a28bc58..2f0bdfd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3168,3 +3168,18 @@ Mon Feb 14 16:35:01 PST 2000 Michael Jennings :-) ------------------------------------------------------------------------------- +Tue Feb 15 19:31:04 PST 2000 Michael Jennings + + The buttonbar can now be toggled on and off both in the config file + and via an escape sequence. The themes in CVS use Ctrl-Shift-Button3. + You can also specify in the config file whether to dock the buttonbar + at the top or the bottom of the Eterm window. You can't move it on + the fly yet, but that will come. + + I also fixed resizing so that the term window didn't redraw itself + unnecessarily. Hopefully I didn't break anything in the process. :-) + + Plus, I fixed poor handling of X-generated ConfigureNotify events, and + the terminfo stuff is now done at install time instead of build time. + +------------------------------------------------------------------------------- diff --git a/doc/Makefile.am b/doc/Makefile.am index 02a5c0c..1612f96 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -2,7 +2,7 @@ man_MANS = Eterm.1 -all: Makefile Eterm.1.html terminfo +all: Makefile Eterm.1.html Eterm.1: $(top_srcdir)/doc/Eterm.1.in $(SED) -e 's%@''VERSION''@%$(VERSION)%g' -e 's%@''DATE''@%$(DATE)%g' -e 's%@THEMEDIR@%$(pkgdatadir)/themes%g' $(top_srcdir)/doc/$@.in > $@ @@ -10,8 +10,8 @@ Eterm.1: $(top_srcdir)/doc/Eterm.1.in Eterm.1.html: Eterm.1 -nroff -man $< | man2html -title Eterm > $@ -terminfo: Eterm.ti - -$(TIC) Eterm.ti +install-data-hook: + -$(TIC) Eterm.ti || (mkinstalldirs $(HOME)/.terminfo && $(TIC) -o$(HOME)/.terminfo Eterm.ti) EXTRA_DIST = Eterm.1.in Eterm_reference.html Eterm.tcap Eterm.ti Makefile.am Makefile.in diff --git a/src/buttons.c b/src/buttons.c index b8b8830..2f99922 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -104,6 +104,7 @@ bbar_create(void) bbar->gc = XCreateGC(Xdisplay, bbar->win, GCForeground | GCFont, &gcvalue); bbar_set_docked(bbar, BBAR_DOCKED_TOP); + bbar_set_visible(bbar, 1); return bbar; } @@ -113,9 +114,13 @@ bbar_init(buttonbar_t *bbar, int width) { event_register_dispatcher(bbar_dispatch_event, bbar_event_init_dispatcher); XSetForeground(Xdisplay, bbar->gc, images[image_bbar].norm->fg); - bbar_resize(bbar, width); + bbar_dock(bbar, bbar_is_docked(bbar)); + if (bbar_is_visible(bbar)) { + bbar_set_visible(bbar, 0); + bbar_show(bbar, 1); + } + bbar_resize(bbar, -width); bbar_reset_total_height(); - bbar_calc_total_height(); } void @@ -263,7 +268,6 @@ bbar_add(buttonbar_t *bbar) } bbar->next = NULL; bbar_reset_total_height(); - bbar_calc_total_height(); } unsigned short @@ -651,27 +655,44 @@ bbar_show(buttonbar_t *bbar, unsigned char visible) D_BBAR(("bbar_show(%8p, %d) called.\n", bbar, visible)); if (visible && !bbar_is_visible(bbar)) { D_BBAR((" -> Making bbar visible.\n")); - XMapWindow(Xdisplay, bbar->win); bbar_set_visible(bbar, 1); + XMapWindow(Xdisplay, bbar->win); + bbar_draw(bbar, IMAGE_STATE_CURRENT, MODE_MASK); changed = 1; } else if (!visible && bbar_is_visible(bbar)) { D_BBAR((" -> Making bbar invisible.\n")); - XUnmapWindow(Xdisplay, bbar->win); bbar_set_visible(bbar, 0); + XUnmapWindow(Xdisplay, bbar->win); changed = 1; } return changed; } +void +bbar_show_all(char visible) +{ + buttonbar_t *bbar; + + for (bbar = buttonbar; bbar; bbar = bbar->next) { + bbar_show(bbar, ((visible == -1) ? (!bbar_is_visible(bbar)) : visible)); + } +} + void bbar_resize(buttonbar_t *bbar, int w) { D_BBAR(("bbar_resize(%8p, %d) called.\n", bbar, w)); - if (w == -1) { + if ((w >= 0) && !bbar_is_visible(bbar)) { + return; + } + bbar_redock(bbar); + if (w < 0) { bbar_calc_sizes(bbar); bbar_calc_height(bbar); bbar_reset_total_height(); - } else if (bbar->w != w) { + w = -w; + } + if (bbar->w != w) { bbar->w = w; bbar_calc_positions(bbar); D_BBAR(("Resizing window 0x%08x to %dx%d\n", bbar->win, bbar->w, bbar->h)); @@ -688,7 +709,6 @@ bbar_resize_all(int width) for (bbar = buttonbar; bbar; bbar = bbar->next) { bbar_resize(bbar, width); } - bbar_calc_total_height(); } void @@ -716,6 +736,8 @@ bbar_draw(buttonbar_t *bbar, unsigned char image_state, unsigned char force_mode } if (image_mode_is(image_bbar, MODE_MASK) && !((images[image_bbar].mode & MODE_MASK) & (force_modes))) { return; + } else if (!bbar_is_visible(bbar)) { + return; } else { render_simage(images[image_bbar].current, bbar->win, bbar->w, bbar->h, image_bbar, RENDER_FORCE_PIXMAP); bbar->bg = images[image_bbar].current->pmap->pixmap; @@ -756,26 +778,53 @@ void bbar_dock(buttonbar_t *bbar, unsigned char dock) { D_BBAR(("bbar_dock(%8p, %d) called.\n", bbar, dock)); - bbar_set_docked(bbar, dock); if (dock == BBAR_DOCKED_TOP) { + bbar_set_docked(bbar, BBAR_DOCKED_TOP); bbar->x = 0; bbar->y = 0; XReparentWindow(Xdisplay, bbar->win, TermWin.parent, bbar->x, bbar->y); XMoveResizeWindow(Xdisplay, bbar->win, bbar->x, bbar->y, bbar->w, bbar->h); + } else if (dock == BBAR_DOCKED_BOTTOM) { + bbar_set_docked(bbar, BBAR_DOCKED_BOTTOM); + bbar->x = 0; + bbar->y = szHint.height - bbar->h + 1; + XReparentWindow(Xdisplay, bbar->win, TermWin.parent, bbar->x, bbar->y); + XMoveResizeWindow(Xdisplay, bbar->win, bbar->x, bbar->y, bbar->w, bbar->h); + } else { + bbar_set_docked(bbar, 0); + bbar->x = 0; + bbar->y = 0; + XReparentWindow(Xdisplay, bbar->win, Xroot, bbar->x, bbar->y); + XMoveResizeWindow(Xdisplay, bbar->win, bbar->x, bbar->y, bbar->w, bbar->h); } } unsigned long bbar_calc_total_height(void) { - buttonbar_t *bbar; + register buttonbar_t *bbar; bbar_total_h = 0; for (bbar = buttonbar; bbar; bbar = bbar->next) { - if (bbar_is_docked(bbar)) { + if (bbar_is_visible(bbar)) { bbar_total_h += bbar->h; } } D_BBAR(("Returning %d\n", bbar_total_h)); return bbar_total_h; } + +unsigned long +bbar_calc_docked_height(register unsigned char dock_flag) +{ + register buttonbar_t *bbar; + register unsigned long h = 0; + + for (bbar = buttonbar; bbar; bbar = bbar->next) { + if ((bbar->state & dock_flag) && bbar_is_visible(bbar)) { + h += bbar->h; + } + } + D_BBAR(("Returning %d\n", h)); + return h; +} diff --git a/src/buttons.h b/src/buttons.h index 868ead6..97dfd52 100644 --- a/src/buttons.h +++ b/src/buttons.h @@ -33,10 +33,14 @@ #define BBAR_DOCKED_TOP (1 << 0) #define BBAR_DOCKED_BOTTOM (1 << 1) #define BBAR_DOCKED (BBAR_DOCKED_TOP | BBAR_DOCKED_BOTTOM) +#define BBAR_UNDOCKED (~BBAR_DOCKED) #define BBAR_VISIBLE (1 << 2) #define bbar_is_docked(bbar) (bbar->state & BBAR_DOCKED) +#define bbar_is_top_docked(bbar) (bbar->state & BBAR_DOCKED_TOP) +#define bbar_is_bottom_docked(bbar) (bbar->state & BBAR_DOCKED_BOTTOM) #define bbar_set_docked(bbar, d) do {bbar->state &= ~BBAR_DOCKED; bbar->state |= (d);} while (0) +#define bbar_redock(bbar) bbar_dock(bbar, bbar_is_docked(bbar)); #define bbar_is_visible(bbar) (bbar->state & BBAR_VISIBLE) #define bbar_set_visible(bbar, v) ((v) ? (bbar->state |= BBAR_VISIBLE) : (bbar->state &= ~BBAR_VISIBLE)) #define bbar_get_width(bbar) (bbar->w) @@ -117,12 +121,14 @@ extern void bbar_deselect_button(buttonbar_t *bbar, button_t *button); extern void bbar_click_button(buttonbar_t *bbar, button_t *button); extern void button_check_action(buttonbar_t *bbar, button_t *button, unsigned char press, Time t); extern unsigned char bbar_show(buttonbar_t *bbar, unsigned char visible); +extern void bbar_show_all(char visible); extern void bbar_resize(buttonbar_t *bbar, int w); extern void bbar_resize_all(int width); extern void bbar_dock(buttonbar_t *bbar, unsigned char dock); extern void bbar_draw(buttonbar_t *bbar, unsigned char image_state, unsigned char force_modes); extern void bbar_draw_all(unsigned char image_state, unsigned char force_modes); extern unsigned long bbar_calc_total_height(void); +extern unsigned long bbar_calc_docked_height(unsigned char); _XFUNCPROTOEND diff --git a/src/events.c b/src/events.c index 6cc6620..194a7a8 100644 --- a/src/events.c +++ b/src/events.c @@ -489,8 +489,8 @@ handle_configure_notify(event_t * ev) int x = ev->xconfigurerequest.x, y = ev->xconfigurerequest.y; unsigned int width = ev->xconfigurerequest.width, height = ev->xconfigurerequest.height; - D_EVENTS((" -> TermWin.parent is %ldx%ld at (%d, %d). Internal cache data shows %dx%d at (%hd, %hd)\n", - width, height, x, y, szHint.width, szHint.height, TermWin.x, TermWin.y)); + D_EVENTS((" -> TermWin.parent is %ldx%ld at (%d, %d). Internal cache data shows %dx%d at (%hd, %hd). send_event is %d\n", + width, height, x, y, szHint.width, szHint.height, TermWin.x, TermWin.y, ev->xconfigure.send_event)); /* If the font change count is non-zero, this event is telling us we resized ourselves. */ if (font_chg > 0) { font_chg--; @@ -503,8 +503,10 @@ handle_configure_notify(event_t * ev) xim_set_status_position(); #endif /* A resize requires the additional handling of a move */ - handle_move(x, y); - } else if ((x != TermWin.x) || (y != TermWin.y)) { + if (ev->xconfigure.send_event) { + handle_move(x, y); + } + } else if (((x != TermWin.x) || (y != TermWin.y)) && (ev->xconfigure.send_event)) { /* There was an external move, but no resize. Handle the move. */ D_EVENTS((" -> External move detected.\n")); handle_move(x, y); diff --git a/src/options.c b/src/options.c index db1be08..00c7344 100644 --- a/src/options.c +++ b/src/options.c @@ -2892,6 +2892,32 @@ parse_bbar(char *buff, void *state) bbar_set_font(bbar, font); FREE(font); + } else if (!BEG_STRCASECMP(buff, "dock ")) { + char *where = PWord(2, buff); + + if (!where) { + print_error("Parse error in file %s, line %lu: Attribute dock requires a parameter", file_peek_path(), file_peek_line()); + } else if (!BEG_STRCASECMP(where, "top")) { + bbar_set_docked(bbar, BBAR_DOCKED_TOP); + } else if (!BEG_STRCASECMP(where, "bot")) { /* "bot" or "bottom" */ + bbar_set_docked(bbar, BBAR_DOCKED_BOTTOM); + } else if (!BEG_STRCASECMP(where, "no")) { /* "no" or "none" */ + bbar_set_docked(bbar, BBAR_UNDOCKED); + } else { + print_error("Parse error in file %s, line %lu: Invalid parameter \"%s\" to attribute dock", file_peek_path(), file_peek_line(), where); + } + + } else if (!BEG_STRCASECMP(buff, "visible ")) { + char *tmp = PWord(2, buff); + + if (BOOL_OPT_ISTRUE(tmp)) { + bbar_set_visible(bbar, 1); + } else if (BOOL_OPT_ISFALSE(tmp)) { + bbar_set_visible(bbar, 0); + } else { + print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" in context button_bar", file_peek_path(), file_peek_line(), tmp); + } + } else if (!BEG_STRCASECMP(buff, "button ") || !BEG_STRCASECMP(buff, "rbutton ")) { char *text = PWord(2, buff); char *icon = StrCaseStr(buff, "icon "); diff --git a/src/screen.c b/src/screen.c index 8284ff0..568beee 100644 --- a/src/screen.c +++ b/src/screen.c @@ -149,7 +149,7 @@ void scr_reset(void) { /* int i, j, k, total_rows, prev_total_rows; */ - int total_rows, prev_total_rows; + int total_rows, prev_total_rows, chscr = 0; register int i, j, k; text_t tc; @@ -161,6 +161,9 @@ scr_reset(void) if (TermWin.ncol == prev_ncol && TermWin.nrow == prev_nrow) return; + if (current_screen != PRIMARY) { + chscr = scr_change_screen(PRIMARY); + } if (TermWin.ncol <= 0) TermWin.ncol = 80; if (TermWin.nrow <= 0) @@ -316,6 +319,10 @@ scr_reset(void) prev_ncol = TermWin.ncol; tt_resize(); + + if (chscr) { + scr_change_screen(chscr); + } } /* ------------------------------------------------------------------------- */ diff --git a/src/scrollbar.c b/src/scrollbar.c index 4370deb..b19d241 100644 --- a/src/scrollbar.c +++ b/src/scrollbar.c @@ -667,8 +667,9 @@ scrollbar_init(int width, int height) scrollbar.anchor_bottom = scrollbar.scrollarea_end; /* Create the scrollbar trough window. It will be the parent to the other windows. */ - scrollbar.win = XCreateWindow(Xdisplay, TermWin.parent, ((Options & Opt_scrollbar_right) ? (width - scrollbar_trough_width()) : (0)), bbar_total_height(), scrollbar_trough_width(), height, - 0, Xdepth, InputOutput, CopyFromParent, CWOverrideRedirect | CWBackingStore | CWBackPixel | CWBorderPixel | CWColormap, &Attributes); + scrollbar.win = XCreateWindow(Xdisplay, TermWin.parent, ((Options & Opt_scrollbar_right) ? (width - scrollbar_trough_width()) : (0)), bbar_calc_docked_height(BBAR_DOCKED_TOP), + scrollbar_trough_width(), height, 0, Xdepth, InputOutput, CopyFromParent, + CWOverrideRedirect | CWBackingStore | CWBackPixel | CWBorderPixel | CWColormap, &Attributes); XDefineCursor(Xdisplay, scrollbar.win, cursor); XSelectInput(Xdisplay, scrollbar.win, mask); D_SCROLLBAR(("Created scrollbar window 0x%08x\n", scrollbar.win)); @@ -775,9 +776,10 @@ scrollbar_resize(int width, int height) D_SCROLLBAR(("scrollbar_resize(%d, %d)\n", width, height)); scrollbar_calc_size(width, height); - D_SCROLLBAR((" -> XMoveResizeWindow(Xdisplay, 0x%08x, %d, %d, %d, %d)\n", scrollbar.win, ((Options & Opt_scrollbar_right) ? (width - scrollbar_trough_width()) : (0)), - bbar_total_height(), scrollbar_trough_width(), height)); - XMoveResizeWindow(Xdisplay, scrollbar.win, ((Options & Opt_scrollbar_right) ? (width - scrollbar_trough_width()) : (0)), bbar_total_height(), scrollbar_trough_width(), height); + D_SCROLLBAR((" -> XMoveResizeWindow(Xdisplay, 0x%08x, %d, y, %d, %d)\n", scrollbar.win, ((Options & Opt_scrollbar_right) ? (width - scrollbar_trough_width()) : (0)), + scrollbar_trough_width(), scrollbar.win_height)); + XMoveResizeWindow(Xdisplay, scrollbar.win, ((Options & Opt_scrollbar_right) ? (width - scrollbar_trough_width()) : (0)), bbar_calc_docked_height(BBAR_DOCKED_TOP), + scrollbar_trough_width(), scrollbar.win_height); scrollbar_draw_trough(IMAGE_STATE_CURRENT, MODE_MASK); scrollbar_reposition_and_draw(MODE_MASK); scrollbar.init = 0; diff --git a/src/scrollbar.h b/src/scrollbar.h index 272957f..cc5b708 100644 --- a/src/scrollbar.h +++ b/src/scrollbar.h @@ -83,7 +83,11 @@ #define scrollbar_dn_loc() (scrollbar.down_arrow_loc) /* Scrollbar operations */ -#define map_scrollbar(show) do {PrivMode(show, PrivMode_scrollbar); if (scrollbar_mapping(show)) {scr_touch(); parent_resize();} } while (0) +#if 0 +#define map_scrollbar(show) do {PrivMode(show, PrivMode_scrollbar); if (scrollbar_mapping(show)) {scr_touch(); parent_resize();}} while (0) +#else +#define map_scrollbar(show) do {PrivMode(show, PrivMode_scrollbar); if (scrollbar_mapping(show)) {parent_resize();}} while (0) +#endif #define scrollbar_map_arrows() do {XMapWindow(Xdisplay, scrollbar.up_win); XMapWindow(Xdisplay, scrollbar.dn_win);} while (0) #define scrollbar_unmap_arrows() do {XUnmapWindow(Xdisplay, scrollbar.up_win); XUnmapWindow(Xdisplay, scrollbar.dn_win);} while (0) #define scrollbar_get_shadow() ((scrollbar.type == SCROLLBAR_XTERM) ? (0) : (scrollbar.shadow)) diff --git a/src/startup.c b/src/startup.c index ce38d82..3a9dcb4 100644 --- a/src/startup.c +++ b/src/startup.c @@ -230,7 +230,7 @@ eterm_bootstrap(int argc, char *argv[]) scr_reset(); /* initialize screen */ /* Initialize the scrollbar */ - scrollbar_init(szHint.width, szHint.height - bbar_total_height()); + scrollbar_init(szHint.width, szHint.height - bbar_calc_docked_height(BBAR_DOCKED)); scrollbar_mapping(Options & Opt_scrollbar); /* Initialize the menu subsystem. */ @@ -238,8 +238,6 @@ eterm_bootstrap(int argc, char *argv[]) if (buttonbar) { bbar_init(buttonbar, szHint.width); - bbar_dock(buttonbar, BBAR_DOCKED_TOP); - bbar_show(buttonbar, 1); } #if DEBUG >= DEBUG_X diff --git a/src/system.c b/src/system.c index 68316ea..d0b2978 100644 --- a/src/system.c +++ b/src/system.c @@ -45,7 +45,6 @@ static const char cvs_ident[] = "$Id$"; int wait_for_chld(int system_pid) { - int pid, status = 0, save_errno = errno, code; D_OPTIONS(("wait_for_chld(%ld) called.\n", system_pid)); @@ -57,6 +56,10 @@ wait_for_chld(int system_pid) /* If the child that exited is the command we spawned, or if the child exited before fork() returned in the parent, it must be our immediate child that exited. We exit gracefully. */ + if ((pid == -1) && (errno == ECHILD)) { /* No children exist. Punt. */ + errno = save_errno; + break; + } D_OPTIONS(("%ld exited.\n", pid)); if (pid == system_pid || system_pid == -1) { if (WIFEXITED(status)) { diff --git a/src/term.c b/src/term.c index 673c2dc..9a23426 100644 --- a/src/term.c +++ b/src/term.c @@ -38,6 +38,7 @@ static const char cvs_ident[] = "$Id$"; #include "../libmej/strings.h" #include "debug.h" #include "actions.h" +#include "buttons.h" #include "command.h" #include "e.h" #include "events.h" @@ -1692,9 +1693,8 @@ xterm_seq(int op, const char *str) eterm_seq_op = (unsigned char) strtol(nstr, (char **) NULL, 10); D_CMD((" XTerm_EtermSeq operation is %d\n", eterm_seq_op)); /* Yes, there is order to the numbers for this stuff. And here it is: - 0-9 Transparency Configuration - 10-14 Scrollbar Configuration - 15-19 Menu Configuration + 0-9 Image Class/Mode Configuration + 10-19 Scrollbar/Buttonbar/Menu Configuration 20-29 Miscellaneous Toggles 30-39 Foreground/Text Color Configuration 40-49 Background Color Configuration @@ -1917,6 +1917,19 @@ xterm_seq(int op, const char *str) nstr = (char *) strsep(&tnstr, ";"); OPT_SET_OR_TOGGLE(nstr, Options, Opt_scrollbar_popup); break; + case 14: + nstr = (char *) strsep(&tnstr, ";"); + if (!(nstr) || !(*(nstr))) { + bbar_show_all(-1); + parent_resize(); + } else if (BOOL_OPT_ISTRUE(nstr)) { + bbar_show_all(1); + parent_resize(); + } else if (BOOL_OPT_ISFALSE(nstr)) { + bbar_show_all(0); + parent_resize(); + } + break; case 20: nstr = (char *) strsep(&tnstr, ";"); OPT_SET_OR_TOGGLE(nstr, Options, Opt_visualBell); diff --git a/src/windows.c b/src/windows.c index ac9a669..7042738 100644 --- a/src/windows.c +++ b/src/windows.c @@ -322,7 +322,7 @@ Create_Windows(int argc, char *argv[]) Attributes.colormap = cmap; szHint.base_width = (2 * TermWin.internalBorder + ((Options & Opt_scrollbar) ? (scrollbar_get_width() + (2 * scrollbar_get_shadow())) : 0)); - szHint.base_height = (2 * TermWin.internalBorder) + bbar_total_height(); + szHint.base_height = (2 * TermWin.internalBorder) + bbar_calc_docked_height(BBAR_DOCKED); flags = (rs_geometry ? XParseGeometry(rs_geometry, &x, &y, &width, &height) : 0); D_X11(("XParseGeometry(geom, %d, %d, %d, %d)\n", x, y, width, height)); @@ -409,7 +409,7 @@ Create_Windows(int argc, char *argv[]) /* the vt window */ TermWin.x = (((Options & Opt_scrollbar) && !(Options & Opt_scrollbar_right)) ? (scrollbar_get_width() + (2 * scrollbar_get_shadow())) : 0); - TermWin.y = bbar_total_height(); + TermWin.y = bbar_calc_docked_height(BBAR_DOCKED_TOP); if ((!(Options & Opt_borderless)) && (Options & Opt_backing_store)) { D_X11(("Creating term window with save_under = TRUE\n")); TermWin.vt = XCreateWindow(Xdisplay, TermWin.parent, TermWin.x, TermWin.y, szHint.width, szHint.height, 0, Xdepth, InputOutput, CopyFromParent, @@ -480,9 +480,8 @@ void update_size_hints(void) { D_X11(("Called.\n")); - szHint.base_width = (2 * TermWin.internalBorder); - szHint.base_height = (2 * TermWin.internalBorder) + bbar_total_height(); - szHint.base_width += ((scrollbar_is_visible()) ? (scrollbar_trough_width()) : (0)); + szHint.base_width = (2 * TermWin.internalBorder) + ((scrollbar_is_visible()) ? (scrollbar_trough_width()) : (0)); + szHint.base_height = (2 * TermWin.internalBorder) + bbar_calc_docked_height(BBAR_DOCKED); szHint.width_inc = TermWin.fwidth; szHint.height_inc = TermWin.fheight; @@ -504,15 +503,25 @@ update_size_hints(void) void term_resize(int width, int height) { + static int last_width = 0, last_height = 0; + D_X11(("term_resize(%d, %d)\n", width, height)); TermWin.width = TermWin.ncol * TermWin.fwidth; TermWin.height = TermWin.nrow * TermWin.fheight; D_X11((" -> New TermWin width/height == %lux%lu\n", TermWin.width, TermWin.height)); - XMoveResizeWindow(Xdisplay, TermWin.vt, ((Options & Opt_scrollbar_right) ? (0) : ((scrollbar_is_visible()) ? (scrollbar_trough_width()) : (0))), bbar_total_height(), - width, height - bbar_total_height()); - render_simage(images[image_bg].current, TermWin.vt, TermWin_TotalWidth(), TermWin_TotalHeight(), image_bg, 0); - if (image_mode_is(image_bg, MODE_AUTO)) { - enl_ipc_sync(); + width = TermWin_TotalWidth(); + height = TermWin_TotalHeight(); + XMoveResizeWindow(Xdisplay, TermWin.vt, ((Options & Opt_scrollbar_right) ? (0) : ((scrollbar_is_visible()) ? (scrollbar_trough_width()) : (0))), + bbar_calc_docked_height(BBAR_DOCKED_TOP), width, height); + if (width != last_width || height != last_height) { + render_simage(images[image_bg].current, TermWin.vt, TermWin_TotalWidth(), TermWin_TotalHeight(), image_bg, 0); + scr_reset(); + scr_touch(); + if (image_mode_is(image_bg, MODE_AUTO)) { + enl_ipc_sync(); + } + last_width = width; + last_height = height; } } @@ -525,11 +534,8 @@ parent_resize(void) XResizeWindow(Xdisplay, TermWin.parent, szHint.width, szHint.height); D_X11((" -> New parent width/height == %lux%lu\n", szHint.width, szHint.height)); term_resize(szHint.width, szHint.height); - scrollbar_resize(szHint.width, szHint.height + bbar_total_height()); + scrollbar_resize(szHint.width, szHint.height - bbar_calc_docked_height(BBAR_DOCKED)); bbar_resize_all(szHint.width); - if (buffer_pixmap != None) { - scr_touch(); - } } void @@ -541,13 +547,6 @@ handle_resize(unsigned int width, unsigned int height) D_EVENTS(("handle_resize(%u, %u)\n", width, height)); if (first_time || (new_ncol != TermWin.ncol) || (new_nrow != TermWin.nrow)) { - int curr_screen = -1; - - /* scr_reset only works on the primary screen */ - if (!first_time) { - selection_clear(); - curr_screen = scr_change_screen(PRIMARY); - } TermWin.ncol = new_ncol; TermWin.nrow = new_nrow; @@ -555,16 +554,8 @@ handle_resize(unsigned int width, unsigned int height) szHint.width = szHint.base_width + TermWin.width; szHint.height = szHint.base_height + TermWin.height; D_X11((" -> New szHint.width/height == %lux%lu\n", szHint.width, szHint.height)); - scrollbar_resize(width, szHint.height - bbar_total_height()); + scrollbar_resize(width, szHint.height - bbar_calc_docked_height(BBAR_DOCKED)); bbar_resize_all(szHint.width); - scr_reset(); - if (buffer_pixmap != None) { - scr_touch(); - } - - if (curr_screen >= 0) { - scr_change_screen(curr_screen); - } first_time = 0; } } @@ -572,11 +563,13 @@ handle_resize(unsigned int width, unsigned int height) void handle_move(int x, int y) { - if (image_mode_any(MODE_TRANS | MODE_VIEWPORT)) { - redraw_images_by_mode(MODE_TRANS | MODE_VIEWPORT); + if ((TermWin.x != x) || (TermWin.y != y)) { + if (image_mode_any(MODE_TRANS | MODE_VIEWPORT)) { + redraw_images_by_mode(MODE_TRANS | MODE_VIEWPORT); + } + TermWin.x = x; + TermWin.y = y; } - TermWin.x = x; - TermWin.y = y; } #ifdef XTERM_COLOR_CHANGE diff --git a/themes/Eterm/theme.cfg.in b/themes/Eterm/theme.cfg.in index aa35581..9366d5b 100644 --- a/themes/Eterm/theme.cfg.in +++ b/themes/Eterm/theme.cfg.in @@ -286,6 +286,7 @@ begin main bind ctrl button1 to string "\e]5;\a" bind ctrl button2 to string "\e[?30t" bind ctrl button3 to menu Eterm + bind ctrl shift button3 to string "\e]6;14\a" end actions # This section must also come after the menus if you want any buttons diff --git a/themes/auto/theme.cfg.in b/themes/auto/theme.cfg.in index bce1260..9636ff8 100644 --- a/themes/auto/theme.cfg.in +++ b/themes/auto/theme.cfg.in @@ -286,6 +286,7 @@ begin main bind ctrl button1 to string "\e]5;\a" bind ctrl button2 to string "\e[?30t" bind ctrl button3 to menu Eterm + bind ctrl shift button3 to string "\e]6;14\a" end actions # This section must also come after the menus if you want any buttons diff --git a/themes/cEterm/theme.cfg.in b/themes/cEterm/theme.cfg.in index 321cc22..4b6991d 100644 --- a/themes/cEterm/theme.cfg.in +++ b/themes/cEterm/theme.cfg.in @@ -285,6 +285,7 @@ begin main bind ctrl button1 to string "\e]5;\a" bind ctrl button2 to string "\e[?30t" bind ctrl button3 to menu Eterm + bind ctrl shift button3 to string "\e]6;14\a" end actions # This section must also come after the menus if you want any buttons diff --git a/themes/chooser/theme.cfg.in b/themes/chooser/theme.cfg.in index 45ab856..4176144 100644 --- a/themes/chooser/theme.cfg.in +++ b/themes/chooser/theme.cfg.in @@ -286,6 +286,7 @@ begin main bind ctrl button1 to string "\e]5;\a" bind ctrl button2 to string "\e[?30t" bind ctrl button3 to menu Eterm + bind ctrl shift button3 to string "\e]6;14\a" end actions # This section must also come after the menus if you want any buttons diff --git a/themes/emacs/theme.cfg.in b/themes/emacs/theme.cfg.in index 504a4ae..514bdb2 100644 --- a/themes/emacs/theme.cfg.in +++ b/themes/emacs/theme.cfg.in @@ -286,6 +286,7 @@ begin main bind ctrl button1 to string "\e]5;\a" bind ctrl button2 to string "\e[?30t" bind ctrl button3 to menu Eterm + bind ctrl shift button3 to string "\e]6;14\a" end actions # This section must also come after the menus if you want any buttons diff --git a/themes/irc/theme.cfg.in b/themes/irc/theme.cfg.in index 1564e3e..12138c0 100644 --- a/themes/irc/theme.cfg.in +++ b/themes/irc/theme.cfg.in @@ -288,6 +288,7 @@ begin main bind ctrl button1 to string "\e]5;\a" bind ctrl button2 to string "\e[?30t" bind ctrl button3 to menu Eterm + bind ctrl shift button3 to string "\e]6;14\a" end actions # This section must also come after the menus if you want any buttons diff --git a/themes/mutt/theme.cfg.in b/themes/mutt/theme.cfg.in index 0865b9c..02ad001 100644 --- a/themes/mutt/theme.cfg.in +++ b/themes/mutt/theme.cfg.in @@ -285,6 +285,7 @@ begin main bind ctrl button1 to string "\e]5;\a" bind ctrl button2 to string "\e[?30t" bind ctrl button3 to menu Eterm + bind ctrl shift button3 to string "\e]6;14\a" end actions # This section must also come after the menus if you want any buttons diff --git a/themes/trans/theme.cfg.in b/themes/trans/theme.cfg.in index 21a4597..7a0631e 100644 --- a/themes/trans/theme.cfg.in +++ b/themes/trans/theme.cfg.in @@ -286,6 +286,7 @@ begin main bind ctrl button1 to string "\e]5;\a" bind ctrl button2 to string "\e[?30t" bind ctrl button3 to menu Eterm + bind ctrl shift button3 to string "\e]6;14\a" end actions # This section must also come after the menus if you want any buttons