summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Jennings <mej@kainx.org>2000-07-10 21:14:56 +0000
committerMichael Jennings <mej@kainx.org>2000-07-10 21:14:56 +0000
commit7dc3b7cafb69f3a2f983475c179d2cb8decd0744 (patch)
treeda9f3dd2d366559008b152e95b88d2e20f2fdb9b
parent6c2fb97641dd5045b437561037fb34c58698445e (diff)
downloadeterm-7dc3b7cafb69f3a2f983475c179d2cb8decd0744.tar.gz
Mon Jul 10 14:28:28 PDT 2000 Michael Jennings <mej@eterm.org>
Two more patches from Marius Gedminas <mgedmin@takas.lt>. The first one allows for customization of the message displayed when Eterm goes into pause mode. There are actually two; one goes in the titlebar, and the other is displayed in the text window. His second patch makes Eterm's behavior a little smarter when it resizes itself. It tries to figure out which quadrant of the screen it's on and resizes in the most appropriate direction. (For example, Ctrl-GreaterThan on an Eterm in the lower right corner will cause the upper left corner of the Eterm to move; the lower right corner will stay put.) Thanks again to Marius for saving me time by sending patches. :-) SVN revision: 2912
-rw-r--r--ChangeLog17
-rw-r--r--src/command.c9
-rw-r--r--src/options.c10
-rw-r--r--src/options.h2
-rw-r--r--src/windows.c35
-rw-r--r--src/windows.h1
6 files changed, 70 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 7a4b550..421fdc1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3793,3 +3793,20 @@ Fri Jul 7 11:45:49 PDT 2000 Michael Jennings <mej@eterm.org>
Some more bits from last night's work.
-------------------------------------------------------------------------------
+Mon Jul 10 14:28:28 PDT 2000 Michael Jennings <mej@eterm.org>
+
+ Two more patches from Marius Gedminas <mgedmin@takas.lt>. The first
+ one allows for customization of the message displayed when Eterm goes
+ into pause mode. There are actually two; one goes in the titlebar,
+ and the other is displayed in the text window.
+
+ His second patch makes Eterm's behavior a little smarter when it
+ resizes itself. It tries to figure out which quadrant of the screen
+ it's on and resizes in the most appropriate direction. (For example,
+ Ctrl-GreaterThan on an Eterm in the lower right corner will cause the
+ upper left corner of the Eterm to move; the lower right corner will
+ stay put.)
+
+ Thanks again to Marius for saving me time by sending patches. :-)
+
+-------------------------------------------------------------------------------
diff --git a/src/command.c b/src/command.c
index 7ec45fa..13408a0 100644
--- a/src/command.c
+++ b/src/command.c
@@ -2437,9 +2437,14 @@ cmd_getc(void)
if (paused == 1 && cmd_fd == -1) {
const char *done = " -- Task Finished, ESC to exit";
- append_to_title(done);
- append_to_icon_name(done);
+ append_to_title(rs_finished_title ? rs_finished_title : done);
+ append_to_icon_name(rs_finished_title ? rs_finished_title : done);
+
paused++;
+
+ if (rs_finished_text) {
+ cmd_write((unsigned char *) rs_finished_text, strlen(rs_finished_text));
+ }
}
#ifdef SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
diff --git a/src/options.c b/src/options.c
index 9797fe2..d73992f 100644
--- a/src/options.c
+++ b/src/options.c
@@ -137,6 +137,8 @@ char *rs_cutchars = NULL;
unsigned short rs_min_anchor_size = 0;
char *rs_scrollbar_type = NULL;
unsigned long rs_scrollbar_width = 0;
+char *rs_finished_title = NULL;
+char *rs_finished_text = NULL;
char *rs_term_name = NULL;
#ifdef PIXMAP_SUPPORT
char *rs_pixmapScale = NULL;
@@ -351,6 +353,8 @@ static const struct {
#ifdef CUTCHAR_OPTION
OPT_LONG("cut-chars", "seperators for double-click selection", &rs_cutchars),
#endif /* CUTCHAR_OPTION */
+ OPT_LONG("finished-title", "text to add to window title after program termination", &rs_finished_title),
+ OPT_LONG("finished-text", "text to output after program termination", &rs_finished_text),
OPT_LONG("term-name", "value to use for setting $TERM", &rs_term_name),
OPT_LONG("pipe-name", "filename of console pipe to emulate -C", &rs_pipe_name),
OPT_BOOL('C', "console", "grab console messages", &Options, Opt_console),
@@ -2432,6 +2436,12 @@ parse_misc(char *buff, void *state)
} else if (!BEG_STRCASECMP(buff, "line_space ")) {
rs_line_space = strtol(PWord(2, buff), (char **) NULL, 0);
+ } else if (!BEG_STRCASECMP(buff, "finished_title ")) {
+ RESET_AND_ASSIGN(rs_finished_title, Word(2, buff));
+
+ } else if (!BEG_STRCASECMP(buff, "finished_text ")) {
+ RESET_AND_ASSIGN(rs_finished_text, Word(2, buff));
+
} else if (!BEG_STRCASECMP(buff, "term_name ")) {
RESET_AND_ASSIGN(rs_term_name, Word(2, buff));
diff --git a/src/options.h b/src/options.h
index 6f14350..6f0aa67 100644
--- a/src/options.h
+++ b/src/options.h
@@ -207,6 +207,8 @@ extern char *rs_geometry; /* Geometry string */
extern int rs_desktop; /* Startup desktop */
extern int rs_saveLines; /* Lines in the scrollback buffer */
extern unsigned short rs_min_anchor_size; /* Minimum size, in pixels, of the scrollbar anchor */
+extern char *rs_finished_title; /* Text added to window title (--pause) */
+extern char *rs_finished_text; /* Text added to scrollback (--pause) */
extern char *rs_term_name;
extern char *rs_icon;
extern char *rs_scrollbar_type;
diff --git a/src/windows.c b/src/windows.c
index f32603f..8b9aabd 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -478,6 +478,37 @@ Create_Windows(int argc, char *argv[])
}
}
+/* resize window keeping one point (determined by window geometry) in place */
+void
+resize_parent(unsigned int width, unsigned int height)
+{
+ XWindowAttributes attr;
+
+ if ((!XGetWindowAttributes(Xdisplay, TermWin.parent, &attr))) {
+ XResizeWindow(Xdisplay, TermWin.parent, width, height);
+ } else {
+ Window junkwin;
+ int x, y, scr_w, scr_h, dx, dy;
+
+ scr_w = WidthOfScreen(attr.screen);
+ scr_h = HeightOfScreen(attr.screen);
+ dx = attr.width - width;
+ dy = attr.height - height;
+ XTranslateCoordinates(Xdisplay, TermWin.parent, attr.root, 0, 0, &x, &y, &junkwin);
+ /* Check position of the center of the window */
+ if (x < (scr_w - attr.width) / 2) /* left half */
+ dx = 0;
+ else if (x == (scr_w - attr.width) / 2 ) /* exact center */
+ dx /= 2;
+ if (y < (scr_h - attr.height) / 2) /* top half */
+ dy = 0;
+ else if (y == (scr_h - attr.height) / 2) /* exact center */
+ dy /= 2;
+ D_X11(("Calling XMoveResizeWindow(Xdisplay, 0x%08x, %d + %d, %d + %d, %d, %d)\n", TermWin.parent, x, dx, y, dy, width, height));
+ XMoveResizeWindow(Xdisplay, TermWin.parent, x + dx, y + dy, width, height);
+ }
+}
+
/* good for toggling 80/132 columns */
void
set_width(unsigned short width)
@@ -488,7 +519,7 @@ set_width(unsigned short width)
width = szHint.base_width + width * TermWin.fwidth;
height = szHint.base_height + height * TermWin.fheight;
- XResizeWindow(Xdisplay, TermWin.parent, width, height);
+ resize_parent(width, height);
handle_resize(width, height);
}
}
@@ -548,7 +579,7 @@ parent_resize(void)
{
D_X11(("Called.\n"));
update_size_hints();
- XResizeWindow(Xdisplay, TermWin.parent, szHint.width, szHint.height);
+ resize_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_calc_docked_height(BBAR_DOCKED));
diff --git a/src/windows.h b/src/windows.h
index 8fa7224..db3d3e4 100644
--- a/src/windows.h
+++ b/src/windows.h
@@ -47,6 +47,7 @@ extern Pixel get_color_by_name(const char *, const char *);
extern Pixel get_color_by_pixel(Pixel, Pixel);
extern void process_colors(void);
extern void Create_Windows(int, char * []);
+extern void resize_parent(unsigned int, unsigned int);
extern void set_width(unsigned short);
extern void update_size_hints(void);
extern void term_resize(int, int);