autoconf/configure.in | 23 +++++++++++- doc/aterm.1 | 2 +- src/command.c | 93 ++++++++++++++++++++++++++++-------------------- src/feature.h | 4 +- src/main.c | 11 +++--- src/pixmap.c | 2 +- src/pixmap.h | 42 ++++++++++++++++++++++ src/rxvt.h | 1 + src/screen.c | 10 ++++-- src/scrollbar.c | 2 +- src/xdefaults.c | 20 +++++++++-- 11 files changed, 152 insertions(+), 58 deletions(-) diff --git a/autoconf/configure.in b/autoconf/configure.in index c7805cc..5290532 100644 --- a/autoconf/configure.in +++ b/autoconf/configure.in @@ -418,6 +418,7 @@ AC_CHECK_HEADERS( \ sys/ioctl.h \ sys/select.h \ sys/sockio.h \ + sys/stropts.h \ sys/time.h \ ) @@ -608,7 +609,7 @@ fi dnl# this is a really hack test for some basic Xlocale stuff SAVETHELIBS=$LIBS -LIBS="$LIBS $X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS -lX11 -lXmu" +LIBS="$LIBS $X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS -lX11" CFLAGS="$CFLAGS $X_CFLAGS" AC_CACHE_CHECK(for working Xlocale, rxvt_cv_func_xlocale, [AC_TRY_RUN( @@ -635,7 +636,7 @@ AC_CACHE_CHECK(for working setlocale, rxvt_cv_func_xsetlocale, [setlocale(LC_CTYPE, "");], rxvt_cv_func_xsetlocale=yes, rxvt_cv_func_xsetlocale=no)]) if test "${rxvt_cv_func_xsetlocale}" = no; then - AC_DEFINE(NO_XSETLOCALE) + AC_DEFINE(NO_XSETLOCALE,1,[Description]) fi AC_CACHE_CHECK(for working plain setlocale, rxvt_cv_func_setlocale, @@ -646,6 +647,24 @@ if test x${rxvt_cv_func_setlocale} = xno; then AC_DEFINE(NO_SETLOCALE,1,[Define is setlocale (defined to Xsetlocale) doesn't work]) fi +AC_CACHE_CHECK(if we can link with utempter library,cf_cv_have_utempter,[ +cf_save_LIBS="$LIBS" +LIBS="-lutempter $LIBS" +AC_TRY_LINK([ +#include +],[ + utempter_add_record(1, 0); + utempter_remove_added_record(); +],[ + cf_cv_have_utempter=yes],[ + cf_cv_have_utempter=no]) +LIBS="$cf_save_LIBS" +]) +if test "$cf_cv_have_utempter" = yes ; then + AC_DEFINE(HAVE_UTEMPTER,1,[Define if you have libutempter.]) + LIBS="-lutempter $LIBS" +fi + dnl> AC_CHECK_FUNCS(gettimeofday putenv select socket) CFLAGS=${CFLAGS--O} diff --git a/doc/aterm.1 b/doc/aterm.1 index 2424b9e..e9966c0 100644 --- a/doc/aterm.1 +++ b/doc/aterm.1 @@ -171,7 +171,7 @@ resource \fBpointerColor\fP\&. .IP "\fB-bd\fP \fIcolour\fP" The colour of the border between the xterm scrollbar and the text; resource \fBborderColor\fP\&. -.IP "\fB-bl\fP \fInumber\fP" +.IP "\fB-bl\fP|\fB+bl\fP" This option specifies that aterm should askwindow manager to not have a border around term's window; resource \fBborderLess\fP\&. diff --git a/src/command.c b/src/command.c index a427710..cc9b3a7 100644 --- a/src/command.c +++ b/src/command.c @@ -48,10 +48,16 @@ static const char rcsid[] = "$Id: command.c,v 1.24 2006/06/26 18:01:20 sasha Exp /*{{{ includes: */ #include "rxvt.h" /* NECESSARY */ +#include +#include #ifdef HAVE_AFTERSTEP #include "libAfterStep/event.h" #endif +#ifdef HAVE_UTEMPTER +#include +#endif + #define TT_PRINTF_LIMIT 1024 #if defined(OFFIX_DND) || defined(TRANSPARENT) @@ -91,7 +97,9 @@ static const char rcsid[] = "$Id: command.c,v 1.24 2006/06/26 18:01:20 sasha Exp #if defined (__svr4__) || defined (__lnx21__) # include /* for struct rlimit */ -# include /* for I_PUSH */ +# ifdef HAVE_SYS_STROPTS_H +# include /* for I_PUSH */ +# endif # define _NEW_TTY_CTRL /* to get proper defines in */ #endif @@ -503,11 +511,13 @@ Exit_signal(int sig) #endif signal(sig, SIG_DFL); -#ifdef UTMP_SUPPORT privileges(RESTORE); +#ifdef UTMP_SUPPORT cleanutent(); - privileges(IGNORE); +#elif defined(HAVE_UTEMPTER) + utempter_remove_added_record(); #endif + privileges(IGNORE); kill(getpid(), sig); } @@ -532,6 +542,8 @@ clean_exit(void) #endif #ifdef UTMP_SUPPORT cleanutent(); +#elif defined(HAVE_UTEMPTER) + utempter_remove_added_record(); #endif privileges(IGNORE); } @@ -673,6 +685,7 @@ get_tty(void) exit(EXIT_FAILURE); } #if defined (__svr4__) || defined (__lnx21__) +# ifdef HAVE_SYS_STROPTS_H /* * Push STREAMS modules: * ptem: pseudo-terminal hardware emulation module. @@ -682,6 +695,7 @@ get_tty(void) ioctl(fd, I_PUSH, "ptem"); ioctl(fd, I_PUSH, "ldterm"); ioctl(fd, I_PUSH, "ttcompat"); +# endif #else /* __svr4__ */ { /* change ownership of tty to real uid and real group */ @@ -1135,8 +1149,16 @@ run_command(char *argv[]) } else { const char *argv0, *shell; - if ((shell = getenv("SHELL")) == NULL || *shell == '\0') - shell = DEFAULT_SHELL; + shell = getenv("SHELL"); + if (!shell || !*shell) { + struct passwd *pw = getpwuid (getuid()); + + if (pw) + shell = pw->pw_shell; + + if (!shell || !*shell) + shell = _PATH_BSHELL; + } argv0 = my_basename(shell); if (Options & Opt_loginShell) { @@ -1146,17 +1168,20 @@ run_command(char *argv[]) STRCPY(&p[1], argv0); argv0 = p; } - execlp(shell, argv0, NULL); + execl(shell, argv0, NULL); print_error("can't execute \"%s\"", shell); } exit(EXIT_FAILURE); } -#ifdef UTMP_SUPPORT privileges(RESTORE); - if (!(Options & Opt_utmpInhibit)) + if (!(Options & Opt_utmpInhibit)) { +#ifdef UTMP_SUPPORT makeutent(ttydev, display_name); /* stamp /etc/utmp */ - privileges(IGNORE); +#elif defined(HAVE_UTEMPTER) + utempter_add_record(ptyfd,display_name); #endif + } + privileges(IGNORE); return ptyfd; } @@ -1486,19 +1511,21 @@ lookup_key(XEvent * ev) numlock_state = (ev->xkey.state & ModNumLockMask); /* numlock toggle */ PrivMode((!numlock_state), PrivMode_aplKP); } -#ifdef USE_XIM +#if defined(USE_XIM) || !defined(NO_XLOCALE) len = 0; - if (Input_Context != NULL) { - Status status_return; - - kbuf[0] = '\0'; - len = XmbLookupString(Input_Context, &ev->xkey, kbuf, - sizeof(kbuf), &keysym, - &status_return); - } else { - len = XLookupString(&ev->xkey, kbuf, - sizeof(kbuf), &keysym, - &compose); + if (!XFilterEvent(ev, *(&ev->xkey.window))) { + if (Input_Context != NULL) { + Status status_return; + + kbuf[0] = '\0'; + len = XmbLookupString(Input_Context, &ev->xkey, kbuf, + sizeof(kbuf), &keysym, + &status_return); + } else { + len = XLookupString(&ev->xkey, kbuf, + sizeof(kbuf), &keysym, + &compose); + } } #else /* USE_XIM */ len = XLookupString(&ev->xkey, (char *) kbuf, sizeof(kbuf), &keysym, &compose); @@ -1579,7 +1606,7 @@ lookup_key(XEvent * ev) break; case XK_Insert: /* Shift+Insert = paste mouse selection */ - selection_request(ev->xkey.time, ev->xkey.x, ev->xkey.y); + selection_request(ev->xkey.time, 0, 0); return; break; @@ -1868,29 +1895,17 @@ lookup_key(XEvent * ev) kbuf[0] = ('*' + (keysym - XK_KP_Multiply)); } break; - - case XK_F1: /* "\033OP" */ - case XK_F2: /* "\033OQ" */ - case XK_F3: /* "\033OR" */ - case XK_F4: /* "\033OS" */ - len = 3; - STRCPY(kbuf, "\033OP"); - kbuf[2] += (keysym - XK_F1); - break; #define FKEY(n, fkey) \ len = 5; \ sprintf((char *) kbuf,"\033[%02d~", (int)((n) + (keysym - fkey))) -#if 0 /* old style keymappings : */ + case XK_F1: /* "\033[11~" */ case XK_F2: /* "\033[12~" */ case XK_F3: /* "\033[13~" */ case XK_F4: /* "\033[14~" */ - FKEY(11, XK_F1); - break; -#endif case XK_F5: /* "\033[15~" */ - FKEY(15, XK_F5); + FKEY(11, XK_F1); break; case XK_F6: /* "\033[17~" */ @@ -3416,7 +3431,7 @@ void process_terminal_mode(int mode, int priv, unsigned int nargs, int arg[]) { unsigned int i; - int state; + int state = 0; if (nargs == 0) return; @@ -3445,7 +3460,7 @@ process_terminal_mode(int mode, int priv, unsigned int nargs, int arg[]) break; #define PrivCases(bit) \ - if (mode == 't') \ + {if (mode == 't') \ state = !(PrivateModes & bit); \ else \ state = mode; \ @@ -3459,7 +3474,7 @@ process_terminal_mode(int mode, int priv, unsigned int nargs, int arg[]) /* FALLTHROUGH */ \ default: \ PrivMode (state, bit); \ - } + }} case '?': for (i = 0; i < nargs; i++) diff --git a/src/feature.h b/src/feature.h index 7b6a8b2..752f188 100644 --- a/src/feature.h +++ b/src/feature.h @@ -179,7 +179,7 @@ * Default separating chars for multiple-click selection * Space and tab are separate separating characters and are not settable */ -#define CUTCHARS "\"&'()*,;<=>?@[\\]^`{|}~" +#define CUTCHARS "\"&'()*,;<=>?@[\\]^`{|}:" /* * Add run-time support for changing the cutchars for double click selection @@ -303,7 +303,7 @@ #define BORDERWIDTH 1 /* Add a run-time option to disable pixmap tiling. */ -#define DONT_TILE_PIXMAP_OPTION +/* #define DONT_TILE_PIXMAP_OPTION */ /* * Default number of lines in the scrollback buffer diff --git a/src/main.c b/src/main.c index 7609808..50632fb 100644 --- a/src/main.c +++ b/src/main.c @@ -32,11 +32,11 @@ *----------------------------------------------------------------------*/ #ifndef lint -static const char rcsid[] = "$Id: main.c,v 1.33 2007/08/01 14:08:29 vae Exp $"; +static const char rcsid[] = "$Id: main.c,v 1.34 2007/08/06 18:06:32 speedy Exp $"; #endif #define INTERN /* assign all global vars to me */ -#include "rxvt.h" /* NECESSARY */ +#include "pixmap.h" /* NECESSARY */ #include "X11/Xatom.h" #include "X11/Xproto.h" #include @@ -741,6 +741,7 @@ Create_Windows(int argc, char *argv[]) if (mwmhints.flags && _XA_MwmAtom) { + _XA_MwmAtom = XInternAtom(Xdisplay, "_MOTIF_WM_HINTS", False); XChangeProperty(Xdisplay, TermWin.parent, _XA_MwmAtom, _XA_MwmAtom, 32, PropModeReplace, (unsigned char *) &mwmhints, PROP_MWM_HINTS_ELEMENTS); } @@ -2058,8 +2059,7 @@ main(int argc, char *argv[]) get_options(argc, argv); if( display_name == NULL ) - if ((display_name = getenv("DISPLAY")) == NULL) - display_name = ":0"; + display_name = getenv("DISPLAY"); #ifdef HAVE_AFTERSTEP #ifdef MyArgs_IS_MACRO @@ -2105,8 +2105,7 @@ main(int argc, char *argv[]) print_error("can't open display %s", display_name); exit(EXIT_FAILURE); } - /* changed from _MOTIF_WM_INFO - Vaevictus - gentoo bug #139554 */ - _XA_MwmAtom = XInternAtom(Xdisplay, "_MOTIF_WM_HINTS", True); + _XA_MwmAtom = XInternAtom(Xdisplay, "_MOTIF_WM_INFO", True); _XA_NET_WM_PID = XInternAtom(Xdisplay, "_NET_WM_PID", False); _XROOTPMAP_ID = XInternAtom(Xdisplay, "_XROOTPMAP_ID", False); _XA_NET_SUPPORTING_WM_CHECK = XInternAtom(Xdisplay, "_NET_SUPPORTING_WM_CHECK", False); diff --git a/src/pixmap.c b/src/pixmap.c index 9b5c957..603b870 100644 --- a/src/pixmap.c +++ b/src/pixmap.c @@ -27,7 +27,7 @@ static const char rcsid[] = "$Id: pixmap.c,v 1.17 2005/06/21 20:08:16 sasha Exp $"; #endif -#include "rxvt.h" /* NECESSARY */ +#include "pixmap.h" /* NECESSARY */ int pixmap_error_handler (Display * dpy, XErrorEvent * error) diff --git a/src/pixmap.h b/src/pixmap.h new file mode 100644 index 0000000..f9fcb6e --- /dev/null +++ b/src/pixmap.h @@ -0,0 +1,42 @@ +#ifndef _ATERM_PIXMAP_H +#define _ATERM_PIXMAP_H + +#include "rxvt.h" + +int +FillPixmapWithTile (Pixmap pixmap, Pixmap tile, int x, int y, int width, + int height, int tile_x, int tile_y); + +int +GetWinPosition (Window win, int *x, int *y); + +Pixmap +CutWinPixmap (Window win, Drawable src, int src_w, int src_h, int width, + int height, GC gc, ShadingInfo * shading); + +Pixmap +GetRootPixmap(Atom id); + +Pixmap +ValidatePixmap(Pixmap p, int bSetHandler, int bTransparent, + unsigned int *pWidth, unsigned int *pHeight); + +int +GetMyPosition(int* x, int* y); + +void +SetSrcPixmap(Pixmap p); + +void +ValidateSrcPixmap(int bSetHandler); + +void +RenderPixmap(int DontCheckSource); + +int +parse_pixmap_geom(const char *geom); + +void +LoadBGPixmap(const char *file); + +#endif /* _ATERM_PIXMAP_H */ diff --git a/src/rxvt.h b/src/rxvt.h index 2eae760..f92c4ce 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -784,6 +784,7 @@ enum { #define Opt_scrollKeypress (1LU<<12) #define Opt_transparent (1LU<<13) #define Opt_transparent_sb (1LU<<14) +#define Opt_cutToBeginningOfLine (1LU<<15) #define Opt_borderLess (1LU<<16) /* place holder used for parsing command-line options */ diff --git a/src/screen.c b/src/screen.c index 5218804..5268510 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2883,7 +2883,7 @@ selection_request(Time tm, int x, int y) selection.type = 1; /* "fix" for the high-ascii pasting? : */ /* may need to try all three : aterm_XA_UTF8_STRING, _XA_COMPAUND_TEXT and XA_STRING in that order */ - XConvertSelection(Xdisplay, XA_PRIMARY, XA_STRING, aterm_XA_VT_SELECTION, TermWin.vt,tm); + XConvertSelection(Xdisplay, XA_PRIMARY, _XA_COMPAUND_TEXT, aterm_XA_VT_SELECTION, TermWin.vt,tm); /* XConvertSelection(Xdisplay, XA_PRIMARY, _XA_COMPAUND_TEXT, prop, TermWin.vt,tm); */ } } @@ -3155,7 +3155,7 @@ selection_delimit_word(int dirn, row_col_t * mark, row_col_t * ret) text_t *stp; rend_t *srp; - if (selection.clicks != 2) + if (selection.clicks < 2) return; /* Go away: we only handle double clicks */ if (dirn == UP) { @@ -3454,7 +3454,11 @@ selection_extend_colrow(int col, int row, int button3, int buttonpress, int clic } else if (selection.clicks == 3) { if (ROWCOL_IS_AFTER(selection.mark, selection.beg)) selection.mark.col++; - selection.beg.col = 0; + if (Options & Opt_cutToBeginningOfLine) { + selection_delimit_word(UP, &(selection.beg), &(selection.beg)); + } else { + selection.beg.col = 0; + } selection.end.col = TermWin.bcol; } if (button3 && buttonpress) { /* mark may need to be changed */ diff --git a/src/scrollbar.c b/src/scrollbar.c index 57d9543..cebc671 100644 --- a/src/scrollbar.c +++ b/src/scrollbar.c @@ -29,7 +29,7 @@ */ -#include "rxvt.h" /* NECESSARY */ +#include "pixmap.h" /* NECESSARY */ /*----------------------------------------------------------------------* */ diff --git a/src/xdefaults.c b/src/xdefaults.c index 8ec9b25..1f02f48 100644 --- a/src/xdefaults.c +++ b/src/xdefaults.c @@ -70,6 +70,7 @@ static const char *rs_mapAlert = NULL; #endif static const char *rs_visualBell = NULL; static const char *rs_reverseVideo = NULL; +static const char *rs_cutToBeginningOfLine = NULL; #ifdef META8_OPTION static const char *rs_meta8 = NULL; @@ -327,6 +328,8 @@ static const struct { BOOL(rs_utmpInhibit, "utmpInhibit", "ut", Opt_utmpInhibit, "utmp inhibit"), BOOL(rs_visualBell, "visualBell", "vb", Opt_visualBell, "visual bell"), + BOOL(rs_cutToBeginningOfLine, "cutToBeginningOfLine", "cb", Opt_cutToBeginningOfLine, + "cut to beginning of line"), #ifndef NO_MAPALERT # ifdef MAPALERT_OPTION @@ -395,6 +398,9 @@ list_options() #ifdef UTMP_SUPPORT fprintf(stderr, "utmp,"); #endif +#ifdef HAVE_UTEMPTER + fprintf(stderr, "utempter,"); +#endif #ifdef MENUBAR fprintf(stderr, "menubar,"); #endif @@ -547,7 +553,7 @@ usage(int type) #ifdef KEYSYM_RESOURCE fprintf(stderr, " " "keysym.sym" ": %*s\n", - (INDENT - strlen("keysym.sym")), "keysym"); + (INDENT - (int)strlen("keysym.sym")), "keysym"); #endif fprintf(stderr, "\n -help to list options\n -version for the version information with options list\n\n"); break; @@ -871,8 +877,12 @@ get_xdefaults(FILE * stream, const char *name) s = !s; if (s) Options |= (optList[entry].flag); - else + else { + if (my_strcasecmp(str, "FALSE")) + print_error("Cannot parse value \"%s\" from resource \"%s\" as boolean", + str, kw); Options &= ~(optList[entry].flag); + } } } break; @@ -954,8 +964,12 @@ extract_resources(Display * display, const char *name) s = !s; if (s) Options |= (optList[entry].flag); - else + else { + if (my_strcasecmp(p, "FALSE")) + print_error("Cannot parse value \"%s\" from resource \"%s\" as boolean", + p, kw); Options &= ~(optList[entry].flag); + } } } }