From 0266d95d878068aa81f4242948dd05bc5fc4f151 Mon Sep 17 00:00:00 2001 From: Michael Jennings Date: Sun, 25 Oct 2009 21:10:48 +0000 Subject: [PATCH] Sun Oct 25 14:10:47 2009 Michael Jennings (mej) Merge. ---------------------------------------------------------------------- SVN revision: 43286 --- ChangeLog | 31 ++++++++++++++++++++++++++ configure.ac | 7 ++++++ src/command.c | 17 +++++++++----- src/font.c | 24 +++++++++++++++----- src/font.h | 14 +++++++----- src/options.c | 6 ++++- src/screen.c | 62 +++++++++++++++++++++++++++++++++++++-------------- src/utmp.c | 19 ++++++++-------- src/windows.c | 52 ++---------------------------------------- 9 files changed, 139 insertions(+), 93 deletions(-) diff --git a/ChangeLog b/ChangeLog index 796b439..3b6b947 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5704,3 +5704,34 @@ Sun Oct 25 12:12:06 2009 Michael Jennings (mej) Fix some bad replacements. ---------------------------------------------------------------------- +Sun Oct 25 12:29:32 2009 Michael Jennings (mej) + +Re-enable SIGPIPE after fork() for child processes who might not +re-enable it on their own. Pointed out by Sylvain Martin +. +---------------------------------------------------------------------- +Sun Oct 25 12:36:01 2009 Michael Jennings (mej) + +Patch for FreeBSD UNIX98 pty support from Ed Schouten . +---------------------------------------------------------------------- +Sun Oct 25 12:39:34 2009 Michael Jennings (mej) + +Fix for scrolling limitations from Cliff Miller . +---------------------------------------------------------------------- +Sun Oct 25 13:52:40 2009 Michael Jennings (mej) + +Support font effects in 8 directions. Patch supplied by Joern +Bernhardt . +---------------------------------------------------------------------- +Sun Oct 25 14:02:14 2009 Michael Jennings (mej) + +Revert bad change to borderless code. We're now doing best effort +borderless with no override_redirect (which may come back some day as +a separate option if there's a need) based on advice from raster and +kwo. +---------------------------------------------------------------------- +Sun Oct 25 14:07:07 2009 Michael Jennings (mej) + +Fix off-by-one error that was causing crashes with visual bell. Found +by d_willsc@cojobo.bonn.de. +---------------------------------------------------------------------- diff --git a/configure.ac b/configure.ac index 477a5ae..d476a31 100644 --- a/configure.ac +++ b/configure.ac @@ -258,6 +258,9 @@ AC_ARG_WITH(debugging, [ --with-debugging[=num] enable debugging output, num i AC_DEFINE_UNQUOTED(DEBUG, 4, [Debugging level to compile in.]) ]) +AC_CHECK_FUNC(posix_openpt, + HAVE_POSIX_OPENPT=yes + ) AC_CHECK_FUNC(ptsname, HAVE_PTSNAME=yes ) @@ -270,6 +273,10 @@ AC_CHECK_FUNC(unlockpt, dnl# Check for the appropriate pty mechanism AC_MSG_CHECKING(for pty mechanism) PTY_MECH="" +if test ! -z "$HAVE_POSIX_OPENPT" -a ! -z "$HAVE_PTSNAME" -a ! -z "$HAVE_GRANTPT" -a ! -z "$HAVE_UNLOCKPT"; then + AC_DEFINE(HAVE_POSIX_OPENPT, , [Define for posix_openpt() support.]) + PTY_MECH="POSIX $PTY_MECH" +fi if test -c /dev/ptc ; then AC_DEFINE(HAVE_DEV_PTC, , [Define for /dev/ptc support.]) PTY_MECH="AIX $PTY_MECH" diff --git a/src/command.c b/src/command.c index ef4119b..f0b4481 100644 --- a/src/command.c +++ b/src/command.c @@ -1388,17 +1388,21 @@ sco_get_pty(void) } #endif -#ifdef HAVE_DEV_PTMX -inline int svr_get_pty(void); +#if defined(HAVE_POSIX_OPENPT) || defined(HAVE_DEV_PTMX) +inline int posix_get_pty(void); inline int -svr_get_pty(void) +posix_get_pty(void) { int fd = -1; /* open the STREAMS, clone device /dev/ptmx (master pty) */ +#if defined(HAVE_POSIX_OPENPT) + if ((fd = posix_openpt(O_RDWR|O_NOCTTY)) < 0) { +#else if ((fd = open("/dev/ptmx", O_RDWR)) < 0) { +#endif return (-1); } else { if (grantpt(fd) != 0) { @@ -1457,12 +1461,12 @@ get_pty(void) int fd = -1; -#if defined(__sgi) +#if defined(HAVE_POSIX_OPENPT) || defined(HAVE_DEV_PTMX) + fd = posix_get_pty(); +#elif defined(__sgi) fd = sgi_get_pty(); #elif defined(HAVE_DEV_PTC) fd = aix_get_pty(); -#elif defined(HAVE_DEV_PTMX) - fd = svr_get_pty(); #elif defined(HAVE_SCO_PTYS) fd = sco_get_pty(); #endif @@ -2306,6 +2310,7 @@ run_command(char **argv) signal(SIGILL, SIG_DFL); signal(SIGSYS, SIG_DFL); signal(SIGALRM, SIG_DFL); + signal(SIGPIPE, SIG_DFL); #ifdef SIGTSTP signal(SIGTSTP, SIG_IGN); signal(SIGTTIN, SIG_IGN); diff --git a/src/font.c b/src/font.c index 17f8fd9..55efbce 100644 --- a/src/font.c +++ b/src/font.c @@ -52,7 +52,7 @@ const char *def_mfontName[] = { MFONT0, MFONT1, MFONT2, MFONT3, MFONT4 }; #endif const char *def_fontName[] = { FONT0, FONT1, FONT2, FONT3, FONT4 }; unsigned char font_chg = 0; -fontshadow_t fshadow = { {0, 0, 0, 0}, {0, 0, 0, 1}, 1 }; +fontshadow_t fshadow = { {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 1}, 1 }; static cachefont_t *font_cache = NULL, *cur_font = NULL; static void font_cache_add(const char *name, unsigned char type, void *info); @@ -689,10 +689,18 @@ get_corner(const char *corner) { if (!BEG_STRCASECMP(corner, "tl ") || !BEG_STRCASECMP(corner, "top_left")) { return SHADOW_TOP_LEFT; + } else if (!BEG_STRCASECMP(corner, "t ") || !BEG_STRCASECMP(corner, "top")) { + return SHADOW_TOP; } else if (!BEG_STRCASECMP(corner, "tr ") || !BEG_STRCASECMP(corner, "top_right")) { return SHADOW_TOP_RIGHT; + } else if (!BEG_STRCASECMP(corner, "l ") || !BEG_STRCASECMP(corner, "left")) { + return SHADOW_LEFT; + } else if (!BEG_STRCASECMP(corner, "r ") || !BEG_STRCASECMP(corner, "right")) { + return SHADOW_RIGHT; } else if (!BEG_STRCASECMP(corner, "bl ") || !BEG_STRCASECMP(corner, "bottom_left")) { return SHADOW_BOTTOM_LEFT; + } else if (!BEG_STRCASECMP(corner, "b ") || !BEG_STRCASECMP(corner, "bottom")) { + return SHADOW_BOTTOM; } else if (!BEG_STRCASECMP(corner, "br ") || !BEG_STRCASECMP(corner, "bottom_right")) { return SHADOW_BOTTOM_RIGHT; } else { @@ -705,7 +713,7 @@ set_shadow_color_by_name(unsigned char which, const char *color_name) { Pixel p; - ASSERT(which <= 4); + ASSERT(which <= 7); // which = 0-7 [SHADOW_TOP_LEFT - SHADOW_BOTTOM_RIGHT] p = get_color_by_name(color_name, "#000000"); fshadow.color[which] = p; @@ -715,7 +723,7 @@ set_shadow_color_by_name(unsigned char which, const char *color_name) void set_shadow_color_by_pixel(unsigned char which, Pixel p) { - ASSERT(which <= 4); + ASSERT(which <= 7); // which = 0-7 [SHADOW_TOP_LEFT - SHADOW_BOTTOM_RIGHT] fshadow.color[which] = p; fshadow.shadow[which] = fshadow.do_shadow = 1; @@ -751,7 +759,7 @@ parse_font_fx(char *line) color = spiftool_get_word(2, line); p = get_color_by_name(color, "black"); FREE(color); - for (which = 0; which < 4; which++) { + for (which = 0; which < 8; which++) { set_shadow_color_by_pixel(which, p); } } else if (!BEG_STRCASECMP(line, "shadow")) { @@ -762,8 +770,10 @@ parse_font_fx(char *line) color = spiftool_get_word(3, line); corner = spiftool_get_pword(2, line); which = get_corner(corner); - if (which >= 4) { + if (which >= 8) { return 0; + } else if (which != SHADOW_BOTTOM_RIGHT) { + fshadow.shadow[SHADOW_BOTTOM_RIGHT] = 0; } } else { return 0; @@ -776,12 +786,14 @@ parse_font_fx(char *line) } color = spiftool_get_word(2, line); p = get_color_by_name(color, "black"); + set_shadow_color_by_pixel(SHADOW_BOTTOM, p); set_shadow_color_by_pixel(SHADOW_BOTTOM_RIGHT, p); FREE(color); color = spiftool_get_word(3, line); p = get_color_by_name(color, "white"); set_shadow_color_by_pixel(SHADOW_TOP_LEFT, p); + set_shadow_color_by_pixel(SHADOW_TOP, p); FREE(color); } else if (!BEG_STRCASECMP(line, "carved")) { if (n != 3) { @@ -790,10 +802,12 @@ parse_font_fx(char *line) color = spiftool_get_word(2, line); p = get_color_by_name(color, "black"); set_shadow_color_by_pixel(SHADOW_TOP_LEFT, p); + set_shadow_color_by_pixel(SHADOW_TOP, p); FREE(color); color = spiftool_get_word(3, line); p = get_color_by_name(color, "white"); + set_shadow_color_by_pixel(SHADOW_BOTTOM, p); set_shadow_color_by_pixel(SHADOW_BOTTOM_RIGHT, p); FREE(color); } else { diff --git a/src/font.h b/src/font.h index 6d6e865..6704497 100644 --- a/src/font.h +++ b/src/font.h @@ -104,9 +104,13 @@ extern spif_classname_t spif_eterm_font_type(spif_eterm_font_t); /* These are subscripts for the arrays in a fontshadow_t */ #define SHADOW_TOP_LEFT 0 -#define SHADOW_TOP_RIGHT 1 -#define SHADOW_BOTTOM_LEFT 2 -#define SHADOW_BOTTOM_RIGHT 3 +#define SHADOW_TOP 1 +#define SHADOW_TOP_RIGHT 2 +#define SHADOW_LEFT 3 +#define SHADOW_RIGHT 4 +#define SHADOW_BOTTOM_LEFT 5 +#define SHADOW_BOTTOM 6 +#define SHADOW_BOTTOM_RIGHT 7 /* The macros are used to advance to the next/previous font as with Ctrl-> and Ctrl-< */ #define NEXT_FONT(i) do { if (font_idx + ((i)?(i):1) >= font_cnt) {font_idx = font_cnt - 1;} else {font_idx += ((i)?(i):1);} \ @@ -129,8 +133,8 @@ typedef struct cachefont_struct { } cachefont_t; typedef struct fontshadow_struct { - Pixel color[4]; - unsigned char shadow[4]; + Pixel color[8]; + unsigned char shadow[8]; unsigned char do_shadow; } fontshadow_t; diff --git a/src/options.c b/src/options.c index 32d7471..1f1151a 100644 --- a/src/options.c +++ b/src/options.c @@ -3266,14 +3266,18 @@ save_config(char *path, unsigned char save_theme) if (fshadow.do_shadow) { const char *corners[] = { "top_left", + "top", "top_right", + "left", + "right", "bottom_left", + "bottom", "bottom_right" }; unsigned char shad = 0; fprintf(fp, " font effects"); - for (i = 0; i < 4; i++) { + for (i = 0; i < 8; i++) { if (fshadow.shadow[i]) { fprintf(fp, " %s 0x%08x", corners[i], (unsigned int) fshadow.color[i]); shad = 1; diff --git a/src/screen.c b/src/screen.c index 1aac33c..6a6c579 100644 --- a/src/screen.c +++ b/src/screen.c @@ -389,7 +389,7 @@ scr_poweron(void) /* * Save and Restore cursor - * XTERM_SEQ: Save cursor : ESC 7 + * XTERM_SEQ: Save cursor : ESC 7 * XTERM_SEQ: Restore cursor: ESC 8 */ void @@ -1329,7 +1329,7 @@ scr_rvideo_mode(int mode) maxlines = TermWin.saveLines + TERM_WINDOW_GET_REPORTED_ROWS(); for (i = TermWin.saveLines; i < maxlines; i++) - for (j = 0; j < TERM_WINDOW_GET_REPORTED_COLS() + 1; j++) + for (j = 0; j < TERM_WINDOW_GET_REPORTED_COLS(); j++) screen.rend[i][j] ^= RS_RVid; scr_refresh(SLOW_REFRESH); } @@ -1543,7 +1543,7 @@ scr_page(int direction, int nlines) D_SCREEN(("scr_page(%s, %d) view_start:%d\n", ((direction == UP) ? "UP" : "DN"), nlines, TermWin.view_start)); start = TermWin.view_start; - BOUND(nlines, 1, TERM_WINDOW_GET_REPORTED_ROWS()); + BOUND(nlines, 1, TermWin.nscrolled); TermWin.view_start += ((direction == UP) ? nlines : (-nlines)); BOUND(TermWin.view_start, 0, TermWin.nscrolled); return (TermWin.view_start - start); @@ -2014,11 +2014,11 @@ scr_refresh(int type) ww = Width2Pixel(wlen); hh = Height2Pixel(1); CLEAR_CHARS(xpixel, ypixel - ascent, len); - if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_TOP_RIGHT]) { + if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_TOP] || fshadow.shadow[SHADOW_TOP_RIGHT]) { yy--; hh++; } - if (fshadow.shadow[SHADOW_BOTTOM_LEFT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT]) { + if (fshadow.shadow[SHADOW_BOTTOM_LEFT] || fshadow.shadow[SHADOW_BOTTOM] || fshadow.shadow[SHADOW_BOTTOM_RIGHT]) { hh++; if (row < nrows - 1) { int ii; @@ -2035,6 +2035,13 @@ scr_refresh(int type) dtp[col - 1] = 0; } } + if (fshadow.shadow[SHADOW_TOP]) { + XSetForeground(Xdisplay, TermWin.gc, fshadow.color[SHADOW_TOP]); + DRAW_STRING(draw_string, xpixel, ypixel - 1, buffer, wlen); + if (col) { + dtp[col] = 0; + } + } if (fshadow.shadow[SHADOW_TOP_RIGHT]) { XSetForeground(Xdisplay, TermWin.gc, fshadow.color[SHADOW_TOP_RIGHT]); DRAW_STRING(draw_string, xpixel + 1, ypixel - 1, buffer, wlen); @@ -2042,6 +2049,20 @@ scr_refresh(int type) dtp[col + 1] = 0; } } + if (fshadow.shadow[SHADOW_LEFT]) { + XSetForeground(Xdisplay, TermWin.gc, fshadow.color[SHADOW_LEFT]); + DRAW_STRING(draw_string, xpixel - 1, ypixel, buffer, wlen); + if (col) { + dtp[col - 1] = 0; + } + } + if (fshadow.shadow[SHADOW_RIGHT]) { + XSetForeground(Xdisplay, TermWin.gc, fshadow.color[SHADOW_RIGHT]); + DRAW_STRING(draw_string, xpixel + 1, ypixel, buffer, wlen); + if (col < ncols - 1) { + dtp[col + 1] = 0; + } + } if (fshadow.shadow[SHADOW_BOTTOM_LEFT]) { XSetForeground(Xdisplay, TermWin.gc, fshadow.color[SHADOW_BOTTOM_LEFT]); DRAW_STRING(draw_string, xpixel - 1, ypixel + 1, buffer, wlen); @@ -2049,6 +2070,13 @@ scr_refresh(int type) dtp[col - 1] = 0; } } + if (fshadow.shadow[SHADOW_BOTTOM]) { + XSetForeground(Xdisplay, TermWin.gc, fshadow.color[SHADOW_BOTTOM]); + DRAW_STRING(draw_string, xpixel, ypixel + 1, buffer, wlen); + if (col) { + dtp[col] = 0; + } + } if (fshadow.shadow[SHADOW_BOTTOM_RIGHT]) { XSetForeground(Xdisplay, TermWin.gc, fshadow.color[SHADOW_BOTTOM_RIGHT]); DRAW_STRING(draw_string, xpixel + 1, ypixel + 1, buffer, wlen); @@ -2163,37 +2191,37 @@ scr_refresh(int type) D_SCREEN(("Update box dimensions: from (%d, %d) to (%d, %d). Dimensions %dx%d\n", low_x, low_y, high_x, high_y, high_x - low_x + 1, high_y - low_y + 1)); XClearArea(Xdisplay, TermWin.vt, low_x, low_y, high_x - low_x + 1, high_y - low_y + 1, False); - if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_BOTTOM_LEFT]) { + if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_LEFT] || fshadow.shadow[SHADOW_BOTTOM_LEFT]) { XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, TermWin.internalBorder - 1, 0, 1, TermWin_TotalHeight() - 1, TermWin.internalBorder - 1, 0); XClearArea(Xdisplay, TermWin.vt, TermWin.internalBorder - 1, 0, 1, TermWin_TotalHeight() - 1, False); } - if (fshadow.shadow[SHADOW_TOP_RIGHT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT] || boldlast) { + if (fshadow.shadow[SHADOW_TOP_RIGHT] || fshadow.shadow[SHADOW_RIGHT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT] || boldlast) { XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, TermWin_TotalWidth() - 2, 0, 1, TermWin_TotalHeight() - 1, TermWin_TotalWidth() - 2, 0); XClearArea(Xdisplay, TermWin.vt, TermWin_TotalWidth() - 2, 0, 1, TermWin_TotalHeight() - 1, False); } - if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_TOP_RIGHT]) { + if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_TOP] || fshadow.shadow[SHADOW_TOP_RIGHT]) { XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, 0, TermWin.internalBorder - 1, TermWin_TotalWidth() - 1, 1, 0, TermWin.internalBorder - 1); XClearArea(Xdisplay, TermWin.vt, 0, TermWin.internalBorder - 1, TermWin_TotalWidth() - 1, 1, False); } - if (fshadow.shadow[SHADOW_BOTTOM_LEFT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT]) { + if (fshadow.shadow[SHADOW_BOTTOM_LEFT] || fshadow.shadow[SHADOW_BOTTOM] || fshadow.shadow[SHADOW_BOTTOM_RIGHT]) { XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, 0, TermWin_TotalHeight() - TermWin.internalBorder, TermWin_TotalWidth() - 1, 1, 0, TermWin_TotalHeight() - TermWin.internalBorder); XClearArea(Xdisplay, TermWin.vt, 0, TermWin_TotalHeight() - TermWin.internalBorder, TermWin_TotalWidth() - 1, 1, False); } } else { - if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_BOTTOM_LEFT]) { + if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_LEFT] || fshadow.shadow[SHADOW_BOTTOM_LEFT]) { XClearArea(Xdisplay, TermWin.vt, TermWin.internalBorder - 1, 0, 1, TermWin_TotalHeight() - 1, False); } - if ((fshadow.shadow[SHADOW_TOP_RIGHT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT] || boldlast) && TermWin.internalBorder) { + if ((fshadow.shadow[SHADOW_TOP_RIGHT] || fshadow.shadow[SHADOW_RIGHT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT] || boldlast) && TermWin.internalBorder) { XClearArea(Xdisplay, TermWin.vt, TermWin_TotalWidth() - 2, 0, 1, TermWin_TotalHeight() - 1, False); } - if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_TOP_RIGHT]) { + if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_TOP] || fshadow.shadow[SHADOW_TOP_RIGHT]) { XClearArea(Xdisplay, TermWin.vt, 0, TermWin.internalBorder - 1, TermWin_TotalWidth() - 1, 1, False); } - if (fshadow.shadow[SHADOW_BOTTOM_LEFT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT]) { + if (fshadow.shadow[SHADOW_BOTTOM_LEFT] || fshadow.shadow[SHADOW_BOTTOM] || fshadow.shadow[SHADOW_BOTTOM_RIGHT]) { XClearArea(Xdisplay, TermWin.vt, 0, TermWin_TotalHeight() - TermWin.internalBorder, TermWin_TotalWidth() - 1, 1, False); } } @@ -2704,7 +2732,7 @@ selection_start_colrow(int col, int row) selection.mark.row = row; } -/* +/* * Copy a selection into the cut buffer * EXT: button 1 or 3 release */ @@ -3242,7 +3270,7 @@ selection_extend_colrow(int col, int row, int flag, int cont) D_SELECT(("(c:%d,r:%d)-(c:%d,r:%d) old (c:%d,r:%d)-(c:%d,r:%d)\n", selection.beg.col, selection.beg.row, selection.end.col, selection.end.row, old_beg.col, old_beg.row, old_end.col, old_end.row)); -/* +/* * B1: clear anything before the current selection */ if ((old_beg.row < selection.beg.row) || (old_beg.row == selection.beg.row && old_beg.col < selection.beg.col)) { @@ -3255,7 +3283,7 @@ selection_extend_colrow(int col, int row, int flag, int cont) } selection_setclr(0, old_beg.row, old_beg.col, row, col); } -/* +/* * B2: clear anything after the current selection */ if ((old_end.row > selection.end.row) || (old_end.row == selection.end.row && old_end.col > selection.end.col)) { @@ -3268,7 +3296,7 @@ selection_extend_colrow(int col, int row, int flag, int cont) } selection_setclr(0, row, col, old_end.row, old_end.col); } -/* +/* * B3: set everything */ /* TODO: optimise this */ diff --git a/src/utmp.c b/src/utmp.c index 8136eb0..f946514 100644 --- a/src/utmp.c +++ b/src/utmp.c @@ -38,9 +38,9 @@ static const char cvs_ident[] = "$Id$"; # endif /* don't go off end of ut_id & remember if an entry has been made */ -# if defined(USE_SYSV_UTMP) || defined(NEW_BSD_UTMP) || defined(__OpenBSD__) +# if defined(USE_SYSV_UTMP) || defined(__OpenBSD__) static char ut_id[5]; /* remember if entry to utmp made */ -# else +# elif !defined(NEW_BSD_UTMP) static int utmp_pos; /* BSD position of utmp-stamp */ # endif @@ -340,13 +340,6 @@ add_utmp_entry(const char *pty, const char *hostname, int fd) if (!strncmp(pty, "/dev/", 5)) pty += 5; /* skip /dev/ prefix */ - if (!strncmp(pty, "pty", 3) || !strncmp(pty, "tty", 3)) - strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */ - else { - libast_print_error("can't parse tty name \"%s\"\n", pty); - ut_id[0] = '\0'; /* entry not made */ - return; - } # ifdef NEW_BSD_UTMP strncpy(ut_line, pty, 31); @@ -358,6 +351,14 @@ add_utmp_entry(const char *pty, const char *hostname, int fd) b_login(&utmp); # else /* NEW_BSD_UTMP */ + if (!strncmp(pty, "pty", 3) || !strncmp(pty, "tty", 3)) + strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */ + else { + libast_print_error("can't parse tty name \"%s\"\n", pty); + ut_id[0] = '\0'; /* entry not made */ + return; + } + strncpy(utmp.ut_line, ut_id, sizeof(utmp.ut_line)); strncpy(utmp.ut_name, pwent->pw_name, sizeof(utmp.ut_name)); strncpy(utmp.ut_host, hostname, sizeof(utmp.ut_host)); diff --git a/src/windows.c b/src/windows.c index 3601ebb..a9cff63 100644 --- a/src/windows.c +++ b/src/windows.c @@ -363,48 +363,6 @@ set_pointer_colors(const char *fg_name, const char *bg_name) XRecolorCursor(Xdisplay, TermWin_cursor, &fg, &bg); } -int -check_mwm_supported(void) -{ - Atom prop, mwm_prop, type_ret; - unsigned char *prop_ret; - unsigned long bytes_after, num_ret; - int format_ret, num, i, supported = 0; - - /* check whether wm support mwm hint */ - prop = XInternAtom(Xdisplay, "_NET_SUPPORTED", True); - mwm_prop = XInternAtom(Xdisplay, "_MOTIF_WM_HINTS", True); - - if ((prop != None) && (mwm_prop != None)) { - prop_ret = NULL; - if (XGetWindowProperty(Xdisplay, Xroot, prop, 0, 0x7fffffff, False, - XA_ATOM, &type_ret, &format_ret, &num_ret, - &bytes_after, &prop_ret) == Success) { - - if ((type_ret == XA_ATOM) && - (format_ret == 32) && - (num_ret && prop_ret)) { - for (i = 0; i < num_ret; i++) { - if (mwm_prop == ((unsigned long*)prop_ret)[i]) { - supported = 1; - break; - } - } - } - if (prop_ret) - XFree(prop_ret); - } - } - /* check whether wm is mwm */ - if (!supported) { - prop = XInternAtom(Xdisplay, "_MOTIF_WM_INFO", True); - if (prop != None) { - supported = 1; - } - } - return supported; -} - /* Create_Windows() - Open and map the window */ void Create_Windows(int argc, char *argv[]) @@ -420,14 +378,8 @@ Create_Windows(int argc, char *argv[]) MWMHints mwmhints; if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_BORDERLESS)) { - if (check_mwm_supported()) { - mwmhints.flags = MWM_HINTS_DECORATIONS; - mwmhints.decorations = 0; - } else { - libast_print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n"); - Attributes.override_redirect = TRUE; - mwmhints.flags = 0; - } + mwmhints.flags = MWM_HINTS_DECORATIONS; + mwmhints.decorations = 0; } else { mwmhints.flags = 0; }