Mon Oct 11 15:54:52 PDT 1999 Michael Jennings <mej@eterm.org>
Lots of cleanups here, including a couple fixes for bugs noticed by Tom Gilbert <gilbertt@tomgilbert.freeserve.co.uk> and Martin Tyler <martin@boo.org>. Also removed the requirement of glibc 2.1 for using SVR4-style pty's (/dev/pts/*) under Linux. SVN revision: 798
This commit is contained in:
parent
11b7b87dad
commit
332269133d
|
@ -2562,3 +2562,11 @@ Fri Oct 8 15:31:49 PDT 1999 Michael Jennings <mej@eterm.org>
|
|||
I hope it does anyway).
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Mon Oct 11 15:54:52 PDT 1999 Michael Jennings <mej@eterm.org>
|
||||
|
||||
Lots of cleanups here, including a couple fixes for bugs noticed by
|
||||
Tom Gilbert <gilbertt@tomgilbert.freeserve.co.uk> and Martin Tyler
|
||||
<martin@boo.org>. Also removed the requirement of glibc 2.1 for using
|
||||
SVR4-style pty's (/dev/pts/*) under Linux.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
|
@ -290,9 +290,9 @@
|
|||
#undef HAVE_X_SHAPE_EXT
|
||||
|
||||
/* Support for various features */
|
||||
#undef USE_ACTIVE_TAGS
|
||||
#undef USE_POSIX_THREADS
|
||||
#undef MUTEX_SYNCH
|
||||
#undef HAVE_DEV_PTC
|
||||
#undef HAVE_DEV_PTMX
|
||||
#undef HAVE_SCO_PTYS
|
||||
#undef PIXMAP_SUPPORT
|
||||
#undef PIXMAP_OFFSET
|
||||
#undef BACKING_STORE
|
||||
|
|
26
configure.in
26
configure.in
|
@ -155,6 +155,9 @@ AC_CHECK_FUNC(logout,
|
|||
))
|
||||
AC_CHECK_FUNC(getpwuid, , AC_CHECK_LIB(sun, getpwuid, LIBS="$LIBS -lsun"))
|
||||
|
||||
dnl#
|
||||
dnl# Utility stuff
|
||||
dnl#
|
||||
dnl# Did they want debugging?
|
||||
AC_MSG_CHECKING(for debugging level)
|
||||
AC_ARG_WITH(debugging, [ --with-debugging[=num] enable debugging output, num is an optional level],
|
||||
|
@ -172,6 +175,27 @@ AC_ARG_WITH(debugging, [ --with-debugging[=num] enable debugging output, num i
|
|||
AC_DEFINE_UNQUOTED(DEBUG, 4)
|
||||
)
|
||||
|
||||
dnl# Check for the appropriate pty mechanism
|
||||
AC_MSG_CHECKING(for pty mechanism)
|
||||
PTY_MECH=""
|
||||
if test -e /dev/ptc ; then
|
||||
AC_DEFINE(HAVE_DEV_PTC)
|
||||
PTY_MECH="AIX $PTY_MECH"
|
||||
fi
|
||||
if test -e /dev/ptmx ; then
|
||||
AC_DEFINE(HAVE_DEV_PTMX)
|
||||
PTY_MECH="SVR4 $PTY_MECH"
|
||||
fi
|
||||
if test -e /dev/ptyp128 ; then
|
||||
AC_DEFINE(HAVE_SCO_PTYS)
|
||||
PTY_MECH="SCO $PTY_MECH"
|
||||
fi
|
||||
if test "X$PTY_MECH" = "X"; then
|
||||
AC_MSG_RESULT(generic pty's only)
|
||||
else
|
||||
AC_MSG_RESULT($PTY_MECH)
|
||||
fi
|
||||
|
||||
dnl#
|
||||
dnl# FEATURES
|
||||
dnl#
|
||||
|
@ -184,7 +208,6 @@ AC_ARG_WITH(imlib,
|
|||
GRLIBS="-lImlib"
|
||||
AC_DEFINE(PIXMAP_SUPPORT)
|
||||
AC_DEFINE(PIXMAP_SCROLLBAR)
|
||||
AC_DEFINE(PIXMAP_MENUBAR)
|
||||
AC_DEFINE(BACKING_STORE)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
|
@ -193,7 +216,6 @@ AC_ARG_WITH(imlib,
|
|||
GRLIBS="-lImlib"
|
||||
AC_DEFINE(PIXMAP_SUPPORT)
|
||||
AC_DEFINE(PIXMAP_SCROLLBAR)
|
||||
AC_DEFINE(PIXMAP_MENUBAR)
|
||||
AC_DEFINE(BACKING_STORE)
|
||||
)
|
||||
AC_MSG_CHECKING(for transparency support)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
lib_LTLIBRARIES = libEterm.la
|
||||
|
||||
libEterm_la_SOURCES = actions.c command.c e.c events.c font.c graphics.c grkelot.c menus.c misc.c netdisp.c \
|
||||
options.c pixmap.c screen.c scrollbar.c startup.c system.c term.c threads.c timer.c utmp.c windows.c
|
||||
options.c pixmap.c screen.c scrollbar.c startup.c system.c term.c timer.c utmp.c windows.c
|
||||
libEterm_la_DEPENDENCIES = $(top_builddir)/libmej/libmej.la feature.h
|
||||
libEterm_la_LDFLAGS = -version-info 9:0:9
|
||||
|
||||
|
@ -16,5 +16,5 @@ INCLUDES = -I. -I$(top_srcdir) -I$(top_srcdir)/libmej -I.. -I$(includedir) -I$(p
|
|||
LDADD = libEterm.la $(top_builddir)/libmej/libmej.la -L$(libdir) -L$(prefix)/lib $(LIBS) $(GRLIBS) $(X_LIBS)
|
||||
|
||||
EXTRA_DIST = actions.h command.h debug.h e.h eterm_utmp.h events.h feature.h font.h graphics.h grkelot.h grx.h menus.h misc.h options.h \
|
||||
pixmap.h profile.h screen.h scrollbar.h startup.h system.h term.h threads.h timer.h windows.h graphics/Makefile.am \
|
||||
pixmap.h profile.h screen.h scrollbar.h startup.h system.h term.h timer.h windows.h graphics/Makefile.am \
|
||||
graphics/Makefile.in graphics/README graphics/data graphics/grxlib.c graphics/grxlib.h graphics/qplot.c Eterm.xpm
|
||||
|
|
|
@ -133,9 +133,6 @@ static const char cvs_ident[] = "$Id$";
|
|||
#include "scrollbar.h"
|
||||
#include "string.h"
|
||||
#include "term.h"
|
||||
#ifdef USE_POSIX_THREADS
|
||||
# include "threads.h"
|
||||
#endif
|
||||
#ifdef UTMP_SUPPORT
|
||||
# include "eterm_utmp.h"
|
||||
#endif
|
||||
|
@ -1117,14 +1114,6 @@ clean_exit(void)
|
|||
cleanutent();
|
||||
#endif
|
||||
privileges(REVERT);
|
||||
#ifdef USE_POSIX_THREADS
|
||||
/* Get rid of threads if there are any running. Doesn't work yet. */
|
||||
# if 0
|
||||
D_THREADS(("pthread_kill_other_threads_np();\n"));
|
||||
pthread_kill_other_threads_np();
|
||||
D_THREADS(("pthread_exit();\n"));
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Acquire a pseudo-teletype from the system. */
|
||||
|
@ -1149,7 +1138,7 @@ sgi_get_pty(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef _AIX
|
||||
#ifdef HAVE_DEV_PTC
|
||||
inline int
|
||||
aix_get_pty(void)
|
||||
{
|
||||
|
@ -1164,7 +1153,7 @@ aix_get_pty(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef ALL_NUMERIC_PTYS
|
||||
#ifdef HAVE_SCO_PTYS
|
||||
inline int
|
||||
sco_get_pty(void)
|
||||
{
|
||||
|
@ -1196,7 +1185,7 @@ sco_get_pty(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined (__svr4__) || defined(__CYGWIN32__) || ((__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1))
|
||||
#ifdef HAVE_DEV_PTMX
|
||||
inline int
|
||||
svr_get_pty(void)
|
||||
{
|
||||
|
@ -1263,13 +1252,11 @@ get_pty(void)
|
|||
|
||||
#if defined(__sgi)
|
||||
fd = sgi_get_pty();
|
||||
#elif defined(_AIX)
|
||||
#elif defined(HAVE_DEV_PTC)
|
||||
fd = aix_get_pty();
|
||||
#elif defined(__svr4__) || defined(__CYGWIN32__)
|
||||
#elif defined(HAVE_DEV_PTMX)
|
||||
fd = svr_get_pty();
|
||||
#elif ((__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1))
|
||||
fd = svr_get_pty();
|
||||
#elif defined(ALL_NUMERIC_PTYS) /* SCO OSr5 */
|
||||
#elif defined(HAVE_SCO_PTYS)
|
||||
fd = sco_get_pty();
|
||||
#endif
|
||||
|
||||
|
@ -2192,11 +2179,6 @@ run_command(char *argv[])
|
|||
privileges(IGNORE);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
D_THREADS(("run_command(): pthread_join(resize_sub_thr)\n"));
|
||||
pthread_join(resize_sub_thr, NULL);
|
||||
#endif
|
||||
|
||||
D_CMD(("run_command() returning\n"));
|
||||
return (ptyfd);
|
||||
}
|
||||
|
@ -2541,9 +2523,7 @@ tt_printf(const unsigned char *fmt,...)
|
|||
tt_write(buf, strlen(buf));
|
||||
}
|
||||
|
||||
#ifndef USE_POSIX_THREADS
|
||||
/* Read and process output from the application */
|
||||
|
||||
void
|
||||
main_loop(void)
|
||||
{
|
||||
|
@ -2623,7 +2603,6 @@ main_loop(void)
|
|||
}
|
||||
} while (ch != EOF);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* output a burst of any pending data from a paste... */
|
||||
int
|
||||
|
|
|
@ -328,15 +328,6 @@ extern char initial_dir[PATH_MAX+1];
|
|||
extern unsigned long PrivateModes;
|
||||
extern Atom wmDeleteWindow;
|
||||
extern int refresh_count, refresh_limit, refresh_type;
|
||||
#ifdef USE_POSIX_THREADS
|
||||
extern static void **retval;
|
||||
extern static int join_value;
|
||||
extern static pthread_t main_loop_thr;
|
||||
extern static pthread_attr_t main_loop_attr;
|
||||
# ifdef MUTEX_SYNCH
|
||||
extern pthread_mutex_t mutex;
|
||||
# endif
|
||||
#endif
|
||||
#ifdef USE_XIM
|
||||
extern XIC Input_Context; /* input context */
|
||||
#endif
|
||||
|
|
|
@ -104,8 +104,6 @@ extern unsigned int debug_level;
|
|||
# define D_ENL(x) DPRINTF2(x)
|
||||
# define DEBUG_SCROLLBAR 2
|
||||
# define D_SCROLLBAR(x) DPRINTF2(x)
|
||||
# define DEBUG_THREADS 2
|
||||
# define D_THREADS(x) DPRINTF2(x)
|
||||
# define DEBUG_TIMER 2
|
||||
# define D_TIMER(x) DPRINTF2(x)
|
||||
|
||||
|
|
|
@ -410,7 +410,7 @@ handle_configure_notify(event_t * ev)
|
|||
REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &primary_data), 0);
|
||||
|
||||
while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, ConfigureNotify, &unused_xevent));
|
||||
resize_window();
|
||||
handle_external_resize();
|
||||
#ifdef USE_XIM
|
||||
xim_set_status_position();
|
||||
#endif
|
||||
|
|
|
@ -64,10 +64,6 @@
|
|||
# undef HAVE_SYS_IOCTL_H
|
||||
# endif
|
||||
|
||||
# ifdef _SCO_DS /* SCO Osr5 */
|
||||
# define ALL_NUMERIC_PTYS /* Scos pty naming is /dev/[pt]typ0 - /dev/[pt]ty256 */
|
||||
# endif
|
||||
|
||||
/********************* Debugging stuff *********************/
|
||||
/* As Keith Bunge would say, don't crap with the debugging stuff below
|
||||
* unless you develop this mess. :^) -- mej
|
||||
|
|
|
@ -405,7 +405,7 @@ change_font(int init, const char *fontname)
|
|||
|
||||
if (!init) {
|
||||
font_change_count++;
|
||||
resize();
|
||||
parent_resize();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -525,9 +525,6 @@ version(void)
|
|||
#if DEBUG >= DEBUG_SCROLLBAR
|
||||
printf(" +DEBUG_SCROLLBAR");
|
||||
#endif
|
||||
#if DEBUG >= DEBUG_THREADS
|
||||
printf(" +DEBUG_THREADS");
|
||||
#endif
|
||||
#if DEBUG >= DEBUG_MENU
|
||||
printf(" +DEBUG_MENU");
|
||||
#endif
|
||||
|
@ -573,16 +570,6 @@ version(void)
|
|||
#else
|
||||
printf(" -PIXMAP_SUPPORT");
|
||||
#endif
|
||||
#ifdef USE_POSIX_THREADS
|
||||
printf(" +USE_POSIX_THREADS");
|
||||
#else
|
||||
printf(" -USE_POSIX_THREADS");
|
||||
#endif
|
||||
#ifdef MUTEX_SYNCH
|
||||
printf(" +MUTEX_SYNCH");
|
||||
#else
|
||||
printf(" -MUTEX_SYNCH");
|
||||
#endif
|
||||
#ifdef PIXMAP_OFFSET
|
||||
printf(" +PIXMAP_OFFSET");
|
||||
#else
|
||||
|
|
|
@ -48,9 +48,6 @@ static const char cvs_ident[] = "$Id$";
|
|||
# include "scrollbar.h"
|
||||
#endif
|
||||
#include "term.h"
|
||||
#ifdef USE_POSIX_THREADS
|
||||
# include "threads.h"
|
||||
#endif
|
||||
#include "Eterm.xpm" /* Icon pixmap */
|
||||
|
||||
#ifdef PIXMAP_SUPPORT
|
||||
|
|
|
@ -165,9 +165,6 @@ extern void reset_simage(simage_t *, unsigned long);
|
|||
extern void paste_simage(simage_t *, unsigned char, Window, unsigned short, unsigned short, unsigned short, unsigned short);
|
||||
extern void redraw_image(unsigned char);
|
||||
extern void render_simage(simage_t *, Window, unsigned short, unsigned short, unsigned char, renderop_t);
|
||||
#ifdef USE_POSIX_THREADS
|
||||
extern void init_bg_pixmap_thread(void *);
|
||||
#endif
|
||||
extern const char *search_path(const char *, const char *, const char *);
|
||||
extern unsigned short load_image(const char *, short);
|
||||
extern void free_desktop_pixmap(void);
|
||||
|
|
|
@ -38,9 +38,6 @@ static const char cvs_ident[] = "$Id$";
|
|||
# include "profile.h"
|
||||
#endif
|
||||
#include "term.h"
|
||||
#ifdef USE_POSIX_THREADS
|
||||
# include "threads.h"
|
||||
#endif
|
||||
|
||||
/* This tells what's actually on the screen */
|
||||
static text_t **drawn_text = NULL;
|
||||
|
@ -1822,9 +1819,6 @@ scr_refresh(int type)
|
|||
P_SETTIMEVAL(cnt.start);
|
||||
#endif
|
||||
|
||||
#ifdef USE_POSIX_THREADS
|
||||
check_bg_pixmap();
|
||||
#endif
|
||||
row_offset = TermWin.saveLines - TermWin.view_start;
|
||||
fprop = TermWin.fprop;
|
||||
|
||||
|
|
|
@ -670,6 +670,36 @@ scrollbar_reset(void)
|
|||
scrollBar.init = 0;
|
||||
}
|
||||
|
||||
void
|
||||
scrollbar_resize(int width, int height)
|
||||
{
|
||||
|
||||
if (!scrollbar_visible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
D_SCROLLBAR(("scrollbar_resize(%d, %d)\n", width, height));
|
||||
scrollBar.beg = 0;
|
||||
scrollBar.end = height;
|
||||
#ifdef MOTIF_SCROLLBAR
|
||||
if (scrollBar.type == SCROLLBAR_MOTIF) {
|
||||
/* arrows are as high as wide - leave 1 pixel gap */
|
||||
scrollBar.beg += scrollbar_arrow_height() + scrollbar_get_shadow() + 1;
|
||||
scrollBar.end -= scrollbar_arrow_height() + scrollbar_get_shadow() + 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef NEXT_SCROLLBAR
|
||||
if (scrollBar.type == SCROLLBAR_NEXT) {
|
||||
scrollBar.beg = scrollbar_get_shadow();
|
||||
scrollBar.end -= (scrollBar.width * 2 + (scrollbar_get_shadow() ? scrollbar_get_shadow() : 1) + 2);
|
||||
}
|
||||
#endif
|
||||
width -= scrollbar_trough_width();
|
||||
XMoveResizeWindow(Xdisplay, scrollBar.win, ((Options & Opt_scrollBar_right) ? (width) : (0)), 0, scrollbar_trough_width(), height);
|
||||
scrollBar.init = 0;
|
||||
scrollbar_show(0);
|
||||
}
|
||||
|
||||
unsigned char
|
||||
scrollbar_show(short mouseoffset)
|
||||
{
|
||||
|
@ -677,8 +707,9 @@ scrollbar_show(short mouseoffset)
|
|||
unsigned char xsb = 0, force_update = 0;
|
||||
static int focus = -1;
|
||||
|
||||
if (!scrollbar_visible())
|
||||
if (!scrollbar_visible()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
D_SCROLLBAR(("scrollbar_show(%d)\n", mouseoffset));
|
||||
|
||||
|
@ -733,20 +764,6 @@ scrollbar_show(short mouseoffset)
|
|||
|
||||
focus = TermWin.focus;
|
||||
gcvalue.foreground = PixColors[focus ? scrollColor : unfocusedScrollColor];
|
||||
#if 0
|
||||
# ifdef PIXMAP_OFFSET
|
||||
if (!((Options & Opt_scrollBar_floating) && image_mode_is(image_sb, (MODE_TRANS | MODE_VIEWPORT)))) {
|
||||
# endif
|
||||
if (scrollbar_is_pixmapped()) {
|
||||
XSetWindowBackgroundPixmap(Xdisplay, scrollBar.win, images[image_sb].current->pmap->pixmap);
|
||||
} else {
|
||||
XSetWindowBackground(Xdisplay, scrollBar.win, gcvalue.foreground);
|
||||
}
|
||||
XClearWindow(Xdisplay, scrollBar.win);
|
||||
# ifdef PIXMAP_OFFSET
|
||||
}
|
||||
# endif /* PIXMAP_OFFSET */
|
||||
#endif
|
||||
XChangeGC(Xdisplay, scrollbarGC, GCForeground, &gcvalue);
|
||||
|
||||
gcvalue.foreground = PixColors[focus ? topShadowColor : unfocusedTopShadowColor];
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
: ((scrollBar.type == SCROLLBAR_NEXT) ? (scrollBar.end + scrollBar.width + 2) : (scrollBar.end + 1)))
|
||||
|
||||
/* Scrollbar operations */
|
||||
#define map_scrollbar(show) do {if (scrollbar_mapping(show)) {scr_touch(); resize();} PrivMode(show, PrivMode_scrollBar); } while (0)
|
||||
#define map_scrollbar(show) do {if (scrollbar_mapping(show)) {scr_touch(); parent_resize();} PrivMode(show, PrivMode_scrollBar); } while (0)
|
||||
#define scrollbar_get_shadow() (scrollBar.shadow)
|
||||
#define scrollbar_set_shadow(s) do { scrollBar.shadow = (s); } while (0)
|
||||
#define scrollbar_get_win() (scrollBar.win)
|
||||
|
@ -155,6 +155,7 @@ extern unsigned char sb_handle_motion_notify(event_t *);
|
|||
extern unsigned char scrollbar_dispatch_event(event_t *);
|
||||
extern unsigned char scrollbar_mapping(unsigned char);
|
||||
extern void scrollbar_reset(void);
|
||||
extern void scrollbar_resize(int, int);
|
||||
extern unsigned char scrollbar_show(short);
|
||||
|
||||
_XFUNCPROTOEND
|
||||
|
|
|
@ -58,9 +58,6 @@ static const char cvs_ident[] = "$Id$";
|
|||
#include "screen.h"
|
||||
#include "scrollbar.h"
|
||||
#include "term.h"
|
||||
#ifdef USE_POSIX_THREADS
|
||||
# include "threads.h"
|
||||
#endif
|
||||
#include "windows.h"
|
||||
|
||||
char *orig_argv0;
|
||||
|
@ -71,15 +68,6 @@ char *orig_argv0;
|
|||
Window Maker *cough*) -- mej */
|
||||
short bg_needs_update = 1;
|
||||
#endif
|
||||
#ifdef USE_POSIX_THREADS
|
||||
static void **retval;
|
||||
static int join_value;
|
||||
static pthread_t main_loop_thr;
|
||||
static pthread_attr_t main_loop_attr;
|
||||
# ifdef MUTEX_SYNCH
|
||||
pthread_mutex_t mutex;
|
||||
# endif
|
||||
#endif
|
||||
TermWin_t TermWin;
|
||||
Display *Xdisplay; /* display */
|
||||
Colormap cmap;
|
||||
|
@ -98,12 +86,6 @@ eterm_bootstrap(int argc, char *argv[])
|
|||
|
||||
orig_argv0 = argv[0];
|
||||
|
||||
#ifdef USE_POSIX_THREADS
|
||||
# ifdef MUTEX_SYNCH
|
||||
pthread_atfork((void *) &prepare, (void *) &parent, (void *) &child);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Security enhancements -- mej */
|
||||
putenv("IFS= \t\n");
|
||||
my_ruid = getuid();
|
||||
|
@ -121,14 +103,6 @@ eterm_bootstrap(int argc, char *argv[])
|
|||
|
||||
/* This MUST be called before any other Xlib functions */
|
||||
|
||||
#ifdef USE_POSIX_THREADS
|
||||
if (XInitThreads()) {
|
||||
D_THREADS(("XInitThreads() succesful\n"));
|
||||
} else {
|
||||
D_THREADS(("XInitThreads() failed, I'm outta here\n"));
|
||||
}
|
||||
#endif
|
||||
|
||||
get_initial_options(argc, argv);
|
||||
#ifdef NEED_LINUX_HACK
|
||||
privileges(INVOKE); /* xdm in new Linux versions requires ruid != root to open the display -- mej */
|
||||
|
@ -304,24 +278,11 @@ eterm_bootstrap(int argc, char *argv[])
|
|||
|
||||
D_CMD(("init_command()\n"));
|
||||
init_command(rs_execArgs);
|
||||
#ifndef USE_POSIX_THREADS
|
||||
if (Options & Opt_borderless) {
|
||||
resize_window();
|
||||
handle_external_resize();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_POSIX_THREADS
|
||||
D_THREADS(("main_thread:"));
|
||||
pthread_attr_init(&main_loop_attr);
|
||||
pthread_create(&main_loop_thr, &main_loop_attr,
|
||||
(void *) &main_thread, NULL);
|
||||
D_THREADS(("done? :)\n"));
|
||||
while (1);
|
||||
/* main_loop(); */
|
||||
#else
|
||||
main_loop(); /* main processing loop */
|
||||
#endif
|
||||
main_loop();
|
||||
|
||||
return (EXIT_SUCCESS);
|
||||
}
|
||||
/* EOF */
|
||||
|
|
33
src/term.c
33
src/term.c
|
@ -1579,33 +1579,36 @@ set_title(const char *str)
|
|||
|
||||
char *name;
|
||||
|
||||
if (XFetchName(Xdisplay, TermWin.parent, &name))
|
||||
if (XFetchName(Xdisplay, TermWin.parent, &name) == 0) {
|
||||
name = NULL;
|
||||
if (name == NULL || strcmp(name, str))
|
||||
}
|
||||
if (name == NULL || strcmp(name, str)) {
|
||||
XStoreName(Xdisplay, TermWin.parent, str);
|
||||
if (name)
|
||||
}
|
||||
if (name) {
|
||||
XFree(name);
|
||||
}
|
||||
}
|
||||
#else
|
||||
# define set_title(str) XStoreName(Xdisplay, TermWin.parent, str)
|
||||
#endif
|
||||
|
||||
#ifdef SMART_WINDOW_TITLE
|
||||
static void
|
||||
set_iconName(const char *str)
|
||||
set_icon_name(const char *str)
|
||||
{
|
||||
|
||||
char *name;
|
||||
|
||||
if (XGetIconName(Xdisplay, TermWin.parent, &name))
|
||||
if (XGetIconName(Xdisplay, TermWin.parent, &name) == 0) {
|
||||
name = NULL;
|
||||
if (name == NULL || strcmp(name, str))
|
||||
}
|
||||
if (name == NULL || strcmp(name, str)) {
|
||||
XSetIconName(Xdisplay, TermWin.parent, str);
|
||||
if (name)
|
||||
}
|
||||
if (name) {
|
||||
XFree(name);
|
||||
}
|
||||
}
|
||||
#else
|
||||
# define set_iconName(str) XSetIconName(Xdisplay, TermWin.parent, str)
|
||||
# define set_title(str) XStoreName(Xdisplay, TermWin.parent, str)
|
||||
# define set_icon_name(str) XSetIconName(Xdisplay, TermWin.parent, str)
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -1659,7 +1662,7 @@ xterm_seq(int op, const char *str)
|
|||
case XTerm_name:
|
||||
set_title(str); /* drop */
|
||||
case XTerm_iconName:
|
||||
set_iconName(str);
|
||||
set_icon_name(str);
|
||||
break;
|
||||
case XTerm_Takeover:
|
||||
XSetInputFocus(Xdisplay, TermWin.parent, RevertToParent, CurrentTime);
|
||||
|
@ -1673,8 +1676,8 @@ xterm_seq(int op, const char *str)
|
|||
Syntax: ESC ] 6 ; <op> ; <arg> BEL
|
||||
|
||||
where <op> is: 0 Set/toggle transparency
|
||||
1 Set color modifiers
|
||||
3 Force update of pseudo-transparent background
|
||||
1 Set color modifiers
|
||||
3 Force update of pseudo-transparent background
|
||||
10 Set scrollbar type/width
|
||||
11 Set/toggle right-side scrollbar
|
||||
12 Set/toggle floating scrollbar
|
||||
|
|
|
@ -148,6 +148,11 @@ enum color_list {
|
|||
default: PrivMode(state, bit); break; \
|
||||
}} while (0)
|
||||
|
||||
#ifndef SMART_WINDOW_TITLE
|
||||
# define set_title(str) XStoreName(Xdisplay, TermWin.parent, str)
|
||||
# define set_icon_name(str) XSetIconName(Xdisplay, TermWin.parent, str)
|
||||
#endif
|
||||
|
||||
/************ Variables ************/
|
||||
#ifdef META8_OPTION
|
||||
extern unsigned char meta_char; /* Alt-key prefix */
|
||||
|
|
221
src/threads.c
221
src/threads.c
|
@ -1,221 +0,0 @@
|
|||
/* threads.c for Eterm
|
||||
* Feb 25 1998, vendu
|
||||
*/
|
||||
|
||||
static const char cvs_ident[] = "$Id$";
|
||||
|
||||
#include "config.h"
|
||||
#include "feature.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef USE_POSIX_THREADS
|
||||
# include "startup.h"
|
||||
# include "debug.h"
|
||||
# include "screen.h"
|
||||
|
||||
# ifdef PIXMAP_SUPPORT
|
||||
# include "pixmap.h"
|
||||
# endif
|
||||
|
||||
/* extern char *sig_to_str(int sig); */
|
||||
|
||||
# ifdef USE_IMLIB
|
||||
extern imlib_t imlib_bg;
|
||||
|
||||
# endif
|
||||
|
||||
# include "threads.h"
|
||||
|
||||
extern int refresh_count, refresh_limit;
|
||||
extern unsigned char *cmdbuf_base, *cmdbuf_ptr, *cmdbuf_endp;
|
||||
extern unsigned char cmd_getc(void);
|
||||
|
||||
# ifdef MUTEX_SYNCH
|
||||
/* pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; */
|
||||
# endif
|
||||
|
||||
short bg_set = 0;
|
||||
pthread_t resize_sub_thr;
|
||||
pthread_attr_t resize_sub_thr_attr;
|
||||
|
||||
# ifdef MUTEX_SYNCH
|
||||
void
|
||||
prepare(void *dummy)
|
||||
{
|
||||
D_THREADS(("prepare(): pthread_mutex_trylock(&mutex)\n"));
|
||||
pthread_mutex_trylock(&mutex);
|
||||
}
|
||||
|
||||
void
|
||||
parent(void *dummy)
|
||||
{
|
||||
D_THREADS(("parent(): pthread_mutex_unlock(&mutex)\n"));
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
|
||||
void
|
||||
child(void *dummy)
|
||||
{
|
||||
D_THREADS(("child(): pthread_mutex_unlock(&mutex)\n"));
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
inline void
|
||||
refresh_termwin(void)
|
||||
{
|
||||
scrollbar_show(0);
|
||||
scr_touch();
|
||||
}
|
||||
|
||||
void
|
||||
render_bg_thread(void *dummy)
|
||||
{
|
||||
void *retval = NULL;
|
||||
|
||||
D_THREADS(("render_bg_thread() entered\n"));
|
||||
|
||||
if (bg_set) {
|
||||
# ifdef AGGRESSIVE_THREADS
|
||||
;
|
||||
# else
|
||||
D_THREADS(("Background already set\n"));
|
||||
# endif
|
||||
}
|
||||
# ifdef MUTEX_SYNCH
|
||||
if (pthread_mutex_trylock(&mutex) != EBUSY) {
|
||||
D_THREADS(("pthread_mutex_trylock(&mutex): "));
|
||||
} else {
|
||||
D_THREADS(("mutex already locked\n"));
|
||||
}
|
||||
# endif
|
||||
|
||||
D_THREADS(("pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);\n"));
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
|
||||
|
||||
D_THREADS(("pthread_detach();\n"));
|
||||
pthread_detach(resize_sub_thr);
|
||||
|
||||
D_THREADS(("render_bg_thread(): render_pixmap()\n"));
|
||||
render_pixmap(TermWin.vt, imlib_bg, bgPixmap, 0, 1);
|
||||
|
||||
D_THREADS(("refresh_termwin()\n"));
|
||||
refresh_termwin();
|
||||
|
||||
bg_set = 1;
|
||||
|
||||
# ifdef MUTEX_SYNCH
|
||||
D_THREADS(("pthread_mutex_unlock(&mutex);\n"));
|
||||
pthread_mutex_unlock(&mutex);
|
||||
# endif
|
||||
|
||||
D_THREADS(("pthread_exit()\n"));
|
||||
pthread_exit(retval);
|
||||
}
|
||||
|
||||
/* Read and process output from the application - threaded version. */
|
||||
void
|
||||
main_thread(void *ignored)
|
||||
{
|
||||
register int ch;
|
||||
|
||||
D_THREADS(("[%d] main_thread() entered\n", getpid()));
|
||||
D_CMD(("bg_set = %d\n", bg_set));
|
||||
|
||||
do {
|
||||
while ((ch = cmd_getc()) == 0); /* wait for something */
|
||||
|
||||
if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') {
|
||||
/* Read a text string from the input buffer */
|
||||
int nlines = 0;
|
||||
|
||||
/* unsigned char * str; */
|
||||
register unsigned char *str;
|
||||
|
||||
/*
|
||||
* point to the start of the string,
|
||||
* decrement first since already did get_com_char ()
|
||||
*/
|
||||
str = --cmdbuf_ptr;
|
||||
while (cmdbuf_ptr < cmdbuf_endp) {
|
||||
ch = *cmdbuf_ptr++;
|
||||
if (ch >= ' ' || ch == '\t' || ch == '\r') {
|
||||
/* nothing */
|
||||
} else if (ch == '\n') {
|
||||
nlines++;
|
||||
if (++refresh_count >= (refresh_limit * (TermWin.nrow - 1)))
|
||||
break;
|
||||
} else { /* unprintable */
|
||||
cmdbuf_ptr--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
scr_add_lines(str, nlines, (cmdbuf_ptr - str));
|
||||
} else {
|
||||
switch (ch) {
|
||||
# ifdef NO_VT100_ANS
|
||||
case 005:
|
||||
break;
|
||||
# else
|
||||
case 005:
|
||||
tt_printf(VT100_ANS);
|
||||
break; /* terminal Status */
|
||||
# endif
|
||||
case 007:
|
||||
scr_bell();
|
||||
break; /* bell */
|
||||
case '\b':
|
||||
scr_backspace();
|
||||
break; /* backspace */
|
||||
case 013:
|
||||
case 014:
|
||||
scr_index(UP);
|
||||
break; /* vertical tab, form feed */
|
||||
case 016:
|
||||
scr_charset_choose(1);
|
||||
break; /* shift out - acs */
|
||||
case 017:
|
||||
scr_charset_choose(0);
|
||||
break; /* shift in - acs */
|
||||
case 033:
|
||||
process_escape_seq();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (ch != EOF);
|
||||
}
|
||||
|
||||
inline void
|
||||
check_bg_pixmap(void)
|
||||
{
|
||||
if (bg_set) {
|
||||
# ifdef MUTEX_SYNCH
|
||||
if (pthread_mutex_trylock(&mutex) == EBUSY) {
|
||||
D_THREADS(("cmd_getc(): mutex locked, bbl\n"));
|
||||
} else
|
||||
# endif
|
||||
{
|
||||
# ifdef MUTEX_SYNCH
|
||||
D_THREADS(("cmd_getc(): pthread_mutex_trylock(&mutex): "));
|
||||
# endif
|
||||
|
||||
D_THREADS(("refresh_termwin() "));
|
||||
refresh_termwin();
|
||||
|
||||
# ifdef MUTEX_SYNCH
|
||||
D_THREADS(("pthread_mutex_unlock(&mutex);\n"));
|
||||
pthread_mutex_unlock(&mutex);
|
||||
# endif
|
||||
/* bg_set = 0; */
|
||||
}
|
||||
|
||||
bg_set = 0;
|
||||
|
||||
/* main_thread(NULL); */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* USE_POSIX_THREADS */
|
|
@ -1,33 +0,0 @@
|
|||
/* threads.h for Eterm
|
||||
* 25 Feb 1998, vendu
|
||||
*/
|
||||
|
||||
#ifndef _THREADS_H
|
||||
# define _THREADS_H
|
||||
|
||||
# ifdef USE_POSIX_THREADS
|
||||
|
||||
# ifdef PIXMAP_SUPPORT
|
||||
# include "pixmap.h"
|
||||
# include <X11/Xthreads.h>
|
||||
# endif
|
||||
|
||||
short bg_set;
|
||||
pthread_attr_t resize_sub_thr_attr;
|
||||
pthread_t resize_sub_thr;
|
||||
|
||||
extern void main_thread(void *);
|
||||
extern void render_bg_thread(void *);
|
||||
extern void check_bg_pixmap(void);
|
||||
|
||||
# ifdef MUTEX_SYNCH
|
||||
extern pthread_mutex_t mutex;
|
||||
|
||||
extern void prepare(void *dummy);
|
||||
extern void parent(void *dummy);
|
||||
extern void child(void *dummy);
|
||||
# endif
|
||||
|
||||
# endif /* USE_POSIX_THREADS */
|
||||
|
||||
#endif /* _THREADS_H */
|
206
src/windows.c
206
src/windows.c
|
@ -474,130 +474,12 @@ Create_Windows(int argc, char *argv[])
|
|||
TermWin.gc = XCreateGC(Xdisplay, TermWin.vt, GCForeground | GCBackground | GCFont | GCGraphicsExposures, &gcvalue);
|
||||
}
|
||||
|
||||
if (Options & Opt_noCursor)
|
||||
if (Options & Opt_noCursor) {
|
||||
scr_cursor_visible(0);
|
||||
|
||||
}
|
||||
|
||||
/* window resizing - assuming the parent window is the correct size */
|
||||
void
|
||||
resize_subwindows(int width, int height)
|
||||
{
|
||||
|
||||
int x = 0, y = 0;
|
||||
|
||||
#ifdef RXVT_GRAPHICS
|
||||
int old_width = TermWin.width;
|
||||
int old_height = TermWin.height;
|
||||
|
||||
#endif
|
||||
|
||||
D_SCREEN(("resize_subwindows(%d, %d)\n", width, height));
|
||||
TermWin.width = TermWin.ncol * TermWin.fwidth;
|
||||
TermWin.height = TermWin.nrow * TermWin.fheight;
|
||||
|
||||
/* size and placement */
|
||||
if (scrollbar_visible()) {
|
||||
scrollBar.beg = 0;
|
||||
scrollBar.end = height;
|
||||
#ifdef MOTIF_SCROLLBAR
|
||||
if (scrollBar.type == SCROLLBAR_MOTIF) {
|
||||
/* arrows are as high as wide - leave 1 pixel gap */
|
||||
scrollBar.beg += scrollbar_arrow_height() + scrollbar_get_shadow() + 1;
|
||||
scrollBar.end -= scrollbar_arrow_height() + scrollbar_get_shadow() + 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef NEXT_SCROLLBAR
|
||||
if (scrollBar.type == SCROLLBAR_NEXT) {
|
||||
scrollBar.beg = scrollbar_get_shadow();
|
||||
scrollBar.end -= (scrollBar.width * 2 + (scrollbar_get_shadow()? scrollbar_get_shadow() : 1) + 2);
|
||||
}
|
||||
#endif
|
||||
width -= scrollbar_trough_width();
|
||||
XMoveResizeWindow(Xdisplay, scrollBar.win, ((Options & Opt_scrollBar_right) ? (width) : (x)), 0, scrollbar_trough_width(), height);
|
||||
if (scrollbar_is_pixmapped()) {
|
||||
scrollbar_show(0);
|
||||
}
|
||||
if (!(Options & Opt_scrollBar_right)) {
|
||||
x = scrollbar_trough_width();
|
||||
}
|
||||
}
|
||||
XMoveResizeWindow(Xdisplay, TermWin.vt, x, y, width, height + 1);
|
||||
|
||||
#ifdef RXVT_GRAPHICS
|
||||
if (old_width)
|
||||
Gr_Resize(old_width, old_height);
|
||||
#endif
|
||||
if (!(background_is_pixmap())) {
|
||||
XSetWindowBackground(Xdisplay, TermWin.vt, PixColors[bgColor]);
|
||||
XClearWindow(Xdisplay, TermWin.vt);
|
||||
} else {
|
||||
#ifdef PIXMAP_SUPPORT
|
||||
render_simage(images[image_bg].current, TermWin.vt, TermWin_TotalWidth(), TermWin_TotalHeight(), image_bg, 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
resize(void)
|
||||
{
|
||||
szHint.base_width = (2 * TermWin.internalBorder);
|
||||
szHint.base_height = (2 * TermWin.internalBorder);
|
||||
|
||||
szHint.base_width += (scrollbar_visible()? scrollbar_trough_width() : 0);
|
||||
|
||||
szHint.min_width = szHint.base_width + szHint.width_inc;
|
||||
szHint.min_height = szHint.base_height + szHint.height_inc;
|
||||
|
||||
szHint.width = szHint.base_width + TermWin.width;
|
||||
szHint.height = szHint.base_height + TermWin.height;
|
||||
|
||||
szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity;
|
||||
|
||||
XSetWMNormalHints(Xdisplay, TermWin.parent, &szHint);
|
||||
XResizeWindow(Xdisplay, TermWin.parent, szHint.width, szHint.height);
|
||||
|
||||
resize_subwindows(szHint.width, szHint.height);
|
||||
}
|
||||
|
||||
/*
|
||||
* Redraw window after exposure or size change
|
||||
*/
|
||||
void
|
||||
resize_window1(unsigned int width, unsigned int height)
|
||||
{
|
||||
static short first_time = 1;
|
||||
int new_ncol = (width - szHint.base_width) / TermWin.fwidth;
|
||||
int new_nrow = (height - szHint.base_height) / TermWin.fheight;
|
||||
|
||||
if (first_time ||
|
||||
(new_ncol != TermWin.ncol) ||
|
||||
(new_nrow != TermWin.nrow)) {
|
||||
int curr_screen = -1;
|
||||
|
||||
/* scr_reset only works on the primary screen */
|
||||
if (!first_time) { /* this is not the first time thru */
|
||||
selection_clear();
|
||||
curr_screen = scr_change_screen(PRIMARY);
|
||||
}
|
||||
TermWin.ncol = new_ncol;
|
||||
TermWin.nrow = new_nrow;
|
||||
|
||||
resize_subwindows(width, height);
|
||||
scr_reset();
|
||||
|
||||
if (curr_screen >= 0) /* this is not the first time thru */
|
||||
scr_change_screen(curr_screen);
|
||||
first_time = 0;
|
||||
} else if (image_mode_is(image_bg, MODE_TRANS) || image_mode_is(image_bg, MODE_VIEWPORT)) {
|
||||
resize_subwindows(width, height);
|
||||
scr_touch();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* good for toggling 80/132 columns
|
||||
*/
|
||||
/* good for toggling 80/132 columns */
|
||||
void
|
||||
set_width(unsigned short width)
|
||||
{
|
||||
|
@ -608,28 +490,96 @@ set_width(unsigned short width)
|
|||
height = szHint.base_height + height * TermWin.fheight;
|
||||
|
||||
XResizeWindow(Xdisplay, TermWin.parent, width, height);
|
||||
resize_window1(width, height);
|
||||
handle_resize(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Redraw window after exposure or size change
|
||||
*/
|
||||
void
|
||||
resize_window(void)
|
||||
update_size_hints(void)
|
||||
{
|
||||
szHint.base_width = (2 * TermWin.internalBorder);
|
||||
szHint.base_height = (2 * TermWin.internalBorder);
|
||||
szHint.base_width += ((scrollbar_visible()) ? (scrollbar_trough_width()) : (0));
|
||||
|
||||
szHint.min_width = szHint.base_width + szHint.width_inc;
|
||||
szHint.min_height = szHint.base_height + szHint.height_inc;
|
||||
szHint.width = szHint.base_width + TermWin.width;
|
||||
szHint.height = szHint.base_height + TermWin.height;
|
||||
|
||||
szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity;
|
||||
XSetWMNormalHints(Xdisplay, TermWin.parent, &szHint);
|
||||
}
|
||||
|
||||
/* Resize terminal window and scrollbar window */
|
||||
void
|
||||
term_resize(int width, int height)
|
||||
{
|
||||
D_SCREEN(("term_resize(%d, %d)\n", width, height));
|
||||
TermWin.width = TermWin.ncol * TermWin.fwidth;
|
||||
TermWin.height = TermWin.nrow * TermWin.fheight;
|
||||
XMoveResizeWindow(Xdisplay, TermWin.vt, ((Options & Opt_scrollBar_right) ? (0) : (scrollbar_trough_width())), 0, width, height + 1);
|
||||
render_simage(images[image_bg].current, TermWin.vt, TermWin_TotalWidth(), TermWin_TotalHeight(), image_bg, 1);
|
||||
}
|
||||
|
||||
/* Resize due to font change; update size hints and child windows */
|
||||
void
|
||||
parent_resize(void)
|
||||
{
|
||||
update_size_hints();
|
||||
XResizeWindow(Xdisplay, TermWin.parent, szHint.width, szHint.height);
|
||||
term_resize(szHint.width, szHint.height);
|
||||
scrollbar_resize(szHint.width, szHint.height);
|
||||
}
|
||||
|
||||
void
|
||||
handle_resize(unsigned int width, unsigned int height)
|
||||
{
|
||||
static short first_time = 1;
|
||||
int new_ncol = (width - szHint.base_width) / TermWin.fwidth;
|
||||
int new_nrow = (height - szHint.base_height) / TermWin.fheight;
|
||||
|
||||
if (first_time || (new_ncol != TermWin.ncol) || (new_nrow != TermWin.nrow)) {
|
||||
int curr_screen = -1;
|
||||
|
||||
/* scr_reset only works on the primary screen */
|
||||
if (!first_time) {
|
||||
selection_clear();
|
||||
curr_screen = scr_change_screen(PRIMARY);
|
||||
}
|
||||
TermWin.ncol = new_ncol;
|
||||
TermWin.nrow = new_nrow;
|
||||
|
||||
term_resize(width, height);
|
||||
scrollbar_resize(width, height);
|
||||
scr_reset();
|
||||
|
||||
if (curr_screen >= 0) {
|
||||
scr_change_screen(curr_screen);
|
||||
}
|
||||
first_time = 0;
|
||||
} else if (image_mode_is(image_bg, MODE_TRANS) || image_mode_is(image_bg, MODE_VIEWPORT)) {
|
||||
term_resize(width, height);
|
||||
scrollbar_resize(width, height);
|
||||
scr_touch();
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle configure notify events telling us we've been resized */
|
||||
void
|
||||
handle_external_resize(void)
|
||||
{
|
||||
Window root;
|
||||
int x, y;
|
||||
unsigned int border, depth, width, height;
|
||||
|
||||
/* do we come from an fontchange? */
|
||||
/* If the font change count is non-zero, this event
|
||||
is telling us we resized ourselves. Ignore it. */
|
||||
if (font_change_count > 0) {
|
||||
font_change_count--;
|
||||
return;
|
||||
}
|
||||
XGetGeometry(Xdisplay, TermWin.parent, &root, &x, &y, &width, &height, &border, &depth);
|
||||
/* parent already resized */
|
||||
resize_window1(width, height);
|
||||
handle_resize(width, height);
|
||||
}
|
||||
|
||||
#ifdef XTERM_COLOR_CHANGE
|
||||
|
|
|
@ -46,11 +46,12 @@ extern void set_text_property(Window, char *, char *);
|
|||
extern Pixel get_bottom_shadow_color(Pixel, const char *);
|
||||
extern Pixel get_top_shadow_color(Pixel, const char *);
|
||||
extern void Create_Windows(int, char * []);
|
||||
extern void resize_subwindows(int, int);
|
||||
extern void resize(void);
|
||||
extern void resize_window1(unsigned int, unsigned int);
|
||||
extern void set_width(unsigned short);
|
||||
extern void resize_window(void);
|
||||
extern void update_size_hints(void);
|
||||
extern void term_resize(int, int);
|
||||
extern void parent_resize(void);
|
||||
extern void handle_resize(unsigned int, unsigned int);
|
||||
extern void handle_external_resize(void);
|
||||
#ifdef XTERM_COLOR_CHANGE
|
||||
extern void set_window_color(int, const char *);
|
||||
#else
|
||||
|
|
Loading…
Reference in New Issue