opt/aterm/aterm-fake_root.patch
2006-02-23 15:26:10 +00:00

206 lines
7.7 KiB
Diff

diff -Nru aterm-1.0.0.orig/README.configure aterm-1.0.0/README.configure
--- aterm-1.0.0.orig/README.configure 2005-07-11 20:48:22.000000000 +0200
+++ aterm-1.0.0/README.configure 2005-07-11 20:48:41.000000000 +0200
@@ -56,6 +56,10 @@
the mouse button down on a scrollbar arrow
--disable-mousewheel
remove support for scrolling via mouse wheel or buttons 4 & 5
+--enable-fake-root
+ add support for pseudo root terminals. Associated with
+ transparency options, this enables pseudo-terminals
+ looking like they are part of X root window
--enable-old-selection
revert mouse selection to something similar to v2.20 (and prior) -
this implies word selection of those versions (i.e. next option)
diff -Nru aterm-1.0.0.orig/autoconf/configure.in aterm-1.0.0/autoconf/configure.in
--- aterm-1.0.0.orig/autoconf/configure.in 2005-07-11 20:48:22.000000000 +0200
+++ aterm-1.0.0/autoconf/configure.in 2005-07-11 20:48:41.000000000 +0200
@@ -82,6 +82,9 @@
AC_ARG_ENABLE(mousewheel, [ --disable-mousewheel disable scrolling via mouse wheel or buttons 4 & 5],
[if test x$enableval = xno; then AC_DEFINE(NO_MOUSE_WHEEL,1,[Use wheel events (button4 and button5) to scroll]) fi])
+AC_ARG_ENABLE(fake-root, [ --enable-fake-root enable fake root support],
+ [if test x$enableval = xyes; then AC_DEFINE(FAKE_ROOT,1,[Define to enable fake root pseudo-terminals]) fi])
+
AC_ARG_ENABLE(old-selection, [ --enable-old-selection enable v2.20 (and prior) mouse selection
- this implies old word selection],
[if test x$enableval = xyes; then AC_DEFINE(OLD_SELECTION,1,[Define to use old rxvt (ver 2.20 and before) style selection, not xterm style.]) fi])
diff -Nru aterm-1.0.0.orig/doc/aterm.1 aterm-1.0.0/doc/aterm.1
--- aterm-1.0.0.orig/doc/aterm.1 2005-07-11 20:48:22.000000000 +0200
+++ aterm-1.0.0/doc/aterm.1 2005-07-11 20:48:41.000000000 +0200
@@ -230,6 +230,16 @@
.IP "\fB-st\fP|\fB+st\fP"
Display scrollbar without/with a trough;
resource \fBscrollBar_floating\fP\&.
+.IP "\fB-fr\fP|\fB+fr\fP"
+Turn on/off making the aterm's parent window an unmanaged one mapped
+at the bottom on the stack without cursor change. When turned on, also
+provide a 'point-to-focus' behavior model independently
+from the X Window Manager.\&
+
+This is useful combined with other options (\fB-tr\fP, \fB-bw\fP,
+\fB-geometry\fP, ...) to provide pseudo-terminals seamlessly integrated
+into the X desktop. Please note this will not work as expected with WMs
+masquerading the X root window with fake roots; resource \fBfakeRoot\fP\&.
.IP "\fB-iconic\fP"
Start iconified, if the window manager supports that option\&.
.IP "\fB-sl\fP \fInumber\fP"
diff -Nru aterm-1.0.0.orig/src/command.c aterm-1.0.0/src/command.c
--- aterm-1.0.0.orig/src/command.c 2005-07-11 20:48:22.000000000 +0200
+++ aterm-1.0.0/src/command.c 2005-07-11 20:48:41.000000000 +0200
@@ -2365,6 +2365,13 @@
}
break;
+#ifdef FAKE_ROOT
+ case EnterNotify:
+ if (Options&Opt_fake_root)
+ XGrabKeyboard(Xdisplay,TermWin.parent,True,
+ GrabModeAsync,GrabModeAsync,CurrentTime);
+ else break;
+#endif
case FocusIn:
if (!TermWin.focus) {
TermWin.focus = 1;
@@ -2381,7 +2388,12 @@
#endif
}
break;
-
+#ifdef FAKE_ROOT
+ case LeaveNotify:
+ if (Options&Opt_fake_root)
+ XUngrabKeyboard(Xdisplay,CurrentTime);
+ else break;
+#endif
case FocusOut:
if (TermWin.focus) {
TermWin.focus = 0;
diff -Nru aterm-1.0.0.orig/src/main.c aterm-1.0.0/src/main.c
--- aterm-1.0.0.orig/src/main.c 2005-07-11 20:48:22.000000000 +0200
+++ aterm-1.0.0/src/main.c 2005-07-11 20:50:18.000000000 +0200
@@ -705,7 +705,14 @@
&attributes);
#else
- attr_mask |= CWColormap ;
+#ifdef FAKE_ROOT
+ attributes.override_redirect = (Options&Opt_fake_root)?True:False;
+ mwmhints.flags = 0;
+#else
+ attributes.override_redirect = False;
+#endif
+
+ attr_mask |= CWColormap | CWOverrideRedirect ;
TermWin.parent = XCreateWindow(Xdisplay, Xroot,
szHint.x, szHint.y,
szHint.width, szHint.height,
@@ -745,8 +752,17 @@
}
-/* vt cursor: Black-on-White is standard, but this is more popular */
- TermWin_cursor = XCreateFontCursor(Xdisplay, XC_xterm);
+/* vt cursor: Black-on-White is standard, but this is more popular,
+ so let's do the opposite unless we found ourselves in the FAKE_ROOT case
+*/
+ TermWin_cursor = XCreateFontCursor(Xdisplay,
+#ifndef FAKE_ROOT
+ XC_xterm
+#else
+ (Options&Opt_fake_root)?
+ XC_left_ptr:XC_xterm
+#endif
+);
{
XColor fg, bg;
@@ -754,6 +770,11 @@
XQueryColor(Xdisplay, Xcmap, &fg);
bg.pixel = PixColors[Color_bg];
XQueryColor(Xdisplay, Xcmap, &bg);
+#ifdef FAKE_ROOT
+ if (Options&Opt_fake_root)
+ XRecolorCursor(Xdisplay, TermWin_cursor, &bg, &fg);
+ else
+#endif
XRecolorCursor(Xdisplay, TermWin_cursor, &fg, &bg);
}
@@ -763,7 +784,12 @@
ButtonPressMask |
ButtonReleaseMask |
Button1MotionMask |
- Button3MotionMask);
+ Button3MotionMask
+#ifdef FAKE_ROOT
+ | EnterWindowMask |
+ LeaveWindowMask
+#endif
+ );
attributes.cursor = TermWin_cursor ;
/* the vt window */
#ifdef HAVE_AFTERIMAGE
@@ -1037,12 +1063,12 @@
XConfigureEvent *xconf = &(ev->xconfigure);
while( XCheckTypedWindowEvent( Xdisplay, TermWin.parent, ConfigureNotify, ev ) );
- fprintf( stderr, "config_geom = %dx%d\n", xconf->width, xconf->height );
+/* fprintf( stderr, "config_geom = %dx%d\n", xconf->width, xconf->height ); */
resize_window1(xconf->width, xconf->height);
#if 1
XTranslateCoordinates (Xdisplay, TermWin.parent, Xroot, 0, 0, &root_x, &root_y, &wdumm);
- fprintf( stderr, "root_geom = %dx%d%+d%+d, root_size = %dx%d\n", xconf->width, xconf->height, root_x, root_y, XdisplayWidth, XdisplayHeight );
+/* fprintf( stderr, "root_geom = %dx%d%+d%+d, root_size = %dx%d\n", xconf->width, xconf->height, root_x, root_y, XdisplayWidth, XdisplayHeight ); */
TermWin.root_x = root_x ;
TermWin.root_y = root_y ;
TermWin.root_width = xconf->width ;
@@ -2341,6 +2367,11 @@
/* do it now to avoid unneccessary redrawing */
XMapWindow(Xdisplay, TermWin.vt);
XMapWindow(Xdisplay, TermWin.parent);
+#ifdef FAKE_ROOT
+/* put the window on the bottom of the stack if we are 'faking root' */
+ if (Options&Opt_fake_root)
+ XLowerWindow(Xdisplay, TermWin.parent);
+#endif
#if 0
#if defined(BACKGROUND_IMAGE) || defined(TRANSPARENT) || defined(_MYSTYLE_)
diff -Nru aterm-1.0.0.orig/src/rxvt.h aterm-1.0.0/src/rxvt.h
--- aterm-1.0.0.orig/src/rxvt.h 2005-07-11 20:48:22.000000000 +0200
+++ aterm-1.0.0/src/rxvt.h 2005-07-11 20:48:41.000000000 +0200
@@ -779,6 +779,7 @@
#define Opt_transparent (1LU<<13)
#define Opt_transparent_sb (1LU<<14)
#define Opt_borderLess (1LU<<16)
+#define Opt_fake_root (1LU<<17)
/* place holder used for parsing command-line options */
#define Opt_Reverse (1LU<<30)
diff -Nru aterm-1.0.0.orig/src/xdefaults.c aterm-1.0.0/src/xdefaults.c
--- aterm-1.0.0.orig/src/xdefaults.c 2005-07-11 20:48:22.000000000 +0200
+++ aterm-1.0.0/src/xdefaults.c 2005-07-11 20:48:41.000000000 +0200
@@ -80,6 +80,9 @@
#ifdef GREEK_SUPPORT
static const char *rs_greek_keyboard = NULL;
#endif
+#ifdef FAKE_ROOT
+static const char *rs_fake_root = NULL;
+#endif
/*}}} */
/*{{{ monolithic option/resource structure: */
@@ -311,6 +314,10 @@
"scroll-on-tty-output inhibit"),
BOOL(rs_scrollKeypress, "scrollKey", "sk",
Opt_scrollKeypress, "scroll-on-keypress"),
+#ifdef FAKE_ROOT
+ BOOL(rs_fake_root, "fakeRoot", "fr", Opt_fake_root,
+ "fake root window embedding"),
+#endif
STRG(rs_minBufferWidth, "minBufferWidth", "mbw", "number",
"minimum number of columns stored in buffer"),
STRG(rs_saveLines, "saveLines", "sl", "number",