Currently hitting Shift+Plus while rxvt is in the lower-right corner of
the screen would make a part of the window invisible (off-screen). This
patch adds a new configure option, --enable-magic-resize. When enabled,
it makes rxvt always grow towards the center of the screen.
Marius Gedminas
--
If you are angry with someone, you should walk a mile in their shoes... then
you'll be a mile away from them, and you'll have their shoes.
Index: autoconf/acconfig.h
===================================================================
RCS file: /cvsroot/rxvt/rxvt/autoconf/acconfig.h,v
retrieving revision 1.38
diff -u -u -r1.38 acconfig.h
--- autoconf/acconfig.h 2001/03/23 06:15:36 1.38
+++ autoconf/acconfig.h 2001/04/04 21:43:07
@@ -107,6 +107,9 @@
/* Build shared library version - don't set here, specify via configure */
#undef LIBRXVT
+/* Define to use "magic" resize behavior */
+#undef MAGIC_RESIZE
+
/* ------------------------------------------------------------------------- */
/* -- CONFIGURE DETECTED FEATURES -- */
/* ------------------------------------------------------------------------- */
Index: autoconf/configure.in
===================================================================
RCS file: /cvsroot/rxvt/rxvt/autoconf/configure.in,v
retrieving revision 1.107
diff -u -u -r1.107 configure.in
--- autoconf/configure.in 2001/04/02 07:32:35 1.107
+++ autoconf/configure.in 2001/04/04 21:43:12
@@ -295,6 +295,12 @@
DINCLUDE=
fi])
+AC_ARG_ENABLE(magic-resize,
+ [ --enable-magic-resize enable magic resize behavior],
+ [if test x$enableval = xyes; then
+ AC_DEFINE(MAGIC_RESIZE)
+ fi])
+
AC_ARG_WITH(term,
[ --with-term=NAME set the terminal to NAME (default \"xterm\")],
[if test x$withval != x; then
Index: src/main.c
===================================================================
RCS file: /cvsroot/rxvt/rxvt/src/main.c,v
retrieving revision 1.145
diff -u -u -r1.145 main.c
--- src/main.c 2001/04/04 08:14:44 1.145
+++ src/main.c 2001/04/04 21:44:06
@@ -942,9 +942,39 @@
rxvt_window_calc(r, width, height);
XSetWMNormalHints(r->Xdisplay, r->TermWin.parent[0], &r->szHint);
- if (!ignoreparent)
+ if (!ignoreparent) {
+#ifdef MAGIC_RESIZE
+ XWindowAttributes wattr;
+ Window junkwin;
+ int x, y;
+ int dx = 0, dy = 0;
+ int scr_width = DisplayWidth(r->Xdisplay, Xscreen);
+ int scr_height = DisplayHeight(r->Xdisplay, Xscreen);
+
+ if (XGetWindowAttributes(r->Xdisplay, r->TermWin.parent[0], &wattr)) {
+ dx = wattr.width - r->szHint.width;
+ dy = wattr.height - r->szHint.height;
+ }
+ (void) XTranslateCoordinates(r->Xdisplay, r->TermWin.parent[0], Xroot,
+ 0, 0, &x, &y, &junkwin);
+
+ /* Check position of the center of the window */
+ if (x < (scr_width - wattr.width) / 2) /* left half */
+ dx = 0;
+ else if (x == (scr_width - wattr.width) / 2 ) /* exact center */
+ dx /= 2;
+ if (y < (scr_height - wattr.height) / 2) /* top half */
+ dy = 0;
+ else if (y == (scr_height - wattr.height) / 2) /* exact center */
+ dy /= 2;
+
+ XMoveResizeWindow(r->Xdisplay, r->TermWin.parent[0], x + dx, y + dy,
+ r->szHint.width, r->szHint.height);
+#else
XResizeWindow(r->Xdisplay, r->TermWin.parent[0], r->szHint.width,
r->szHint.height);
+#endif
+ }
fix_screen = (r->TermWin.ncol != r->h->prev_ncol
|| r->TermWin.nrow != r->h->prev_nrow);