Sun Oct 25 11:35:50 2009 Michael Jennings (mej)
Merge code from 0.9.5. 0.10 branch is now up-to-date. ---------------------------------------------------------------------- SVN revision: 43274
193
ChangeLog
|
@ -5215,6 +5215,33 @@ Thu Mar 11 11:55:45 2004 Michael Jennings (mej)
|
|||
|
||||
Fix "make distcheck"
|
||||
----------------------------------------------------------------------
|
||||
Mon Apr 5 17:12:06 2004 Michael Jennings (mej)
|
||||
|
||||
Fixed bug in loading print_pipe attribute pointed out by Tom A. Cox
|
||||
<tomc@hot.rr.com>.
|
||||
----------------------------------------------------------------------
|
||||
Tue Apr 20 13:44:22 2004 Michael Jennings (mej)
|
||||
|
||||
As requested by Ben Armstrong <synrg@sanctuary.nslug.ns.ca>, saving
|
||||
theme settings will not preserve -e/--exec arguments unless a theme
|
||||
was specifically named by the user.
|
||||
----------------------------------------------------------------------
|
||||
Tue Apr 20 15:40:39 2004 Michael Jennings (mej)
|
||||
|
||||
Enable title-reporting and iconname-reporting escape sequences only if
|
||||
specifically requested by user at compile time. This exists solely to
|
||||
protect the ignorant and careless from themselves.
|
||||
----------------------------------------------------------------------
|
||||
Mon May 10 18:43:15 2004 Michael Jennings (mej)
|
||||
|
||||
Revert change from February 29th. I never could reproduce it anyway.
|
||||
----------------------------------------------------------------------
|
||||
Fri Jun 25 17:48:24 2004 Michael Jennings (mej)
|
||||
|
||||
Chris Schoeneman <crs23@bigfoot.com> pointed out that Eterm didn't get
|
||||
keypresses if another app (like synergy) decided to listen for its
|
||||
events. This should correct that behavior.
|
||||
----------------------------------------------------------------------
|
||||
Mon Jun 28 12:34:36 2004 Michael Jennings (mej)
|
||||
|
||||
Cleaning up some warnings.
|
||||
|
@ -5507,3 +5534,169 @@ Mon Dec 5 13:33:58 2005 Michael Jennings (mej)
|
|||
|
||||
Merge and re-indent code.
|
||||
----------------------------------------------------------------------
|
||||
Mon Dec 5 15:46:34 2005 Michael Jennings (mej)
|
||||
|
||||
Prevent firewall bounces from trying for the same port.
|
||||
----------------------------------------------------------------------
|
||||
Thu Dec 22 18:32:31 2005 Michael Jennings (mej)
|
||||
|
||||
Cleanups and minor enhancements.
|
||||
----------------------------------------------------------------------
|
||||
Wed Jan 4 03:44:04 2006 Michael Jennings (mej)
|
||||
|
||||
X resource tracking/debugging support.
|
||||
----------------------------------------------------------------------
|
||||
Wed Jan 4 04:14:14 2006 Michael Jennings (mej)
|
||||
|
||||
Applied patches from Tres Melton <tres@mindspring.com> for SSE2
|
||||
alignment and other shading-related issues.
|
||||
----------------------------------------------------------------------
|
||||
Wed Jan 4 04:22:13 2006 Michael Jennings (mej)
|
||||
|
||||
Update copyright dates.
|
||||
----------------------------------------------------------------------
|
||||
Thu Jan 5 14:50:53 2006 Michael Jennings (mej)
|
||||
|
||||
Fixed firewall bounce port checking from 2005-12-05.
|
||||
----------------------------------------------------------------------
|
||||
Mon Feb 6 01:02:15 2006 Michael Jennings (mej)
|
||||
|
||||
Fixed paste from clipboard.
|
||||
----------------------------------------------------------------------
|
||||
Mon Feb 6 17:15:49 2006 Michael Jennings (mej)
|
||||
|
||||
DragonFly BSD fixes from Joerg Sonnenberger <joerg@britannica.bec.de>.
|
||||
|
||||
Also some type mismatch fixes.
|
||||
----------------------------------------------------------------------
|
||||
Mon Feb 13 14:51:56 2006 Michael Jennings (mej)
|
||||
|
||||
Update to libast 0.6+ API.
|
||||
----------------------------------------------------------------------
|
||||
Fri Feb 24 16:58:43 2006 Michael Jennings (mej)
|
||||
|
||||
Add fallback attempt to open display in case NEED_LINUX_HACK is set
|
||||
and shouldn't be.
|
||||
----------------------------------------------------------------------
|
||||
Wed May 17 15:42:28 2006 Michael Jennings (mej)
|
||||
|
||||
Patch from Kim Woelders <kim@woelders.dk> to optimize transparent
|
||||
Eterms moved an even multiple of the desktop size (i.e., to another
|
||||
desktop area).
|
||||
----------------------------------------------------------------------
|
||||
Fri May 19 16:46:02 2006 Michael Jennings (mej)
|
||||
|
||||
Fixed a problem that's been bugging me for ages: Instead of a
|
||||
hard-coded delay, wait until we can connect to the ssh forwarding port
|
||||
before starting the Escreen session via ssh.
|
||||
|
||||
Add usleep() to system() wait so as to not peg the CPU while sitting
|
||||
and spinning.
|
||||
----------------------------------------------------------------------
|
||||
Sat Jun 17 23:06:03 2006 Michael Jennings (mej)
|
||||
|
||||
Daniel Macks <dmacks@netspace.org> noticed that gdb.scr wasn't being
|
||||
installed. Oops. Fixed now.
|
||||
----------------------------------------------------------------------
|
||||
Fri Aug 18 13:41:14 2006 Michael Jennings (mej)
|
||||
|
||||
Addressed licensing concerns.
|
||||
----------------------------------------------------------------------
|
||||
Tue Aug 22 14:07:23 2006 Michael Jennings (mej)
|
||||
|
||||
Forgot one.
|
||||
----------------------------------------------------------------------
|
||||
Tue Aug 22 14:38:15 2006 Michael Jennings (mej)
|
||||
|
||||
Eterm 0.9.4 is final.
|
||||
----------------------------------------------------------------------
|
||||
Tue Sep 19 17:07:28 2006 Michael Jennings (mej)
|
||||
|
||||
libscream.c is licensed just like Eterm.
|
||||
----------------------------------------------------------------------
|
||||
Wed Oct 18 13:35:18 2006 Michael Jennings (mej)
|
||||
|
||||
Fixed a typo and some logic errors in libscream located by Mike
|
||||
Frysinger <vapier@gentoo.org>.
|
||||
----------------------------------------------------------------------
|
||||
Mon Oct 30 16:11:47 2006 Michael Jennings (mej)
|
||||
|
||||
Patch from Jason McCarver <slam@parasite.cc> to support -S/--sticky
|
||||
option for "sticky" (i.e., present on all desktops) startup.
|
||||
----------------------------------------------------------------------
|
||||
Tue Jul 3 20:48:46 2007 Michael Jennings (mej)
|
||||
|
||||
Remove some cruft from kEsetroot.
|
||||
----------------------------------------------------------------------
|
||||
Wed May 14 12:42:51 2008 Michael Jennings (mej)
|
||||
|
||||
Patch from Kim Woelders <kim@woelders.dk>:
|
||||
|
||||
There is a race problem with Eterm during startup related to the
|
||||
shell LINES/COLUMNS env vars.
|
||||
|
||||
If the WM changes the window size (e.g. due to saved settings)
|
||||
before mapping the window, sometimes the shell will set LINES and
|
||||
COLUMNS according to the old/incorrect size and sometimes to the
|
||||
new/correct size, depending on wheter the call to tt_winsize() at
|
||||
command.c line 2322 (by the shell child process) or the
|
||||
tt_resize() (by the Eterm process) due to the ConfigureNotify
|
||||
caused by the resize (or WM ICCCM ConfigureNotify) operation
|
||||
happens first.
|
||||
|
||||
The call in question was added by Azundris for Escreen. So far
|
||||
Escreen seems to be behaving properly with this patch applied, but all
|
||||
my Eterm windows (Escreen and otherwise) are pre-sized with -g anyway.
|
||||
So I'm going to keep my eye on it for awhile. In case of trouble,
|
||||
change the "#if 0" to "#ifdef ESCREEN" to revert to previous behavior
|
||||
when in Escreen mode. Normal operation should not require the call in
|
||||
question.
|
||||
----------------------------------------------------------------------
|
||||
Wed May 14 14:54:16 2008 Michael Jennings (mej)
|
||||
|
||||
Modified patch from hsim@gmx.li to allow setting of the "Urgent" hint
|
||||
on beep.
|
||||
----------------------------------------------------------------------
|
||||
Wed May 14 15:26:13 2008 Michael Jennings (mej)
|
||||
|
||||
Patch from Emmanuel Anne <emmanuel.anne@gmail.com> to fix cut/paste
|
||||
with KDE applications.
|
||||
----------------------------------------------------------------------
|
||||
Wed May 14 16:09:04 2008 Michael Jennings (mej)
|
||||
|
||||
(Correct) fix for CVE-2008-1692. Eterm no longer defaults to using
|
||||
":0" for $DISPLAY due to the possibility that an attacker can create a
|
||||
fake X server on a shared system, intercept the Eterm X connection,
|
||||
and send fake keystrokes to the victim's Eterm to execute arbitrary
|
||||
commands as that user.
|
||||
|
||||
The previous fix, while it did indeed correct the vulnerability, broke
|
||||
the --display option. The original fix from Bernhard Link was more
|
||||
correct, albeit not quite on target.
|
||||
----------------------------------------------------------------------
|
||||
Wed Jun 11 20:18:44 2008 Michael Jennings (mej)
|
||||
|
||||
Eterm 0.9.5 release.
|
||||
----------------------------------------------------------------------
|
||||
Tue Dec 16 22:03:54 2008 Michael Jennings (mej)
|
||||
|
||||
Fix compile errors related to the removal of unnecessary typecasting
|
||||
macros.
|
||||
----------------------------------------------------------------------
|
||||
Mon Jan 5 23:50:28 2009 Michael Jennings (mej)
|
||||
|
||||
Remove fontset fallbacks. I think this might help speed up the load
|
||||
time slowness some people are seeing. Let's find out.
|
||||
----------------------------------------------------------------------
|
||||
Tue Jan 6 01:03:35 2009 Michael Jennings (mej)
|
||||
|
||||
Prevent blank Escreen buttonbar on startup.
|
||||
----------------------------------------------------------------------
|
||||
Tue Jan 6 01:08:47 2009 Michael Jennings (mej)
|
||||
|
||||
Update copyright dates and fix a bad license.
|
||||
----------------------------------------------------------------------
|
||||
Sun Oct 25 11:35:50 2009 Michael Jennings (mej)
|
||||
|
||||
Merge code from 0.9.5. 0.10 branch is now up-to-date.
|
||||
----------------------------------------------------------------------
|
||||
|
|
30
Eterm.spec
|
@ -3,6 +3,9 @@
|
|||
%endif
|
||||
|
||||
%define __os_install_post /usr/lib/rpm/brp-compress
|
||||
%if %{?optflags:1}0
|
||||
%define optflags ${RPM_OPT_FLAGS:--O0 -g3}
|
||||
%endif
|
||||
|
||||
Summary: Enlightened terminal emulator
|
||||
Name: Eterm
|
||||
|
@ -11,13 +14,13 @@ Version: 0.10
|
|||
Release: 0.%(date '+%Y%m%d')
|
||||
License: BSD
|
||||
Group: User Interface/X
|
||||
Requires: imlib2, imlib2-loader_jpeg, imlib2-loader_png
|
||||
#BuildSuggests: xorg-x11-devel
|
||||
BuildRequires: libast imlib2-devel XFree86-devel
|
||||
Source0: ftp://ftp.eterm.org/pub/Eterm/%{name}-%{version}.tar.%{compression}
|
||||
Source1: ftp://ftp.eterm.org/pub/Eterm/%{name}-bg-%{version}.tar.%{compression}
|
||||
URL: http://www.eterm.org/
|
||||
BuildRoot: /var/tmp/%{name}-%{version}-root
|
||||
Source0: http://www.eterm.org/download/%{name}-%{version}.tar.%{compression}
|
||||
Source1: http://www.eterm.org/download/%{name}-bg-%{version}.tar.%{compression}
|
||||
#BuildSuggests: xorg-x11-devel XFree86-devel xorg-x11-proto-devel libXext-devel libXt-devel freetype-devel
|
||||
BuildRequires: libast imlib2-devel
|
||||
Requires: imlib2, imlib2-loader_jpeg, imlib2-loader_png
|
||||
BuildRoot: %{?_tmppath}%{!?_tmppath:/var/tmp}/%{name}-%{version}-root
|
||||
|
||||
%description
|
||||
Eterm is a color vt102 terminal emulator with enhanced graphical
|
||||
|
@ -32,8 +35,7 @@ have the Imlib2 library installed.
|
|||
%setup -a 1
|
||||
|
||||
%build
|
||||
#CFLAGS="$RPM_OPT_FLAGS"
|
||||
CFLAGS="-O0 -g3"
|
||||
CFLAGS="%{optflags}"
|
||||
export CFLAGS
|
||||
|
||||
# When using the configure macro, I also specify all the directory
|
||||
|
@ -45,21 +47,21 @@ export CFLAGS
|
|||
%{__make} %{?mflags}
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%{__rm} -rf $RPM_BUILD_ROOT
|
||||
|
||||
# If the configure macro is used above (which it is), there
|
||||
# is NO reason to use the makeinstall macro here, so don't.
|
||||
%{__make} install DESTDIR=$RPM_BUILD_ROOT %{?mflags_install}
|
||||
|
||||
( cd $RPM_BUILD_ROOT
|
||||
mv .%{_bindir}/%{name} .%{_bindir}/%{name}-%{version}
|
||||
%{__mv} .%{_bindir}/%{name} .%{_bindir}/%{name}-%{version}
|
||||
cd $RPM_BUILD_ROOT%{_bindir}
|
||||
ln -f -s %{name}-%{version} %{name}
|
||||
%{__ln_s} -f %{name}-%{version} %{name}
|
||||
cd $RPM_BUILD_ROOT
|
||||
chmod +x .%{_libdir}/lib*so* ||:
|
||||
)
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/X11/applnk/Utilities
|
||||
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/X11/applnk/Utilities
|
||||
cat > $RPM_BUILD_ROOT%{_sysconfdir}/X11/applnk/Utilities/Eterm.desktop <<EOF
|
||||
[Desktop Entry]
|
||||
Name=Eterm
|
||||
|
@ -76,7 +78,7 @@ chmod 0644 $RPM_BUILD_ROOT%{_sysconfdir}/X11/applnk/Utilities/Eterm.desktop
|
|||
/sbin/ldconfig || :
|
||||
|
||||
if [ -d /usr/share/terminfo -a ! -f /usr/share/terminfo/E/Eterm ]; then
|
||||
tic -o/usr/share/terminfo $RPM_DOC_DIR/%{name}-%{version}/%{name}.ti || :
|
||||
tic -o/usr/share/terminfo %{_docdir}/%{name}-%{version}/%{name}.ti || :
|
||||
fi
|
||||
|
||||
%postun
|
||||
|
@ -88,7 +90,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||
%files
|
||||
%defattr(-, root, root)
|
||||
%doc doc/Eterm_reference.html doc/Eterm.1.html doc/Eterm.tcap doc/Eterm.ti doc/README.Escreen
|
||||
%doc README ReleaseNotes ReleaseNotes.1 ChangeLog
|
||||
%doc LICENSE README ReleaseNotes ReleaseNotes.1 ChangeLog
|
||||
%config %{_sysconfdir}/X11/applnk/Utilities/Eterm.desktop
|
||||
%{_bindir}/*
|
||||
%{_libdir}/*
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
Copyright (C) 1997-2009, Michael Jennings
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies of the Software, its documentation and
|
||||
marketing & publicity materials, and acknowledgment shall be given in
|
||||
the documentation, materials and software packages that this Software
|
||||
was used.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -4,6 +4,6 @@ AUTOMAKE_OPTIONS = foreign
|
|||
|
||||
SUBDIRS = src themes utils doc bg pix
|
||||
|
||||
EXTRA_DIST = README ReleaseNotes ReleaseNotes.1 CVS-README ChangeLog autogen.sh Eterm.spec
|
||||
EXTRA_DIST = LICENSE README ReleaseNotes ReleaseNotes.1 CVS-README ChangeLog autogen.sh Eterm.spec
|
||||
MAINTAINERCLEANFILES = Makefile.in *~ aclocal.m4 config.guess config.sub configure depcomp \
|
||||
install-sh ltconfig ltmain.sh missing mkinstalldirs stamp-h* *.log config.h.in
|
||||
|
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
@ -62,7 +62,6 @@ AC_DEFINE_UNQUOTED(GRKELOT_IDENT, "`grep '$''Id:' $srcdir/src/grkelot.c | sed 's
|
|||
AC_DEFINE_UNQUOTED(MAIN_IDENT, "`grep '$''Id:' $srcdir/src/main.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [main.c RCS ID])
|
||||
AC_DEFINE_UNQUOTED(MENUS_IDENT, "`grep '$''Id:' $srcdir/src/menus.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [menus.c RCS ID])
|
||||
AC_DEFINE_UNQUOTED(MISC_IDENT, "`grep '$''Id:' $srcdir/src/misc.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [misc.c RCS ID])
|
||||
AC_DEFINE_UNQUOTED(NETDISP_IDENT, "`grep '$''Id:' $srcdir/src/netdisp.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [netdisp.c RCS ID])
|
||||
AC_DEFINE_UNQUOTED(OPTIONS_IDENT, "`grep '$''Id:' $srcdir/src/options.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [options.c RCS ID])
|
||||
AC_DEFINE_UNQUOTED(PIXMAP_IDENT, "`grep '$''Id:' $srcdir/src/pixmap.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [pixmap.c RCS ID])
|
||||
AC_DEFINE_UNQUOTED(SCREEN_IDENT, "`grep '$''Id:' $srcdir/src/screen.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [screen.c RCS ID])
|
||||
|
@ -111,6 +110,7 @@ fi
|
|||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AM_PROG_AS
|
||||
|
||||
dnl# These must be run after AC_PROG_CC but before any other macros that use
|
||||
dnl# the C compiler
|
||||
|
@ -204,8 +204,10 @@ AC_CHECK_HEADERS(fcntl.h termios.h \
|
|||
sys/ioctl.h sys/select.h sys/time.h \
|
||||
sys/sockio.h sys/byteorder.h malloc.h \
|
||||
utmpx.h unistd.h bsd/signal.h regex.h \
|
||||
regexp.h stdarg.h X11/Xmu/Atoms.h \
|
||||
X11/Sunkeysym.h X11/Xlocale.h)
|
||||
regexp.h stdarg.h X11/X.h X11/Xlib.h \
|
||||
X11/Xmu/Atoms.h X11/Sunkeysym.h \
|
||||
X11/Xlocale.h \
|
||||
)
|
||||
AC_HEADER_TIME
|
||||
|
||||
dnl# Missing typedefs and replacements
|
||||
|
@ -219,7 +221,8 @@ AC_TYPE_SIGNAL
|
|||
AC_CHECK_FUNCS(atexit _exit unsetenv setutent \
|
||||
seteuid memmove putenv strsep setresuid setresgid \
|
||||
memmem usleep snprintf strcasestr strcasechr \
|
||||
strcasepbrk strrev nl_langinfo)
|
||||
strcasepbrk strrev nl_langinfo \
|
||||
)
|
||||
|
||||
# NOTE: The following line is NOT NOT NOT NOT NOT a typo!
|
||||
# If you are having problems with it, libast.m4 is not installed
|
||||
|
@ -872,6 +875,25 @@ if test "$XIM" = "TRUE"; then
|
|||
AC_CHECK_LIB(X11, XRegisterIMInstantiateCallback, AC_DEFINE(USE_X11R6_XIM, , [Define if we have X11R6 XIM.]))
|
||||
fi
|
||||
|
||||
# Check for XResource extension
|
||||
AC_CHECK_HEADER([X11/extensions/XRes.h],
|
||||
[
|
||||
AC_DEFINE([HAVE_X11_EXTENSIONS_XRES_H], [], [Define if we have X11/extensions/XRes.h])
|
||||
], [],
|
||||
[
|
||||
#ifdef HAVE_X11_X_H
|
||||
# include <X11/X.h>
|
||||
#endif
|
||||
#ifdef HAVE_X11_XLIB_H
|
||||
# include <X11/Xlib.h>
|
||||
#endif
|
||||
])
|
||||
AC_CHECK_LIB(XRes, XResQueryExtension,
|
||||
[
|
||||
GRLIBS="$GRLIBS -lXRes"
|
||||
AC_DEFINE(HAVE_XRES_EXT, , [Define if we have the XResource extension.])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING(for Greek keyboard support)
|
||||
AC_ARG_ENABLE(greek,
|
||||
[ --enable-greek compile with support for Greek keyboards], [
|
|
@ -8,7 +8,7 @@ Upstream Author: Michael Jennings <mej@eterm.org>
|
|||
|
||||
Copyright:
|
||||
|
||||
Copyright (C) 1997-2004, Michael Jennings
|
||||
Copyright (C) 1997-2009, Michael Jennings
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -457,6 +457,9 @@ Display the scrollbar only when the Eterm window is focused.
|
|||
.BR "\-x", " \-\-borderless"
|
||||
This option forces Eterm to have no borders.
|
||||
.TP
|
||||
.BR "\-S", " \-\-sticky"
|
||||
Start Eterm as a sticky window (shows on all desktops)
|
||||
.TP
|
||||
.BR "\-m", " \-\-map-alert"
|
||||
Un-iconify on beep.
|
||||
.TP
|
||||
|
@ -1734,6 +1737,11 @@ If true (default), any colored text (that is, any text not rendered
|
|||
using the default foreground color) will not be given any other
|
||||
special treatment for bolding (e.g., bold font or bold overstrike).
|
||||
.RE
|
||||
|
||||
.BI sticky " boolean"
|
||||
.RS 5
|
||||
If true, Eterm will make its window sticky (shows on all desktops).
|
||||
.RE
|
||||
.RE
|
||||
|
||||
.TP
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
Eterm|Eterm Terminal Emulator (X11 Window System):\
|
||||
:am:bw:eo:km:mi:ms:xn:xo:\
|
||||
:co#80:it#8:li#24:lm#0:pa#64:Co#8:AF=\E[3%dm:AB=\E[4%dm:op=\E[39m\E[49m:\
|
||||
:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\
|
||||
:K1=\E[7~:K2=\EOu:K3=\E[5~:K4=\E[8~:K5=\E[6~:LE=\E[%dD:\
|
||||
:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:cd=\E[J:\
|
||||
:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\
|
||||
:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=\E[B:\
|
||||
:ec=\E[%dX:ei=\E[4l:ho=\E[H:i1=\E[?47l\E>\E[?1l:ic=\E[@:\
|
||||
:im=\E[4h:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l:\
|
||||
:k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\
|
||||
:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:kD=\E[3~:\
|
||||
:kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=^H:kd=\E[B:ke=:kh=\E[7~:\
|
||||
:kl=\E[D:kr=\E[C:ks=:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:\
|
||||
:me=\E[m\017:mr=\E[7m:nd=\E[C:rc=\E8:\
|
||||
:sc=\E7:se=\E[27m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\
|
||||
:te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:ue=\E[24m:up=\E[A:\
|
||||
:us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:\
|
||||
:ac=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:
|
Before Width: | Height: | Size: 722 B After Width: | Height: | Size: 723 B |
Before Width: | Height: | Size: 757 B After Width: | Height: | Size: 758 B |
Before Width: | Height: | Size: 715 B After Width: | Height: | Size: 716 B |
Before Width: | Height: | Size: 817 B After Width: | Height: | Size: 818 B |
Before Width: | Height: | Size: 812 B After Width: | Height: | Size: 813 B |
Before Width: | Height: | Size: 811 B After Width: | Height: | Size: 812 B |
Before Width: | Height: | Size: 746 B After Width: | Height: | Size: 747 B |
Before Width: | Height: | Size: 722 B After Width: | Height: | Size: 723 B |
Before Width: | Height: | Size: 723 B After Width: | Height: | Size: 724 B |
Before Width: | Height: | Size: 708 B After Width: | Height: | Size: 709 B |
Before Width: | Height: | Size: 696 B After Width: | Height: | Size: 697 B |
Before Width: | Height: | Size: 703 B After Width: | Height: | Size: 704 B |
BIN
pix/exit.png
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
BIN
pix/help.png
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
BIN
pix/menu1.png
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
pix/menu2.png
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
pix/menu3.png
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
pix/thumb_1.png
Before Width: | Height: | Size: 209 B After Width: | Height: | Size: 210 B |
BIN
pix/thumb_2.png
Before Width: | Height: | Size: 209 B After Width: | Height: | Size: 210 B |
|
@ -9,8 +9,9 @@ done
|
|||
for i in *.c src/*.c utils/*.c ; do
|
||||
if test -f $i; then
|
||||
echo Reformatting $i
|
||||
indent -bad -bap -bbo -br -brs -cdw -ce -ci4 -cli4 -cs -di1 -i4 -l132 \
|
||||
-lp -lps -nbc -nbfda -npcs -nprs -nsob -nss -nut -psl -saf -sai -saw $TYPENAMES $i
|
||||
indent -bad -bap -bbo -bli0 -br -brs -cdw -ce -ci4 -cli4 -cs -di1 -i4 -l132 \
|
||||
-lp -lps -nbc -nbfda -npcs -nprs -nsob -nss -nut -psl -saf -sai -saw -sbi0 \
|
||||
$TYPENAMES $i
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
|
@ -9,14 +9,14 @@ MMX_OBJS = mmx_cmod.lo
|
|||
SSE2_SRCS = sse2_cmod.c
|
||||
SSE2_OBJS = sse2_cmod.lo
|
||||
|
||||
libEterm_la_SOURCES = actions.c actions.h buttons.c buttons.h command.c \
|
||||
command.h draw.c draw.h e.c e.h eterm_debug.h eterm_utmp.h \
|
||||
events.c events.h feature.h font.c font.h grkelot.c \
|
||||
grkelot.h icon.h menus.c menus.h misc.c misc.h netdisp.c \
|
||||
options.c options.h pixmap.c pixmap.h profile.h screen.c \
|
||||
screen.h script.c script.h scrollbar.c scrollbar.h \
|
||||
startup.c startup.h system.c system.h term.c term.h \
|
||||
timer.c timer.h utmp.c windows.c windows.h defaultfont.c \
|
||||
libEterm_la_SOURCES = actions.c actions.h buttons.c buttons.h command.c \
|
||||
command.h draw.c draw.h e.c e.h eterm_debug.h eterm_utmp.h \
|
||||
events.c events.h feature.h font.c font.h grkelot.c \
|
||||
grkelot.h icon.h menus.c menus.h misc.c misc.h \
|
||||
options.c options.h pixmap.c pixmap.h profile.h screen.c \
|
||||
screen.h script.c script.h scrollbar.c scrollbar.h \
|
||||
startup.c startup.h system.c system.h term.c term.h \
|
||||
timer.c timer.h utmp.c windows.c windows.h defaultfont.c \
|
||||
defaultfont.h libscream.c scream.h screamcfg.h
|
||||
|
||||
EXTRA_libEterm_la_SOURCES = $(MMX_SRCS) $(SSE2_SRCS)
|
||||
|
@ -39,9 +39,9 @@ Eterm_DEPENDENCIES = libEterm.la
|
|||
Eterm_LDFLAGS = -rpath $(libdir):$(pkglibdir)
|
||||
Eterm_LDADD = libEterm.la
|
||||
|
||||
EXTRA_DIST = mmx_cmod.S sse2_cmod.c
|
||||
EXTRA_DIST = gdb.scr mmx_cmod.S sse2_cmod.c
|
||||
MAINTAINERCLEANFILES=Makefile.in
|
||||
|
||||
install-exec-hook:
|
||||
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
|
||||
test ! -z "$(GDB_CMD_FILE)" && $(INSTALL_DATA) gdb.scr $(DESTDIR)$(pkgdatadir)/ || :
|
||||
test ! -z "$(GDB_CMD_FILE)" && $(INSTALL_DATA) $(srcdir)/gdb.scr $(DESTDIR)$(pkgdatadir)/ || :
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
324
src/command.c
|
@ -1,38 +1,25 @@
|
|||
/*--------------------------------*-C-*---------------------------------*
|
||||
* File: command.c
|
||||
/*
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies of the Software, its documentation and marketing & publicity
|
||||
* materials, and acknowledgment shall be given in the documentation, materials
|
||||
* and software packages that this Software was used.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
/* notes: */
|
||||
/*----------------------------------------------------------------------*
|
||||
* Copyright 1992 John Bovey, University of Kent at Canterbury.
|
||||
*
|
||||
* You can do what you like with this source code as long as
|
||||
* you don't try to make money out of it and you include an
|
||||
* unaltered copy of this message (including the copyright).
|
||||
*
|
||||
* This module has been very heavily modified by R. Nation
|
||||
* <nation@rocket.sanders.lockheed.com>
|
||||
* No additional restrictions are applied
|
||||
*
|
||||
* Additional modification by Garrett D'Amore <garrett@netcom.com> to
|
||||
* allow vt100 printing. No additional restrictions are applied.
|
||||
*
|
||||
* Integrated modifications by Steven Hirsch <hirsch@emba.uvm.edu> to
|
||||
* properly support X11 mouse report mode and support for DEC
|
||||
* "private mode" save/restore functions.
|
||||
*
|
||||
* Integrated key-related changes by Jakub Jelinek <jj@gnu.ai.mit.edu>
|
||||
* to handle Shift+function keys properly.
|
||||
* Should be used with enclosed termcap / terminfo database.
|
||||
*
|
||||
* Extensive modifications by mj olesen <olesen@me.QueensU.CA>
|
||||
* No additional restrictions.
|
||||
*
|
||||
* Further modification and cleanups for Solaris 2.x and Linux 1.2.x
|
||||
* by Raul Garcia Garcia <rgg@tid.es>. No additional restrictions.
|
||||
*
|
||||
* As usual, the author accepts no responsibility for anything, nor does
|
||||
* he guarantee anything whatsoever.
|
||||
*----------------------------------------------------------------------*/
|
||||
|
||||
static const char cvs_ident[] = "$Id$";
|
||||
|
||||
|
@ -67,6 +54,9 @@ static const char cvs_ident[] = "$Id$";
|
|||
#include <X11/Xos.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/IntrinsicP.h>
|
||||
#ifdef HAVE_XRES_EXT
|
||||
# include <X11/extensions/XRes.h>
|
||||
#endif
|
||||
#ifdef PTY_GRP_NAME
|
||||
# include <grp.h>
|
||||
#endif
|
||||
|
@ -147,6 +137,7 @@ TW_DECL_MAGIC(libscream_magic);
|
|||
static RETSIGTYPE handle_child_signal(int);
|
||||
static RETSIGTYPE handle_exit_signal(int);
|
||||
static RETSIGTYPE handle_crash(int);
|
||||
static RETSIGTYPE x_resource_dump(int);
|
||||
|
||||
/* local variables */
|
||||
int my_ruid, my_euid, my_rgid, my_egid;
|
||||
|
@ -999,13 +990,15 @@ void
|
|||
dump_stack_trace(void)
|
||||
{
|
||||
char cmd[256];
|
||||
#ifdef GDB
|
||||
struct stat st;
|
||||
#endif
|
||||
|
||||
#ifdef NO_STACK_TRACE
|
||||
return;
|
||||
#endif
|
||||
|
||||
print_error("Attempting to dump a stack trace....\n");
|
||||
libast_print_error("Attempting to dump a stack trace....\n");
|
||||
signal(SIGTSTP, exit); /* Don't block on tty output, just die */
|
||||
|
||||
#ifdef HAVE_U_STACK_TRACE
|
||||
|
@ -1027,7 +1020,7 @@ dump_stack_trace(void)
|
|||
snprintf(cmd, sizeof(cmd), "/bin/echo 'where\ndetach' | " DBX " %s %d", orig_argv0, getpid());
|
||||
# endif
|
||||
#else
|
||||
print_error("Your system does not support any of the methods Eterm uses. Exiting.\n");
|
||||
libast_print_error("Your system does not support any of the methods Eterm uses. Exiting.\n");
|
||||
return;
|
||||
#endif
|
||||
signal(SIGALRM, (eterm_sighandler_t) hard_exit);
|
||||
|
@ -1080,7 +1073,7 @@ static RETSIGTYPE
|
|||
handle_exit_signal(int sig)
|
||||
{
|
||||
|
||||
print_error("Received terminal signal %s (%d)\n", sig_to_str(sig), sig);
|
||||
libast_print_error("Received terminal signal %s (%d)\n", sig_to_str(sig), sig);
|
||||
signal(sig, SIG_DFL);
|
||||
|
||||
#ifdef UTMP_SUPPORT
|
||||
|
@ -1099,7 +1092,7 @@ static RETSIGTYPE
|
|||
handle_crash(int sig)
|
||||
{
|
||||
|
||||
print_error("Received terminal signal %s (%d)\n", sig_to_str(sig), sig);
|
||||
libast_print_error("Received terminal signal %s (%d)\n", sig_to_str(sig), sig);
|
||||
signal(sig, SIG_DFL); /* Let the OS handle recursive seg faults */
|
||||
|
||||
/* Lock down security so we don't write any core files as root. */
|
||||
|
@ -1114,6 +1107,116 @@ handle_crash(int sig)
|
|||
SIG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_XRES_EXT
|
||||
static RETSIGTYPE
|
||||
x_resource_dump(int sig)
|
||||
{
|
||||
int event_base, error_base, count, i;
|
||||
unsigned long bytes;
|
||||
XResClient *clients = NULL;
|
||||
XResType *types = NULL;
|
||||
Atom pixmap_atom, gc_atom, font_atom;
|
||||
pid_t my_pid;
|
||||
char *title, *ptitle;
|
||||
|
||||
USE_VAR(sig);
|
||||
my_pid = getpid();
|
||||
|
||||
/* Create type atoms for future use. */
|
||||
pixmap_atom = XInternAtom(Xdisplay, "PIXMAP", False);
|
||||
gc_atom = XInternAtom(Xdisplay, "GC", False);
|
||||
font_atom = XInternAtom(Xdisplay, "FONT", False);
|
||||
|
||||
/* Look at what *we* think our consumption is. */
|
||||
#if DEBUG >= DEBUG_MEM
|
||||
if (DEBUG_LEVEL >= DEBUG_MEM) {
|
||||
PIXMAP_DUMP();
|
||||
GC_DUMP();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Make sure we have the extension loaded. */
|
||||
if (!XResQueryExtension(Xdisplay, &event_base, &error_base)) {
|
||||
fprintf(stderr, "XResource extension not available on current display.\n");
|
||||
return;
|
||||
}
|
||||
D_X11(("Got XResource extension values: %d (0x%08x) / %d (0x%08x)\n",
|
||||
event_base, event_base, error_base, error_base));
|
||||
|
||||
/* Get a list of X clients and find our window ID in the list. */
|
||||
if (!XResQueryClients(Xdisplay, &count, &clients)) {
|
||||
if (clients) {
|
||||
XFree(clients);
|
||||
}
|
||||
D_X11((" -> Unable to query clients.\n"));
|
||||
return;
|
||||
}
|
||||
D_X11((" -> Got %d clients.\n", count));
|
||||
|
||||
if (count == 0) {
|
||||
D_X11((" -> Nothing to do!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
Window win;
|
||||
|
||||
win = clients[i].resource_base & (~clients[i].resource_mask);
|
||||
D_X11(("Checking client: base %d, mask %d, window 0x%08x\n", clients[i].resource_base,
|
||||
clients[i].resource_mask, win));
|
||||
if ((TermWin.parent & (~clients[i].resource_mask)) == win) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == count) {
|
||||
D_X11((" -> No client found with window 0x%08x (0x%08x\n", TermWin.parent,
|
||||
(TermWin.parent & (~clients[i].resource_mask))));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Request resource info for our client ID. */
|
||||
if (!XResQueryClientResources(Xdisplay, clients[i].resource_base, &count, &types)
|
||||
|| !XResQueryClientPixmapBytes(Xdisplay, clients[i].resource_base, &bytes)) {
|
||||
if (types) {
|
||||
XFree(types);
|
||||
}
|
||||
D_X11((" -> Unable to query resources.\n"));
|
||||
return;
|
||||
}
|
||||
D_X11((" -> Got %d types.\n", count));
|
||||
|
||||
/* Get and sanitize window title for easier identification. */
|
||||
XFetchName(Xdisplay, TermWin.parent, &title);
|
||||
if (title) {
|
||||
for (ptitle = title; *ptitle; ptitle++) {
|
||||
if (!isprint(*ptitle)) {
|
||||
*ptitle = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (types[i].resource_type == pixmap_atom) {
|
||||
fprintf(stderr, "Process %lu, window 0x%08x (%s): %d pixmaps (%lu bytes).\n", (unsigned long) my_pid,
|
||||
(unsigned int) TermWin.parent, NONULL(title), types[i].count, bytes);
|
||||
} else if (types[i].resource_type == gc_atom) {
|
||||
fprintf(stderr, "Process %lu, window 0x%08x (%s): %d GC's (%d bytes).\n", (unsigned long) my_pid,
|
||||
(unsigned int) TermWin.parent, NONULL(title), types[i].count,
|
||||
types[i].count * (sizeof(XGCValues) + sizeof(GC)));
|
||||
} else if (types[i].resource_type == font_atom) {
|
||||
fprintf(stderr, "Process %lu, window 0x%08x (%s): %d fonts (%d bytes).\n", (unsigned long) my_pid,
|
||||
(unsigned int) TermWin.parent, NONULL(title), types[i].count,
|
||||
types[i].count * (sizeof(XFontStruct) + sizeof(Font)));
|
||||
}
|
||||
}
|
||||
XFree(clients);
|
||||
XFree(types);
|
||||
if (title) {
|
||||
XFree(title);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
install_handlers(void)
|
||||
{
|
||||
|
@ -1133,6 +1236,11 @@ install_handlers(void)
|
|||
signal(SIGILL, handle_crash);
|
||||
signal(SIGSYS, handle_crash);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#ifdef HAVE_XRES_EXT
|
||||
signal(SIGUSR1, x_resource_dump);
|
||||
#else
|
||||
signal(SIGUSR1, SIG_IGN);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Exit gracefully, clearing the utmp entry and restoring tty attributes */
|
||||
|
@ -1151,15 +1259,16 @@ clean_exit(void)
|
|||
font_cache_clear();
|
||||
eterm_font_list_clear();
|
||||
# ifdef PIXMAP_SUPPORT
|
||||
FOREACH_IMAGE(free_eterm_image(&(images[idx]));
|
||||
);
|
||||
FOREACH_IMAGE({
|
||||
free_eterm_image(&(images[idx]));
|
||||
});
|
||||
# endif
|
||||
for (i = 0; i < NRS_COLORS; i++) {
|
||||
if (rs_color[i]) {
|
||||
FREE(rs_color[i]);
|
||||
}
|
||||
}
|
||||
conf_free_subsystem();
|
||||
spifconf_free_subsystem();
|
||||
# ifdef USE_XIM
|
||||
if (xim_input_context) {
|
||||
XUnsetICFocus(xim_input_context);
|
||||
|
@ -1293,15 +1402,15 @@ svr_get_pty(void)
|
|||
return (-1);
|
||||
} else {
|
||||
if (grantpt(fd) != 0) {
|
||||
print_error("grantpt(%d) failed: %s\n", fd, strerror(errno));
|
||||
libast_print_error("grantpt(%d) failed: %s\n", fd, strerror(errno));
|
||||
return (-1);
|
||||
} else if (unlockpt(fd) != 0) {
|
||||
print_error("unlockpt(%d) failed: %s\n", fd, strerror(errno));
|
||||
libast_print_error("unlockpt(%d) failed: %s\n", fd, strerror(errno));
|
||||
return (-1);
|
||||
} else {
|
||||
ptydev = ttydev = ptsname(fd);
|
||||
if (ttydev == NULL) {
|
||||
print_error("ptsname(%d) failed: %s\n", fd, strerror(errno));
|
||||
libast_print_error("ptsname(%d) failed: %s\n", fd, strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
@ -1366,7 +1475,7 @@ get_pty(void)
|
|||
fcntl(fd, F_SETFL, O_NDELAY);
|
||||
return (fd);
|
||||
} else {
|
||||
print_error("Can't open pseudo-tty -- %s\n", strerror(errno));
|
||||
libast_print_error("Can't open pseudo-tty -- %s\n", strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
@ -1399,10 +1508,10 @@ get_tty(void)
|
|||
|
||||
privileges(INVOKE);
|
||||
if (ttydev == NULL) {
|
||||
print_error("Slave tty device name is NULL. Failed to open slave pty.\n");
|
||||
libast_print_error("Slave tty device name is NULL. Failed to open slave pty.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
} else if ((fd = open(ttydev, O_RDWR)) < 0) {
|
||||
print_error("Can't open slave tty %s -- %s\n", ttydev, strerror(errno));
|
||||
libast_print_error("Can't open slave tty %s -- %s\n", ttydev, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
D_TTY(("Opened slave tty %s\n", ttydev));
|
||||
|
@ -1746,33 +1855,34 @@ create_fontset(const char *font1, const char *font2)
|
|||
XFontSet fontset = 0;
|
||||
char *fontname, **ml, *ds;
|
||||
int mc;
|
||||
const char fs_base[] = ",-misc-fixed-*-r-*-*-*-120-*-*-*-*-*-*,*";
|
||||
/*const char fs_base[] = ",-misc-fixed-*-r-*-*-*-120-*-*-*-*-*-*,*";*/
|
||||
|
||||
ASSERT_RVAL(font1 != NULL, (XFontSet) 0);
|
||||
|
||||
if (font2) {
|
||||
fontname = MALLOC(strlen(font1) + strlen(font2) + sizeof(fs_base) + 2);
|
||||
fontname = MALLOC(strlen(font1) + strlen(font2) /*+ sizeof(fs_base)*/ + 2);
|
||||
if (fontname) {
|
||||
strcpy(fontname, font1);
|
||||
strcat(fontname, ",");
|
||||
strcat(fontname, font2);
|
||||
strcat(fontname, fs_base);
|
||||
/*strcat(fontname, fs_base);*/
|
||||
}
|
||||
} else {
|
||||
fontname = MALLOC(strlen(font1) + sizeof(fs_base) + 1);
|
||||
fontname = MALLOC(strlen(font1) /*+ sizeof(fs_base)*/ + 1);
|
||||
if (fontname) {
|
||||
strcpy(fontname, font1);
|
||||
strcat(fontname, fs_base);
|
||||
/*strcat(fontname, fs_base);*/
|
||||
}
|
||||
}
|
||||
if (fontname) {
|
||||
setlocale(LC_ALL, "");
|
||||
fontset = XCreateFontSet(Xdisplay, fontname, &ml, &mc, &ds);
|
||||
D_FONT(("Created fontset from %s, %d missing charsets, default string \"%s\".\n", fontname, mc, NONULL(ds)));
|
||||
fontset = XCreateFontSet(Xdisplay, fontname, &ml, &mc, NULL);
|
||||
D_FONT(("Created fontset from %s, %d missing charsets (\"%s\").\n", fontname, mc,
|
||||
((mc > 0) ? (ml[0]) : ("N/A"))));
|
||||
FREE(fontname);
|
||||
if (mc) {
|
||||
XFreeStringList(ml);
|
||||
fontset = 0;
|
||||
/*fontset = 0;*/
|
||||
}
|
||||
}
|
||||
return fontset;
|
||||
|
@ -1797,7 +1907,7 @@ init_locale(void)
|
|||
XSetLocaleModifiers("");
|
||||
TermWin.fontset = (XFontSet) 0;
|
||||
if ((locale == NULL) || (!XSupportsLocale())) {
|
||||
print_warning("Locale not supported; defaulting to portable \"C\" locale.\n");
|
||||
libast_print_warning("Locale not supported; defaulting to portable \"C\" locale.\n");
|
||||
locale = setlocale(LC_ALL, "C");
|
||||
XSetLocaleModifiers("");
|
||||
REQUIRE(locale);
|
||||
|
@ -1968,13 +2078,13 @@ xim_real_init(void)
|
|||
destroy_cb.callback = xim_destroy_cb;
|
||||
destroy_cb.client_data = NULL;
|
||||
if (XSetIMValues(xim_input_method, XNDestroyCallback, &destroy_cb, NULL)) {
|
||||
print_error("Could not set destroy callback to IM\n");
|
||||
libast_print_error("Could not set destroy callback to IM\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((XGetIMValues(xim_input_method, XNQueryInputStyle, &xim_styles, NULL)) || (!xim_styles)) {
|
||||
print_error("input method doesn't support any style\n");
|
||||
libast_print_error("input method doesn't support any style\n");
|
||||
XCloseIM(xim_input_method);
|
||||
return -1;
|
||||
}
|
||||
|
@ -2008,14 +2118,14 @@ xim_real_init(void)
|
|||
XFree(xim_styles);
|
||||
|
||||
if (found == 0) {
|
||||
print_error("input method doesn't support my preedit type\n");
|
||||
libast_print_error("input method doesn't support my preedit type\n");
|
||||
XCloseIM(xim_input_method);
|
||||
return -1;
|
||||
}
|
||||
if ((xim_input_style != (XIMPreeditNothing | XIMStatusNothing))
|
||||
&& (xim_input_style != (XIMPreeditArea | XIMStatusArea))
|
||||
&& (xim_input_style != (XIMPreeditPosition | XIMStatusNothing))) {
|
||||
print_error("This program does not support the preedit type\n");
|
||||
libast_print_error("This program does not support the preedit type\n");
|
||||
XCloseIM(xim_input_method);
|
||||
return -1;
|
||||
}
|
||||
|
@ -2046,7 +2156,7 @@ xim_real_init(void)
|
|||
XFree(status_attr);
|
||||
}
|
||||
if (xim_input_context == NULL) {
|
||||
print_error("Failed to create input context\n");
|
||||
libast_print_error("Failed to create input context\n");
|
||||
XCloseIM(xim_input_method);
|
||||
return -1;
|
||||
}
|
||||
|
@ -2152,7 +2262,7 @@ run_command(char **argv)
|
|||
# if defined (__sun__)
|
||||
on_exit(clean_exit, NULL); /* non-ANSI exit handler */
|
||||
# else
|
||||
print_error("no atexit(), UTMP entries can't be cleaned\n");
|
||||
libast_print_error("no atexit(), UTMP entries can't be cleaned\n");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -2180,7 +2290,7 @@ run_command(char **argv)
|
|||
cmd_pid = fork();
|
||||
D_CMD(("After fork(), cmd_pid == %d\n", cmd_pid));
|
||||
if (cmd_pid < 0) {
|
||||
print_error("fork(): %s\n", strerror(errno));
|
||||
libast_print_error("fork(): %s\n", strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
if (cmd_pid == 0) {
|
||||
|
@ -2212,7 +2322,11 @@ run_command(char **argv)
|
|||
|
||||
get_tty();
|
||||
SET_TTYMODE(0, &tio);
|
||||
tt_winsize(0);
|
||||
#if 0
|
||||
if (TermWin.screen_mode != NS_MODE_NONE) {
|
||||
tt_winsize(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* become virtual console, fail silently */
|
||||
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_CONSOLE)) {
|
||||
|
@ -2257,7 +2371,7 @@ run_command(char **argv)
|
|||
#endif
|
||||
D_CMD(("[%d] About to spawn shell\n", getpid()));
|
||||
if (chdir(initial_dir)) {
|
||||
print_warning("Unable to chdir to \"%s\" -- %s\n", initial_dir, strerror(errno));
|
||||
libast_print_warning("Unable to chdir to \"%s\" -- %s\n", initial_dir, strerror(errno));
|
||||
}
|
||||
if (argv != NULL) {
|
||||
#if DEBUG >= DEBUG_CMD
|
||||
|
@ -2271,7 +2385,7 @@ run_command(char **argv)
|
|||
#endif
|
||||
D_CMD(("[%d] execvp(\"%s\", %8p) is next. I'm outta here!\n", getpid(), NONULL(argv[0]), argv));
|
||||
execvp(argv[0], argv);
|
||||
print_error("execvp() failed, cannot execute \"%s\": %s\n", argv[0], strerror(errno));
|
||||
libast_print_error("execvp() failed, cannot execute \"%s\": %s\n", argv[0], strerror(errno));
|
||||
} else {
|
||||
|
||||
const char *argv0, *shell;
|
||||
|
@ -2288,7 +2402,7 @@ run_command(char **argv)
|
|||
argv0 = p;
|
||||
}
|
||||
execlp(shell, argv0, NULL);
|
||||
print_error("execlp() failed, cannot execute \"%s\": %s\n", shell, strerror(errno));
|
||||
libast_print_error("execlp() failed, cannot execute \"%s\": %s\n", shell, strerror(errno));
|
||||
}
|
||||
sleep(3); /* Sleep to make sure fork() returns in the parent, and so user can read error message */
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -2576,11 +2690,16 @@ err_msg(void *xd, int err, char *msg)
|
|||
static int
|
||||
inp_text(void *xd, int id, char *txt)
|
||||
{
|
||||
USE_VAR(xd);
|
||||
int which = (int) xd;
|
||||
USE_VAR(id);
|
||||
|
||||
D_ESCREEN(("Writing \"%s\" to subprocess.\n", safe_print_string(txt, strlen(txt))));
|
||||
tt_write(txt, strlen(txt));
|
||||
if (which) {
|
||||
D_ESCREEN(("Writing \"%s\" to screen.\n", safe_print_string(txt, strlen(txt))));
|
||||
cmd_write(txt, strlen(txt));
|
||||
} else {
|
||||
D_ESCREEN(("Writing \"%s\" to subprocess.\n", safe_print_string(txt, strlen(txt))));
|
||||
tt_write(txt, strlen(txt));
|
||||
}
|
||||
return NS_SUCC;
|
||||
}
|
||||
|
||||
|
@ -2609,11 +2728,10 @@ exe_prg(void *xd, char **argv)
|
|||
|
||||
/****** Azundris' playthings :-) ******/
|
||||
|
||||
#ifdef ESCREEN_FX
|
||||
#define DIRECT_MASK (~(RS_Cursor|RS_Select|RS_fontMask))
|
||||
#define COLOUR_MASK (RS_fgMask|RS_bgMask)
|
||||
#define DIRECT_SET_SCREEN(x,y,fg,bg) (screen.text[ys+y])[x]=fg; (screen.rend[ys+y])[x]=bg&DIRECT_MASK;
|
||||
#define CLEAR (1<<16)
|
||||
#define CLEAR (RS_None | bgColor)
|
||||
|
||||
static void
|
||||
direct_write_screen(int x, int y, char *fg, rend_t bg)
|
||||
|
@ -2630,6 +2748,7 @@ direct_write_screen(int x, int y, char *fg, rend_t bg)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ESCREEN_FX
|
||||
static void
|
||||
bosconian(int n)
|
||||
{
|
||||
|
@ -2783,8 +2902,9 @@ waitstate(void *xd, int ms)
|
|||
matrix(31);
|
||||
unbosconian();
|
||||
}
|
||||
bosconian(4);
|
||||
bosconian(20);
|
||||
unbosconian();
|
||||
scr_refresh(SLOW_REFRESH);
|
||||
}
|
||||
|
||||
direct_write_screen(0, y++, " **** COMMODORE 64 BASIC V2 ****", (0 << 8) | CLEAR);
|
||||
|
@ -2794,12 +2914,30 @@ waitstate(void *xd, int ms)
|
|||
screen.row = y;
|
||||
screen.col = 0;
|
||||
|
||||
scr_refresh(FAST_REFRESH);
|
||||
scr_refresh(SLOW_REFRESH);
|
||||
|
||||
sleep(dur);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
static int
|
||||
waitstate(void *xd, int ms)
|
||||
{
|
||||
USE_VAR(xd);
|
||||
|
||||
direct_write_screen(TERM_WINDOW_GET_REPORTED_COLS() / 2 - 17, TERM_WINDOW_GET_ROWS() / 2,
|
||||
"**** Initializing, please wait ****", (15 << 9) | CLEAR);
|
||||
screen.row = 0;
|
||||
screen.col = 0;
|
||||
|
||||
scr_refresh(SLOW_REFRESH);
|
||||
|
||||
sleep((time_t) (ms / 1000));
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static _ns_efuns *
|
||||
|
@ -2830,9 +2968,7 @@ escreen_reg_funcs(void)
|
|||
ns_register_inp(efuns, input_dialog);
|
||||
ns_register_tab(efuns, menu_tab);
|
||||
|
||||
#ifdef ESCREEN_FX
|
||||
ns_register_fun(efuns, waitstate);
|
||||
#endif
|
||||
|
||||
return efuns;
|
||||
}
|
||||
|
@ -3031,7 +3167,7 @@ init_command(char **argv)
|
|||
AT_LEAST(num_fds, ((unsigned int) (pipe_fd + 1)));
|
||||
}
|
||||
if ((cmd_fd = command_func(argv)) < 0) {
|
||||
print_error("Unable to run sub-command.\n");
|
||||
libast_print_error("Unable to run sub-command.\n");
|
||||
paused = 1;
|
||||
rs_finished_text = "Hit a key to exit...";
|
||||
}
|
||||
|
@ -3318,12 +3454,12 @@ cmd_getc(void)
|
|||
if (retval < 0) {
|
||||
if (cmd_fd >= 0 && FD_ISSET(cmd_fd, &readfds)) {
|
||||
if (errno != EINTR) { /* may have rcvd SIGCHLD or so */
|
||||
print_error(" (%ld) Error reading from tty -- %s\n", getpid(), strerror(errno));
|
||||
libast_print_error(" (%ld) Error reading from tty -- %s\n", getpid(), strerror(errno));
|
||||
cmd_fd = -1;
|
||||
}
|
||||
}
|
||||
if (pipe_fd >= 0 && FD_ISSET(pipe_fd, &readfds)) {
|
||||
print_error("Error reading from pipe -- %s\n", strerror(errno));
|
||||
libast_print_error("Error reading from pipe -- %s\n", strerror(errno));
|
||||
pipe_fd = -1;
|
||||
}
|
||||
if (pipe_fd < 0 && cmd_fd < 0 && !paused) {
|
||||
|
@ -3540,8 +3676,8 @@ main_loop(void)
|
|||
set_multichar_encoding("utf8");
|
||||
}
|
||||
handle = iconv_open("WCHAR_T", "UTF-8");
|
||||
if (handle == SPIF_CAST_C(iconv_t) - 1) {
|
||||
print_error("Unable to decode UTF-8 locale %s to WCHAR_T. Defaulting to portable C locale.\n",
|
||||
if (handle == (iconv_t) -1) {
|
||||
libast_print_error("Unable to decode UTF-8 locale %s to WCHAR_T. Defaulting to portable C locale.\n",
|
||||
setlocale(LC_ALL, ""));
|
||||
setlocale(LC_ALL, "C");
|
||||
scr_add_lines(str, nlines, (cmdbuf_ptr - str));
|
||||
|
@ -3554,45 +3690,45 @@ main_loop(void)
|
|||
pinbuff = (char *) str;
|
||||
bufflen = cmdbuf_ptr - str;
|
||||
outlen = bufflen * 6;
|
||||
poutbuff = outbuff = SPIF_CAST_C(char *) MALLOC(outlen);
|
||||
poutbuff = outbuff = (char *) MALLOC(outlen);
|
||||
|
||||
errno = 0;
|
||||
D_VT(("Allocated output buffer of %lu chars at %010p against input buffer of %lu\n", bufflen * 6, outbuff,
|
||||
bufflen));
|
||||
print_warning("Moo: %s\n", safe_print_string(str, bufflen));
|
||||
libast_print_warning("Moo: %s\n", safe_print_string(str, bufflen));
|
||||
retval = iconv(handle, &pinbuff, &bufflen, &poutbuff, &outlen);
|
||||
outlen = (size_t) (poutbuff - outbuff);
|
||||
if (retval != (size_t) - 1) {
|
||||
errno = 0;
|
||||
}
|
||||
if (errno == E2BIG) {
|
||||
print_error("My UTF-8 decode buffer was too small by %lu bytes?!\n", bufflen);
|
||||
libast_print_error("My UTF-8 decode buffer was too small by %lu bytes?!\n", bufflen);
|
||||
} else if (errno == EILSEQ) {
|
||||
print_error("Illegal multibyte sequence encountered at \'%c\' (0x%02x); skipping.\n", *pinbuff, *pinbuff);
|
||||
libast_print_error("Illegal multibyte sequence encountered at \'%c\' (0x%02x); skipping.\n", *pinbuff, *pinbuff);
|
||||
*pinbuff = ' ';
|
||||
pinbuff++;
|
||||
} else if (errno == EINVAL) {
|
||||
D_VT(("Incomplete multibyte sequence encountered.\n"));
|
||||
print_warning("Converted %lu input chars to %lu output chars before incomplete sequence.\n",
|
||||
libast_print_warning("Converted %lu input chars to %lu output chars before incomplete sequence.\n",
|
||||
(cmdbuf_ptr - str), outlen);
|
||||
} else {
|
||||
print_warning("Converted %lu input chars to %lu output chars.\n", (cmdbuf_ptr - str), outlen);
|
||||
libast_print_warning("Converted %lu input chars to %lu output chars.\n", (cmdbuf_ptr - str), outlen);
|
||||
}
|
||||
|
||||
print_warning("Moo2: %s\n", safe_print_string(outbuff, outlen));
|
||||
libast_print_warning("Moo2: %s\n", safe_print_string(outbuff, outlen));
|
||||
MEMSET(outbuff + outlen, 0, sizeof(wchar_t));
|
||||
wcbuff = SPIF_CAST_C(wchar_t *) outbuff;
|
||||
wcbuff = (wchar_t *) outbuff;
|
||||
MEMSET(&mbs, 0, sizeof(mbstate_t));
|
||||
outlen = wcsrtombs(NULL, &wcbuff, 0, &mbs) + 1;
|
||||
if (outlen > 0) {
|
||||
outbuff = SPIF_CAST_C(char *) MALLOC(outlen);
|
||||
outbuff = (char *) MALLOC(outlen);
|
||||
|
||||
outlen = wcsrtombs(outbuff, &wcbuff, outlen, &mbs);
|
||||
if ((long) outlen >= 0) {
|
||||
FREE(wcbuff);
|
||||
print_error("I win!\n");
|
||||
libast_print_error("I win!\n");
|
||||
} else {
|
||||
print_error("wcsrtombs() returned %ld (errno is %d (%s))\n", (unsigned long) outlen, errno,
|
||||
libast_print_error("wcsrtombs() returned %ld (errno is %d (%s))\n", (unsigned long) outlen, errno,
|
||||
strerror(errno));
|
||||
}
|
||||
if (pinbuff > (char *) str) {
|
||||
|
@ -3600,7 +3736,7 @@ main_loop(void)
|
|||
scr_add_lines(outbuff, nlines, outlen);
|
||||
}
|
||||
} else {
|
||||
print_error("wcsrtombs(NULL, %10p, 0) returned %ld (errno is %d (%s))\n", wcbuff, (unsigned long) outlen,
|
||||
libast_print_error("wcsrtombs(NULL, %10p, 0) returned %ld (errno is %d (%s))\n", wcbuff, (unsigned long) outlen,
|
||||
errno, strerror(errno));
|
||||
}
|
||||
FREE(outbuff);
|
||||
|
@ -3703,7 +3839,7 @@ v_writeBig(int f, char *d, int len)
|
|||
v_bufend = v_bufptr + len;
|
||||
} else {
|
||||
/* no memory: ignore entire write request */
|
||||
print_error("cannot allocate buffer space\n");
|
||||
libast_print_error("cannot allocate buffer space\n");
|
||||
v_buffer = v_bufstr; /* restore clobbered pointer */
|
||||
c = 0;
|
||||
}
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
/*--------------------------------*-C-*---------------------------------*
|
||||
* File: command.h
|
||||
/*
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Copyright 1992 John Bovey, University of Kent at Canterbury.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* You can do what you like with this source code as long as you don't try
|
||||
* to make money out of it and you include an unaltered copy of this
|
||||
* message (including the copyright).
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies of the Software, its documentation and marketing & publicity
|
||||
* materials, and acknowledgment shall be given in the documentation, materials
|
||||
* and software packages that this Software was used.
|
||||
*
|
||||
* This module has been heavily modified by R. Nation
|
||||
* <nation@rocket.sanders.lockheed.com>
|
||||
* No additional restrictions are applied.
|
||||
*
|
||||
* Additional modifications by mj olesen <olesen@me.QueensU.CA>
|
||||
* No additional restrictions are applied.
|
||||
*
|
||||
* As usual, the author accepts no responsibility for anything, nor does
|
||||
* he guarantee anything whatsoever.
|
||||
*----------------------------------------------------------------------*/
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _COMMAND_H_
|
||||
# define _COMMAND_H_
|
||||
# include <signal.h>
|
||||
|
@ -386,9 +389,6 @@ extern void tt_printf(const unsigned char *, ...);
|
|||
extern void main_loop(void);
|
||||
extern int v_doPending(void);
|
||||
extern void v_writeBig(int, char *, int);
|
||||
#ifdef DISPLAY_IS_IP
|
||||
extern char *network_display(const char *);
|
||||
#endif
|
||||
|
||||
_XFUNCPROTOEND
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
6
src/e.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -104,8 +104,8 @@ enl_ipc_get_win(void)
|
|||
}
|
||||
|
||||
/* Make sure the version string is within the acceptable range. */
|
||||
if (SPIF_CMP_IS_LESS(spiftool_version_compare(SPIF_CAST(charptr) str, SPIF_CAST(charptr) "0.16.4"))
|
||||
|| SPIF_CMP_IS_GREATER(spiftool_version_compare(SPIF_CAST(charptr) str, SPIF_CAST(charptr) "0.16.999"))) {
|
||||
if (SPIF_CMP_IS_LESS(spiftool_version_compare((spif_charptr_t) str, (spif_charptr_t) "0.16.4"))
|
||||
|| SPIF_CMP_IS_GREATER(spiftool_version_compare((spif_charptr_t) str, (spif_charptr_t) "0.16.999"))) {
|
||||
D_ENL((" -> IPC version string \"%s\" out of range. I'll have to ignore it.\n"));
|
||||
ipc_win = None;
|
||||
}
|
||||
|
|
2
src/e.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -69,8 +69,9 @@
|
|||
# ifdef HAVE_LASTLOG_H
|
||||
# include <lastlog.h>
|
||||
# endif
|
||||
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
|
||||
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__) || defined(__DragonFly__)
|
||||
# include <ttyent.h>
|
||||
# define NEW_BSD_UTMP
|
||||
# endif
|
||||
|
||||
# ifdef HAVE_LIBUTEMPTER
|
||||
|
|
20
src/events.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -200,6 +200,7 @@ event_win_is_parent(register event_dispatcher_data_t *data, Window win)
|
|||
unsigned char
|
||||
handle_key_press(event_t *ev)
|
||||
{
|
||||
XWMHints *wm_hints;
|
||||
#ifdef COUNT_X_EVENTS
|
||||
static unsigned long keypress_cnt = 0;
|
||||
#endif
|
||||
|
@ -212,6 +213,12 @@ handle_key_press(event_t *ev)
|
|||
if (!(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_NO_INPUT))) {
|
||||
lookup_key(ev);
|
||||
}
|
||||
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_URG_ALERT)) {
|
||||
wm_hints = XGetWMHints(Xdisplay, TermWin.parent);
|
||||
wm_hints->flags &= ~XUrgencyHint;
|
||||
XSetWMHints(Xdisplay, TermWin.parent, wm_hints);
|
||||
XFree(wm_hints);
|
||||
}
|
||||
PROF_DONE(handle_key_press);
|
||||
PROF_TIME(handle_key_press);
|
||||
return 1;
|
||||
|
@ -451,6 +458,7 @@ handle_leave_notify(event_t *ev)
|
|||
unsigned char
|
||||
handle_focus_in(event_t *ev)
|
||||
{
|
||||
XWMHints *wm_hints;
|
||||
|
||||
D_EVENTS(("handle_focus_in(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
|
||||
|
||||
|
@ -486,6 +494,12 @@ handle_focus_in(event_t *ev)
|
|||
if (xim_input_context != NULL)
|
||||
XSetICFocus(xim_input_context);
|
||||
#endif
|
||||
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_URG_ALERT)) {
|
||||
wm_hints = XGetWMHints(Xdisplay, TermWin.parent);
|
||||
wm_hints->flags &= ~XUrgencyHint;
|
||||
XSetWMHints(Xdisplay, TermWin.parent, wm_hints);
|
||||
XFree(wm_hints);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -872,7 +886,7 @@ xerror_handler(Display * display, XErrorEvent * event)
|
|||
|
||||
strcpy(err_string, "");
|
||||
XGetErrorText(display, event->error_code, err_string, sizeof(err_string));
|
||||
print_error("XError in function %s, resource 0x%08x (request %d.%d): %s (error %d)\n",
|
||||
libast_print_error("XError in function %s, resource 0x%08x (request %d.%d): %s (error %d)\n",
|
||||
request_code_to_name(event->request_code), (int) event->resourceid, event->request_code, event->minor_code,
|
||||
err_string, event->error_code);
|
||||
#if DEBUG > DEBUG_X11
|
||||
|
@ -880,6 +894,6 @@ xerror_handler(Display * display, XErrorEvent * event)
|
|||
dump_stack_trace();
|
||||
}
|
||||
#endif
|
||||
print_error("Attempting to continue...\n");
|
||||
libast_print_error("Attempting to continue...\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -54,7 +54,9 @@
|
|||
# endif
|
||||
|
||||
# ifdef __GNUC__
|
||||
# define _GNU_SOURCE
|
||||
# ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE
|
||||
# endif
|
||||
# else
|
||||
# define _XOPEN_SOURCE 600
|
||||
# define _XOPEN_SOURCE_EXTENDED 1
|
||||
|
@ -95,7 +97,6 @@
|
|||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
|
||||
# define LIBAST_COMPAT_05_API 1
|
||||
# include <libast.h>
|
||||
# include "eterm_debug.h"
|
||||
|
||||
|
@ -111,8 +112,9 @@
|
|||
/* Disable the secondary screen ("\E[?47h" / "\E[?47l") */
|
||||
/* #define NO_SECONDARY_SCREEN */
|
||||
|
||||
/* The number of screenfuls between refreshes. */
|
||||
# define REFRESH_PERIOD 2
|
||||
/* The number of screenfuls between refreshes. Anything higher than 1
|
||||
* will cause gaps in the scrollback buffer. */
|
||||
# define REFRESH_PERIOD 1
|
||||
|
||||
/* This will force clearing of characters before writing new ones on top of
|
||||
* them. This is experimental - added in order to try and fix pixel dropping
|
||||
|
@ -206,9 +208,6 @@
|
|||
|
||||
/********************* Miscellaneous options *********************/
|
||||
|
||||
/* To have $DISPLAY and the "\E[7n" response be IP addresses rather than FQDN's */
|
||||
/* #define DISPLAY_IS_IP */
|
||||
|
||||
/* To have "\E[7n" reply with the display name. This is a potential security risk,
|
||||
* so its use is discouraged and unsupported. */
|
||||
/* #define ENABLE_DISPLAY_ANSWER */
|
||||
|
@ -300,6 +299,10 @@ inline void *memmove(void *, const void *, size_t);
|
|||
# define NO_DELETE_KEY /* These systems seem to be anal this way*/
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_X11_EXTENSIONS_XRES_H)
|
||||
# undef HAVE_XRES_EXT
|
||||
#endif
|
||||
|
||||
#ifndef PATH_ENV
|
||||
# define PATH_ENV "ETERMPATH"
|
||||
#endif
|
||||
|
|
32
src/font.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -417,9 +417,9 @@ load_font(const char *name, const char *fallback, unsigned char type)
|
|||
/* No match in the cache, so we'll have to add it. */
|
||||
if (type == FONT_TYPE_X) {
|
||||
if ((xfont = XLoadQueryFont(Xdisplay, name)) == NULL) {
|
||||
print_error("Unable to load font \"%s\". Falling back on \"%s\"\n", name, fallback);
|
||||
libast_print_error("Unable to load font \"%s\". Falling back on \"%s\"\n", name, fallback);
|
||||
if ((xfont = XLoadQueryFont(Xdisplay, fallback)) == NULL) {
|
||||
fatal_error("Couldn't load the fallback font either. Giving up.\n");
|
||||
libast_fatal_error("Couldn't load the fallback font either. Giving up.\n");
|
||||
} else {
|
||||
font_cache_add(fallback, type, (void *) xfont);
|
||||
}
|
||||
|
@ -740,7 +740,7 @@ parse_font_fx(char *line)
|
|||
|
||||
ASSERT_RVAL(line != NULL, 0);
|
||||
|
||||
n = num_words(line);
|
||||
n = spiftool_num_words(line);
|
||||
|
||||
if (!BEG_STRCASECMP(line, "none")) {
|
||||
MEMSET(&fshadow, 0, sizeof(fontshadow_t));
|
||||
|
@ -748,7 +748,7 @@ parse_font_fx(char *line)
|
|||
if (n != 2) {
|
||||
return 0;
|
||||
}
|
||||
color = get_word(2, line);
|
||||
color = spiftool_get_word(2, line);
|
||||
p = get_color_by_name(color, "black");
|
||||
FREE(color);
|
||||
for (which = 0; which < 4; which++) {
|
||||
|
@ -757,10 +757,10 @@ parse_font_fx(char *line)
|
|||
} else if (!BEG_STRCASECMP(line, "shadow")) {
|
||||
if (n == 2) {
|
||||
which = SHADOW_BOTTOM_RIGHT;
|
||||
color = get_word(2, line);
|
||||
color = spiftool_get_word(2, line);
|
||||
} else if (n == 3) {
|
||||
color = get_word(3, line);
|
||||
corner = get_pword(2, line);
|
||||
color = spiftool_get_word(3, line);
|
||||
corner = spiftool_get_pword(2, line);
|
||||
which = get_corner(corner);
|
||||
if (which >= 4) {
|
||||
return 0;
|
||||
|
@ -774,12 +774,12 @@ parse_font_fx(char *line)
|
|||
if (n != 3) {
|
||||
return 0;
|
||||
}
|
||||
color = get_word(2, line);
|
||||
color = spiftool_get_word(2, line);
|
||||
p = get_color_by_name(color, "black");
|
||||
set_shadow_color_by_pixel(SHADOW_BOTTOM_RIGHT, p);
|
||||
FREE(color);
|
||||
|
||||
color = get_word(3, line);
|
||||
color = spiftool_get_word(3, line);
|
||||
p = get_color_by_name(color, "white");
|
||||
set_shadow_color_by_pixel(SHADOW_TOP_LEFT, p);
|
||||
FREE(color);
|
||||
|
@ -787,12 +787,12 @@ parse_font_fx(char *line)
|
|||
if (n != 3) {
|
||||
return 0;
|
||||
}
|
||||
color = get_word(2, line);
|
||||
color = spiftool_get_word(2, line);
|
||||
p = get_color_by_name(color, "black");
|
||||
set_shadow_color_by_pixel(SHADOW_TOP_LEFT, p);
|
||||
FREE(color);
|
||||
|
||||
color = get_word(3, line);
|
||||
color = spiftool_get_word(3, line);
|
||||
p = get_color_by_name(color, "white");
|
||||
set_shadow_color_by_pixel(SHADOW_BOTTOM_RIGHT, p);
|
||||
FREE(color);
|
||||
|
@ -803,11 +803,11 @@ parse_font_fx(char *line)
|
|||
which = get_corner(line);
|
||||
if (which >= 4) {
|
||||
which = i;
|
||||
color = get_word(1, line);
|
||||
line = get_pword(2, line);
|
||||
color = spiftool_get_word(1, line);
|
||||
line = spiftool_get_pword(2, line);
|
||||
} else {
|
||||
color = get_word(2, line);
|
||||
line = get_pword(3, line);
|
||||
color = spiftool_get_word(2, line);
|
||||
line = spiftool_get_pword(3, line);
|
||||
}
|
||||
set_shadow_color_by_name(which, color);
|
||||
FREE(color);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
120
src/libscream.c
|
@ -8,6 +8,7 @@
|
|||
* and vice versa. several sessions can be open at once.
|
||||
*
|
||||
* Lesser GNU Public Licence applies.
|
||||
* Distributed with Eterm under the same license terms as Eterm itself.
|
||||
* Thread-safe: untested
|
||||
*
|
||||
* 2002/04/19 Azundris incept
|
||||
|
@ -39,6 +40,7 @@
|
|||
#include <limits.h> /* PATH_MAX */
|
||||
#include <ctype.h> /* isspace() */
|
||||
#include <errno.h> /* errno */
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "feature.h"
|
||||
|
@ -203,22 +205,35 @@ ns_new_hop(int lp, char *fw, int fp, int delay, _ns_sess * s)
|
|||
bzero(h, sizeof(_ns_hop));
|
||||
if ((h->fw = STRDUP(fw))) {
|
||||
if (!lp) {
|
||||
lp = NS_MIN_PORT; /* local port defaults to */
|
||||
if (ha) { /* NS_MIN_PORT. if that's */
|
||||
int f; /* taken, use next FREE port. */
|
||||
int tmp_sock;
|
||||
|
||||
do { /* FREE as in, not used by us. */
|
||||
_ns_hop *i = ha;
|
||||
tmp_sock = socket(PF_INET, SOCK_STREAM, 6);
|
||||
if (tmp_sock > 0) {
|
||||
struct sockaddr_in addr;
|
||||
|
||||
f = 0;
|
||||
while (i)
|
||||
if (i->localport == lp) {
|
||||
f = 1;
|
||||
lp++;
|
||||
i = NULL;
|
||||
} else
|
||||
i = i->next;
|
||||
} while (f);
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||
for (lp = NS_MIN_PORT; (lp > 0) && (lp < NS_MAX_PORT); lp++) {
|
||||
addr.sin_port = htons(lp);
|
||||
|
||||
if (bind(tmp_sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_in))) {
|
||||
D_ESCREEN(("Unable to bind socket %d to 127.0.0.1:%hd -- %s\n", tmp_sock, lp, strerror(errno)));
|
||||
} else if (listen(tmp_sock, 1)) {
|
||||
D_ESCREEN(("Unable to listen on port %hd -- %s\n", lp, strerror(errno)));
|
||||
} else {
|
||||
/* We can listen on this port. Use it! */
|
||||
/* FIXME: Minor race condition between port selection and ssh call. */
|
||||
D_ESCREEN(("Got available listening port %d.\n", lp));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((lp < 0) || (lp == NS_MAX_PORT)) {
|
||||
/* We're going to fail anyway, so just throw something in. */
|
||||
lp = NS_MIN_PORT + (random() % (NS_MAX_PORT - NS_MIN_PORT));
|
||||
BOUND(lp, NS_MIN_PORT, NS_MAX_PORT);
|
||||
D_ESCREEN(("Chose random listening port %d.\n", lp));
|
||||
}
|
||||
close(tmp_sock);
|
||||
}
|
||||
}
|
||||
h->delay = (delay ? delay : NS_TUNNEL_DELAY);
|
||||
|
@ -1066,6 +1081,42 @@ ns_attach_lcl(_ns_sess ** sp)
|
|||
}
|
||||
|
||||
|
||||
static int
|
||||
ns_wait_for_socket(int port)
|
||||
{
|
||||
int tmp_sock, ret = -1;
|
||||
time_t start_time;
|
||||
|
||||
D_ESCREEN(("Waiting for forwarder to begin listening on port %d.\n", port));
|
||||
tmp_sock = socket(PF_INET, SOCK_STREAM, 6);
|
||||
start_time = time(NULL);
|
||||
if (tmp_sock >= 0) {
|
||||
struct sockaddr_in addr;
|
||||
char timeout = 0;
|
||||
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||
addr.sin_port = htons(port);
|
||||
|
||||
do {
|
||||
usleep(100);
|
||||
if ((time(NULL) - start_time) >= NS_TUNNEL_DELAY) {
|
||||
timeout = 1;
|
||||
break;
|
||||
}
|
||||
} while (connect(tmp_sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)));
|
||||
if (timeout) {
|
||||
D_ESCREEN((" -> Unable to connect; timeout after %d seconds.\n", NS_TUNNEL_DELAY));
|
||||
sleep(1);
|
||||
return -1;
|
||||
} else {
|
||||
ret = time(NULL) - start_time;
|
||||
D_ESCREEN((" -> Connected after %d seconds.\n", ret));
|
||||
}
|
||||
close(tmp_sock);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* attach a remote session (using screen/scream via ssh)
|
||||
sp the session
|
||||
|
@ -1101,22 +1152,36 @@ ns_attach_ssh(_ns_sess ** sp)
|
|||
|
||||
if (sess->hop) {
|
||||
if (sess->hop->established == NS_HOP_DOWN) { /* the nightmare foe */
|
||||
_ns_efuns *efuns = NULL;
|
||||
|
||||
ret = snprintf(cmd, NS_MAXCMD, "%s %s -p %d -L %d:%s:%d %s@%s",
|
||||
NS_SSH_CALL, NS_SSH_TUNNEL_OPTS, sess->hop->fwport, sess->hop->localport, sess->host, sess->port,
|
||||
sess->user, sess->hop->fw);
|
||||
if (ret < 0 || ret > NS_MAXCMD)
|
||||
return NS_FAIL;
|
||||
D_ESCREEN(("Spawning forwarder: %s\n", cmd));
|
||||
ns_run(sess->efuns, cmd);
|
||||
sleep(sess->hop->delay);
|
||||
if (NS_EFUN_EXISTS(efuns, sess, NULL, inp_text)) {
|
||||
char tmp_buff[] = "Waiting for forwarder...";
|
||||
|
||||
efuns->inp_text((void *) 1, sess->fd, tmp_buff);
|
||||
}
|
||||
if ((ns_wait_for_socket(sess->hop->localport) < 0) && efuns) {
|
||||
char tmp_buff[] = "...timed out.";
|
||||
|
||||
efuns->inp_text((void *) 1, sess->fd, tmp_buff);
|
||||
}
|
||||
}
|
||||
ret = snprintf(cmd, NS_MAXCMD, "%s %s -p %d %s@localhost \"%s%s\"",
|
||||
NS_SSH_CALL, NS_SSH_OPTS, sess->hop->localport, sess->user, call, ((sess->backend == NS_MODE_SCREEN)
|
||||
|| (sess->backend ==
|
||||
NS_MODE_NEGOTIATE)) ? esc : "");
|
||||
D_ESCREEN(("Spawning screen session: %s\n", cmd));
|
||||
} else {
|
||||
ret =
|
||||
snprintf(cmd, NS_MAXCMD, "%s %s -p %d %s@%s \"%s%s\"", NS_SSH_CALL, NS_SSH_OPTS, sess->port, sess->user, sess->host,
|
||||
call, ((sess->backend == NS_MODE_SCREEN) || (sess->backend == NS_MODE_NEGOTIATE)) ? esc : "");
|
||||
D_ESCREEN(("Spawning screen session: %s\n", cmd));
|
||||
}
|
||||
ns_free(&call);
|
||||
|
||||
|
@ -1869,7 +1934,7 @@ int
|
|||
ns_ren_disp(_ns_sess * s, int d, char *name)
|
||||
{
|
||||
char *i = NULL, *n;
|
||||
size_t l;
|
||||
size_t l = 0;
|
||||
int ret = NS_FAIL;
|
||||
|
||||
if (!s) {
|
||||
|
@ -2142,16 +2207,20 @@ ns_scroll2y(_ns_sess * s, int y)
|
|||
int
|
||||
ns_upd_stat(_ns_sess * s)
|
||||
{
|
||||
D_ESCREEN(("Forcing update of status line for session 0x%p.\n", s));
|
||||
if (!s) {
|
||||
return NS_FAIL;
|
||||
}
|
||||
|
||||
switch (s->backend) {
|
||||
/* FIXME: Causes other problems. case NS_MODE_NEGOTIATE:*/
|
||||
#ifdef NS_HAVE_SCREEN
|
||||
case NS_MODE_SCREEN:
|
||||
D_ESCREEN(("Calling ns_screen_command(0x%p, %s)\n", s, NS_SCREEN_UPDATE));
|
||||
return ns_screen_command(s, NS_SCREEN_UPDATE);
|
||||
#endif
|
||||
default:
|
||||
D_ESCREEN(("Failed; backend set to %d\n", s->backend));
|
||||
return NS_FAIL;
|
||||
}
|
||||
}
|
||||
|
@ -2554,6 +2623,7 @@ ns_screen_command(_ns_sess * sess, char *cmd)
|
|||
char *c;
|
||||
int ret = NS_SUCC;
|
||||
|
||||
D_ESCREEN(("Sending command \"%s\"\n", NONULL(cmd)));
|
||||
if (!cmd || !*cmd) {
|
||||
return NS_FAIL;
|
||||
}
|
||||
|
@ -2649,7 +2719,7 @@ ns_inp_tab(void *xd, char *b, size_t l, size_t m)
|
|||
"resize", "screen", "scrollback", "select",
|
||||
"sessionname", "setenv", "setsid", "shell",
|
||||
"shelltitle", "silence", "silencewait", "sleep",
|
||||
"slowpast", "source", "sorendition", "split", "stuff",
|
||||
"slowpast", "source", "sorendition", "spiftool_split", "stuff",
|
||||
"su", "suspend", "term", "termcap", "terminfo",
|
||||
"termcapinfo", "unsetenv", "utf8", "vbell",
|
||||
"vbell_msg", "vbellwait", "verbose", "version",
|
||||
|
@ -3163,7 +3233,7 @@ ns_parse_screen(_ns_sess * screen, int force, int width, char *p)
|
|||
*p2 = 0; /* make darn sure it's NUL-terminated */
|
||||
}
|
||||
|
||||
D_ESCREEN(("parse_screen: screen sends (%d) ::%s::\n", strlen(p), p));
|
||||
D_ESCREEN(("parse_screen: screen sends \"%s\" (%d)\n", p, strlen(p)));
|
||||
|
||||
if (strlen(p) < 2) { /* special case: display 0 */
|
||||
disp = screen->dsps; /* might not get a status-line in d0! */
|
||||
|
@ -3191,9 +3261,19 @@ ns_parse_screen(_ns_sess * screen, int force, int width, char *p)
|
|||
if (NS_EFUN_EXISTS(efuns, screen, NULL, waitstate)) {
|
||||
ret = efuns->waitstate(NULL, screen->delay * 1000);
|
||||
}
|
||||
(void) ns_upd_stat(screen);
|
||||
if (screen->where == NS_LCL) {
|
||||
D_ESCREEN(("Sending update request.\n"));
|
||||
ns_upd_stat(screen);
|
||||
} else {
|
||||
D_ESCREEN(("Not sending update request (%d).\n", screen->where));
|
||||
}
|
||||
} else {
|
||||
(void) ns_screen_command(screen, NS_SCREEN_INIT);
|
||||
if (screen->where == NS_LCL) {
|
||||
D_ESCREEN(("Sending init request.\n"));
|
||||
(void) ns_screen_command(screen, NS_SCREEN_INIT);
|
||||
} else {
|
||||
D_ESCREEN(("Not sending init request (%d).\n", screen->where));
|
||||
}
|
||||
screen->timestamp = 1;
|
||||
}
|
||||
} else if ((screen->timestamp > 1) && (time(NULL) >= screen->timestamp)) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -1240,7 +1240,7 @@ menu_action(menuitem_t *item)
|
|||
menu_dialog(NULL, item->action.alert, 0, NULL, NULL);
|
||||
break;
|
||||
default:
|
||||
fatal_error("Internal Program Error: Unknown menuitem type: %u\n", item->type);
|
||||
libast_fatal_error("Internal Program Error: Unknown menuitem type: %u\n", item->type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
16
src/misc.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -75,12 +75,12 @@ char *
|
|||
str_trim(char *str)
|
||||
{
|
||||
|
||||
register char *tmp = str;
|
||||
register spif_charptr_t tmp = (spif_charptr_t) str;
|
||||
size_t n;
|
||||
|
||||
if (str && *str) {
|
||||
|
||||
chomp(str);
|
||||
spiftool_chomp(str);
|
||||
n = strlen(str);
|
||||
|
||||
if (!n) {
|
||||
|
@ -216,7 +216,7 @@ parse_escaped_string(char *str)
|
|||
#if DEBUG >= DEBUG_STRINGS
|
||||
if (DEBUG_LEVEL >= DEBUG_STRINGS) {
|
||||
D_STRINGS(("New value is:\n"));
|
||||
hex_dump(str, (size_t) (pnew - str));
|
||||
spiftool_hex_dump(str, (size_t) (pnew - str));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -234,7 +234,7 @@ escape_string(spif_charptr_t str, spif_char_t quote, spif_int32_t maxlen)
|
|||
}
|
||||
|
||||
/* The escaped string will be at most twice the length of the original. */
|
||||
buff = SPIF_CAST(charptr) MALLOC(strlen(SPIF_CAST_PTR(char) str) * 2 + 1);
|
||||
buff = (spif_charptr_t) MALLOC(strlen((char *) str) * 2 + 1);
|
||||
|
||||
/* Copy and escape the string from str into buff. */
|
||||
for (pbuff = buff; (*s); s++, pbuff++) {
|
||||
|
@ -316,7 +316,7 @@ add_carriage_returns(unsigned char *buff, unsigned long cnt)
|
|||
register unsigned char *out, *outp, *in;
|
||||
register unsigned long i;
|
||||
|
||||
D_CMD(("buff == %8p \"%s\", cnt == %lu\n", buff, safe_print_string(buff, cnt), cnt));
|
||||
D_CMD(("buff == %8p \"%s\", cnt == %lu\n", buff, safe_print_string((spif_charptr_t) buff, cnt), cnt));
|
||||
outp = out = (unsigned char *) MALLOC(cnt * 2);
|
||||
for (i = 0, in = buff; i < cnt; i++) {
|
||||
if (*in == '\n') {
|
||||
|
@ -327,14 +327,14 @@ add_carriage_returns(unsigned char *buff, unsigned long cnt)
|
|||
i = (unsigned long) (out - outp);
|
||||
memcpy(buff, outp, i);
|
||||
FREE(outp);
|
||||
D_CMD(("buff == %8p \"%s\", i == %lu\n", buff, safe_print_string(buff, i), i));
|
||||
D_CMD(("buff == %8p \"%s\", i == %lu\n", buff, safe_print_string((spif_charptr_t) buff, i), i));
|
||||
return i;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
mkdirhier(const char *path)
|
||||
{
|
||||
char *str, *pstr;
|
||||
spif_charptr_t str, pstr;
|
||||
struct stat dst;
|
||||
|
||||
D_CMD(("path == %s\n", path));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
127
src/netdisp.c
|
@ -1,127 +0,0 @@
|
|||
/*----------------------------------------------------------------------*
|
||||
* support for resolving the actual IP number of the host for remote
|
||||
* DISPLAYs. When the display is local (i.e. :0), we add support for
|
||||
* sending the first non-loopback interface IP number as the DISPLAY
|
||||
* instead of just sending the incorrect ":0". This way telnet/rlogin
|
||||
* shells can actually get the correct information into DISPLAY for
|
||||
* xclients.
|
||||
*
|
||||
* Copyright 1996 Chuck Blake <cblake@BBN.COM>
|
||||
*
|
||||
+ * Cleaned up somewhat by mj olesen <olesen@me.queensu.ca>
|
||||
+ *
|
||||
* You can do what you like with this source code as long as you don't try
|
||||
* to make money out of it and you include an unaltered copy of this
|
||||
* message (including the copyright).
|
||||
*
|
||||
* As usual, the author accepts no responsibility for anything, nor does
|
||||
* he guarantee anything whatsoever.
|
||||
*----------------------------------------------------------------------*/
|
||||
|
||||
static const char cvs_ident[] = "$Id$";
|
||||
|
||||
#include "config.h"
|
||||
#include "feature.h"
|
||||
|
||||
#ifdef DISPLAY_IS_IP
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#ifdef HAVE_SYS_SOCKIO_H
|
||||
# include <sys/sockio.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_BYTEORDER_H
|
||||
# include <sys/byteorder.h>
|
||||
#endif
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <time.h>
|
||||
# endif
|
||||
#endif
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
|
||||
#include "startup.h"
|
||||
|
||||
/* return a pointer to a static buffer */
|
||||
char *
|
||||
network_display(const char *display)
|
||||
{
|
||||
|
||||
static char ipaddress[32] = "";
|
||||
char buffer[1024], *rval = NULL;
|
||||
struct ifconf ifc;
|
||||
struct ifreq *ifr;
|
||||
int i, skfd;
|
||||
|
||||
if (display[0] != ':' && strncmp(display, "unix:", 5))
|
||||
return display; /* nothing to do */
|
||||
|
||||
ifc.ifc_len = sizeof(buffer); /* Get names of all ifaces */
|
||||
ifc.ifc_buf = buffer;
|
||||
|
||||
if ((skfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
|
||||
perror("socket");
|
||||
return NULL;
|
||||
}
|
||||
if (ioctl(skfd, SIOCGIFCONF, &ifc) < 0) {
|
||||
perror("SIOCGIFCONF");
|
||||
close(skfd);
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0, ifr = ifc.ifc_req; i < (ifc.ifc_len / sizeof(struct ifreq)); i++, ifr++) {
|
||||
|
||||
struct ifreq ifr2;
|
||||
|
||||
snprintf(ifr2.ifr_name, sizeof(ifr2.ifr_name), ifr->ifr_name);
|
||||
if (ioctl(skfd, SIOCGIFADDR, &ifr2) >= 0) {
|
||||
unsigned long addr;
|
||||
struct sockaddr_in *p_addr;
|
||||
|
||||
p_addr = (struct sockaddr_in *) &(ifr2.ifr_addr);
|
||||
addr = htonl((unsigned long) p_addr->sin_addr.s_addr);
|
||||
|
||||
/*
|
||||
* not "0.0.0.0" or "127.0.0.1" - so format the address
|
||||
*/
|
||||
if (addr && addr != 0x7F000001) {
|
||||
char *colon = strchr(display, ':');
|
||||
|
||||
if (colon == NULL)
|
||||
colon = ":0.0";
|
||||
|
||||
sprintf(ipaddress, "%d.%d.%d.%d%s", (int) ((addr >> 030) & 0xFF), (int) ((addr >> 020) & 0xFF),
|
||||
(int) ((addr >> 010) & 0xFF), (int) (addr & 0xFF), colon);
|
||||
|
||||
rval = ipaddress;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close(skfd);
|
||||
return rval;
|
||||
}
|
||||
#endif /* DISPLAY_IS_IP */
|
||||
/*----------------------- end-of-file (C source) -----------------------*/
|
673
src/options.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -42,6 +42,7 @@
|
|||
# define VT_OPTIONS_BOLD_BRIGHTENS_FOREGROUND (1LU << 11)
|
||||
# define VT_OPTIONS_BLINK_BRIGHTENS_BACKGROUND (1LU << 12)
|
||||
# define VT_OPTIONS_COLORS_SUPPRESS_BOLD (1LU << 13)
|
||||
# define VT_OPTIONS_URG_ALERT (1LU << 14)
|
||||
|
||||
# define ETERM_OPTIONS_LOGIN_SHELL (1LU << 0)
|
||||
# define ETERM_OPTIONS_ICONIC (1LU << 1)
|
||||
|
@ -61,6 +62,7 @@
|
|||
# define ETERM_OPTIONS_DOUBLE_BUFFER (1LU << 15)
|
||||
# define ETERM_OPTIONS_MBYTE_CURSOR (1LU << 16)
|
||||
# define ETERM_OPTIONS_RESIZE_GRAVITY (1LU << 17)
|
||||
# define ETERM_OPTIONS_STICKY (1LU << 18)
|
||||
|
||||
# define IMAGE_OPTIONS_TRANS (1U << 0)
|
||||
# define IMAGE_OPTIONS_ITRANS (1U << 1)
|
||||
|
@ -152,7 +154,7 @@ extern KeySym ks_smallfont;
|
|||
/************ Function Prototypes ************/
|
||||
_XFUNCPROTOBEGIN
|
||||
|
||||
extern char *conf_parse_theme(char **theme, char *conf_name, unsigned char fallback);
|
||||
extern char *spifconf_parse_theme(char **theme, char *spifconf_name, unsigned char fallback);
|
||||
extern void init_libast(void);
|
||||
extern void init_defaults(void);
|
||||
extern void post_parse(void);
|
||||
|
|
63
src/pixmap.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -625,7 +625,7 @@ check_image_ipc(unsigned char reset)
|
|||
snprintf(buff, sizeof(buff), "imageclass %s query", iclass);
|
||||
reply = enl_send_and_wait(buff);
|
||||
if (strstr(reply, "not")) {
|
||||
print_error("ImageClass \"%s\" is not defined in Enlightenment. Disallowing \"auto\" mode for this image.\n", iclass);
|
||||
libast_print_error("ImageClass \"%s\" is not defined in Enlightenment. Disallowing \"auto\" mode for this image.\n", iclass);
|
||||
image_mode_fallback(i);
|
||||
} else if (strstr(reply, "Error")) {
|
||||
/* *INDENT-OFF* */
|
||||
|
@ -642,7 +642,7 @@ check_image_ipc(unsigned char reset)
|
|||
}
|
||||
);
|
||||
/* *INDENT-ON* */
|
||||
print_error("Looks like this version of Enlightenment doesn't support the IPC "
|
||||
libast_print_error("Looks like this version of Enlightenment doesn't support the IPC "
|
||||
"commands I need. Disallowing \"auto\" mode for all images.\n");
|
||||
FREE(reply);
|
||||
checked = 2;
|
||||
|
@ -686,17 +686,11 @@ create_trans_pixmap(simage_t *simg, unsigned char which, Drawable d, int x, int
|
|||
D_PIXMAP(("Created p [0x%08x] as a %hux%hu pixmap at %d, %d relative to window 0x%08x\n", p, width, height, x, y,
|
||||
desktop_window));
|
||||
if (p != None) {
|
||||
if (pw < scr->width || ph < scr->height) {
|
||||
D_PIXMAP(("Tiling %ux%u desktop pixmap 0x%08x onto p.\n", pw, ph, desktop_pixmap));
|
||||
XSetTile(Xdisplay, gc, desktop_pixmap);
|
||||
XSetTSOrigin(Xdisplay, gc, pw - (x % pw), ph - (y % ph));
|
||||
XSetFillStyle(Xdisplay, gc, FillTiled);
|
||||
XFillRectangle(Xdisplay, p, gc, 0, 0, width, height);
|
||||
} else {
|
||||
D_PIXMAP(("Copying %hux%hu rectangle at %d, %d from %ux%u desktop pixmap 0x%08x onto p.\n", width, height, x, y, pw, ph,
|
||||
desktop_pixmap));
|
||||
XCopyArea(Xdisplay, desktop_pixmap, p, gc, x, y, width, height, 0, 0);
|
||||
}
|
||||
D_PIXMAP(("Tiling %ux%u desktop pixmap 0x%08x onto p.\n", pw, ph, desktop_pixmap));
|
||||
XSetTile(Xdisplay, gc, desktop_pixmap);
|
||||
XSetTSOrigin(Xdisplay, gc, pw - (x % pw), ph - (y % ph));
|
||||
XSetFillStyle(Xdisplay, gc, FillTiled);
|
||||
XFillRectangle(Xdisplay, p, gc, 0, 0, width, height);
|
||||
if ((which != image_bg || (BITFIELD_IS_SET(image_options, IMAGE_OPTIONS_ITRANS))
|
||||
|| images[image_bg].current != images[image_bg].norm)
|
||||
&& need_colormod(simg->iml)) {
|
||||
|
@ -759,7 +753,7 @@ create_viewport_pixmap(simage_t *simg, Drawable d, int x, int y, unsigned short
|
|||
imlib_render_pixmaps_for_whole_image(&viewport_pixmap, &mask);
|
||||
}
|
||||
if (viewport_pixmap == None) {
|
||||
print_error("Delayed image load failure for \"%s\". Using solid color mode.\n", imlib_image_get_filename());
|
||||
libast_print_error("Delayed image load failure for \"%s\". Using solid color mode.\n", imlib_image_get_filename());
|
||||
image_set_mode(image_bg, MODE_SOLID);
|
||||
reset_simage(simg, RESET_ALL_SIMG);
|
||||
return None;
|
||||
|
@ -834,13 +828,13 @@ paste_simage(simage_t *simg, unsigned char which, Window win, Drawable d, unsign
|
|||
snprintf(buff, sizeof(buff), "imageclass %s apply_copy 0x%x %s %hd %hd", iclass, (int) d, state, w, h);
|
||||
reply = enl_send_and_wait(buff);
|
||||
if (strstr(reply, "Error")) {
|
||||
print_error
|
||||
libast_print_error
|
||||
("Enlightenment didn't seem to like something about my syntax. Disallowing \"auto\" mode for this image.\n");
|
||||
image_mode_fallback(which);
|
||||
FREE(reply);
|
||||
} else {
|
||||
pmap = (Pixmap) strtoul(reply, (char **) NULL, 0);
|
||||
mask = (Pixmap) strtoul(get_pword(2, reply), (char **) NULL, 0);
|
||||
mask = (Pixmap) strtoul(spiftool_get_pword(2, reply), (char **) NULL, 0);
|
||||
FREE(reply);
|
||||
enl_ipc_sync();
|
||||
if (pmap) {
|
||||
|
@ -853,7 +847,7 @@ paste_simage(simage_t *simg, unsigned char which, Window win, Drawable d, unsign
|
|||
LIBAST_X_FREE_GC(gc);
|
||||
return;
|
||||
} else {
|
||||
print_error
|
||||
libast_print_error
|
||||
("Enlightenment returned a null pixmap, which I can't use. Disallowing \"auto\" mode for this image.\n");
|
||||
FREE(reply);
|
||||
image_mode_fallback(which);
|
||||
|
@ -906,7 +900,7 @@ paste_simage(simage_t *simg, unsigned char which, Window win, Drawable d, unsign
|
|||
imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask, w, h);
|
||||
}
|
||||
if (pmap == None) {
|
||||
print_error("Delayed image load failure for \"%s\".\n", NONULL(imlib_image_get_filename()));
|
||||
libast_print_error("Delayed image load failure for \"%s\".\n", NONULL(imlib_image_get_filename()));
|
||||
reset_simage(simg, RESET_ALL_SIMG);
|
||||
return;
|
||||
}
|
||||
|
@ -1064,7 +1058,7 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
|
|||
height);
|
||||
reply = enl_send_and_wait(buff);
|
||||
if (strstr(reply, "Error")) {
|
||||
print_error
|
||||
libast_print_error
|
||||
("Enlightenment didn't seem to like something about my syntax. Disallowing \"auto\" mode for this image.\n");
|
||||
image_mode_fallback(which);
|
||||
FREE(reply);
|
||||
|
@ -1072,7 +1066,7 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
|
|||
Pixmap pmap, mask;
|
||||
|
||||
pmap = (Pixmap) strtoul(reply, (char **) NULL, 0);
|
||||
mask = (Pixmap) strtoul(get_pword(2, reply), (char **) NULL, 0);
|
||||
mask = (Pixmap) strtoul(spiftool_get_pword(2, reply), (char **) NULL, 0);
|
||||
FREE(reply);
|
||||
enl_ipc_sync();
|
||||
if (pmap) {
|
||||
|
@ -1094,7 +1088,7 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
|
|||
snprintf(buff, sizeof(buff), "imageclass %s free_pixmap 0x%08x", iclass, (int) pmap);
|
||||
enl_ipc_send(buff);
|
||||
} else {
|
||||
print_error
|
||||
libast_print_error
|
||||
("Enlightenment returned a null pixmap, which I can't use. Disallowing \"auto\" mode for this image.\n");
|
||||
FREE(reply);
|
||||
image_mode_fallback(which);
|
||||
|
@ -1251,6 +1245,7 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
|
|||
} else if (renderop & RENDER_FORCE_PIXMAP) {
|
||||
pixmap = simg->pmap->pixmap;
|
||||
simg->pmap->pixmap = LIBAST_X_CREATE_PIXMAP(width, height);
|
||||
D_PIXMAP(("Replacing pixmap 0x%08x with new pixmap 0x%08x.\n", pixmap, simg->pmap->pixmap));
|
||||
XCopyArea(Xdisplay, pixmap, simg->pmap->pixmap, gc, 0, 0, width, height, 0, 0);
|
||||
IMLIB_FREE_PIXMAP(pixmap);
|
||||
} else {
|
||||
|
@ -1273,7 +1268,7 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
|
|||
}
|
||||
}
|
||||
} else {
|
||||
print_error("Delayed image load failure for \"%s\". Using solid color mode.\n", imlib_image_get_filename());
|
||||
libast_print_error("Delayed image load failure for \"%s\". Using solid color mode.\n", imlib_image_get_filename());
|
||||
image_set_mode(which, MODE_SOLID);
|
||||
reset_simage(simg, RESET_ALL_SIMG);
|
||||
}
|
||||
|
@ -1452,7 +1447,7 @@ load_image(const char *file, simage_t *simg)
|
|||
if (f != NULL) {
|
||||
im = imlib_load_image_with_error_return(f, &im_err);
|
||||
if (im == NULL) {
|
||||
print_error("Unable to load image file \"%s\" -- %s\n", file, imlib_strerror(im_err));
|
||||
libast_print_error("Unable to load image file \"%s\" -- %s\n", file, imlib_strerror(im_err));
|
||||
return 0;
|
||||
} else {
|
||||
reset_simage(simg, (RESET_IMLIB_IM | RESET_PMAP_PIXMAP | RESET_PMAP_MASK));
|
||||
|
@ -1461,7 +1456,7 @@ load_image(const char *file, simage_t *simg)
|
|||
D_PIXMAP(("Found image %8p.\n", im));
|
||||
return 1;
|
||||
} else {
|
||||
print_error("Unable to locate file \"%s\" in image path.\n");
|
||||
libast_print_error("Unable to locate file \"%s\" in image path.\n");
|
||||
}
|
||||
}
|
||||
reset_simage(simg, RESET_ALL_SIMG);
|
||||
|
@ -1748,14 +1743,7 @@ shade_ximage_24(void *data, int bpl, int w, int h, int rm, int gm, int bm)
|
|||
void
|
||||
colormod_trans(Pixmap p, imlib_t *iml, GC gc, unsigned short w, unsigned short h)
|
||||
{
|
||||
|
||||
#ifdef HAVE_SSE2
|
||||
XImage * __attribute__ ((aligned(16))) ximg;
|
||||
#elif defined HAVE_MMX
|
||||
XImage * __attribute__ ((aligned(8))) ximg;
|
||||
#else
|
||||
XImage *ximg;
|
||||
#endif
|
||||
register unsigned long i;
|
||||
|
||||
#if 0
|
||||
|
@ -1824,7 +1812,7 @@ colormod_trans(Pixmap p, imlib_t *iml, GC gc, unsigned short w, unsigned short h
|
|||
}
|
||||
ximg = XGetImage(Xdisplay, p, 0, 0, w, h, -1, ZPixmap);
|
||||
if (ximg == NULL) {
|
||||
print_warning("XGetImage(Xdisplay, 0x%08x, 0, 0, %d, %d, -1, ZPixmap) returned NULL.\n", p, w, h);
|
||||
libast_print_warning("XGetImage(Xdisplay, 0x%08x, 0, 0, %d, %d, -1, ZPixmap) returned NULL.\n", p, w, h);
|
||||
return;
|
||||
}
|
||||
D_PIXMAP(("XGetImage(Xdisplay, 0x%08x, 0, 0, %d, %d, -1, ZPixmap) returned %8p.\n", p, w, h, ximg));
|
||||
|
@ -1887,6 +1875,7 @@ colormod_trans(Pixmap p, imlib_t *iml, GC gc, unsigned short w, unsigned short h
|
|||
if (ximg->bits_per_pixel != 32) {
|
||||
D_PIXMAP(("Rendering 24 bit\n"));
|
||||
shade_ximage_24(ximg->data, ximg->bytes_per_line, w, h, rm, gm, bm);
|
||||
break;
|
||||
}
|
||||
/* drop */
|
||||
case 32:
|
||||
|
@ -1902,7 +1891,7 @@ colormod_trans(Pixmap p, imlib_t *iml, GC gc, unsigned short w, unsigned short h
|
|||
#endif
|
||||
break;
|
||||
default:
|
||||
print_warning("Bit depth of %d is unsupported for tinting/shading.\n", real_depth);
|
||||
libast_print_warning("Bit depth of %d is unsupported for tinting/shading.\n", real_depth);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1927,7 +1916,7 @@ update_desktop_info(int *w, int *h)
|
|||
get_desktop_window();
|
||||
}
|
||||
if (desktop_window == None) {
|
||||
print_error("Unable to locate desktop window. If you are running Enlightenment, please\n"
|
||||
libast_print_error("Unable to locate desktop window. If you are running Enlightenment, please\n"
|
||||
"restart. If not, please set your background image with Esetroot, then try again.");
|
||||
return 0;
|
||||
}
|
||||
|
@ -1945,7 +1934,7 @@ update_desktop_info(int *w, int *h)
|
|||
XGetGeometry(Xdisplay, desktop_pixmap, &dummy, &px, &py, &pw, &ph, &pb, &pd);
|
||||
}
|
||||
if ((pw <= 0) || (ph <= 0)) {
|
||||
print_error("Value of desktop pixmap property is invalid. Please restart your \n"
|
||||
libast_print_error("Value of desktop pixmap property is invalid. Please restart your \n"
|
||||
"window manager or use Esetroot to set a new one.");
|
||||
desktop_pixmap = None;
|
||||
return 0;
|
||||
|
@ -2190,7 +2179,7 @@ set_icon_pixmap(char *filename, XWMHints * pwm_hints)
|
|||
|
||||
temp_im = imlib_load_image_with_error_return(icon_path, &im_err);
|
||||
if (temp_im == NULL) {
|
||||
print_error("Unable to load icon file \"%s\" -- %s\n", icon_path, imlib_strerror(im_err));
|
||||
libast_print_error("Unable to load icon file \"%s\" -- %s\n", icon_path, imlib_strerror(im_err));
|
||||
} else {
|
||||
/* If we're going to render the image anyway, might as well be nice and give it to the WM in a size it likes. */
|
||||
if (XGetIconSizes(Xdisplay, Xroot, &icon_sizes, &count)) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define NS_SCREEN_PRVS_REG "\x01:focus up\r"
|
||||
|
||||
#define NS_DFLT_SSH_PORT 22
|
||||
#define NS_MIN_PORT 1025
|
||||
#define NS_MIN_PORT 47323
|
||||
#define NS_MAX_PORT 65535
|
||||
|
||||
#define NS_MAX_DISPS 512
|
||||
|
@ -68,12 +68,12 @@
|
|||
#define NS_SCREEN_ACT_T "Activity in window "
|
||||
|
||||
/* should be 1s */
|
||||
#define NS_INIT_DELAY 1
|
||||
#define NS_INIT_DELAY 2
|
||||
|
||||
/* how many seconds to wait for an SSH-tunnel to build when using the
|
||||
-Z option (tunnel through firewall). 2 for very fast networks,
|
||||
much more for slow connections. */
|
||||
#define NS_TUNNEL_DELAY 3
|
||||
#define NS_TUNNEL_DELAY 30
|
||||
|
||||
/* what to call the menu entry for Escreen */
|
||||
#define NS_MENU_TITLE "Escreen"
|
||||
|
|
65
src/screen.c
|
@ -1552,6 +1552,14 @@ scr_page(int direction, int nlines)
|
|||
void
|
||||
scr_bell(void)
|
||||
{
|
||||
XWMHints *wm_hints;
|
||||
|
||||
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_URG_ALERT)) {
|
||||
wm_hints = XGetWMHints(Xdisplay, TermWin.parent);
|
||||
wm_hints->flags |= XUrgencyHint;
|
||||
XSetWMHints(Xdisplay, TermWin.parent, wm_hints);
|
||||
XFree(wm_hints);
|
||||
}
|
||||
#ifndef NO_MAPALERT
|
||||
#ifdef MAPALERT_OPTION
|
||||
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_MAP_ALERT))
|
||||
|
@ -1562,7 +1570,7 @@ scr_bell(void)
|
|||
scr_rvideo_mode(!rvideo);
|
||||
scr_rvideo_mode(!rvideo);
|
||||
} else if (!SPIF_PTR_ISNULL(rs_beep_command) && (*rs_beep_command)) {
|
||||
system_no_wait(SPIF_CAST_C(char *)rs_beep_command);
|
||||
system_no_wait((char *) rs_beep_command);
|
||||
} else {
|
||||
XBell(Xdisplay, 0);
|
||||
}
|
||||
|
@ -2473,8 +2481,8 @@ selection_fetch(Window win, unsigned prop, int delete)
|
|||
return;
|
||||
}
|
||||
nread += nitems;
|
||||
D_SELECT(("Got selection info: Actual type %d (format %d), %lu items at 0x%08x, %lu bytes left over.\n", (int) actual_type,
|
||||
actual_fmt, nitems, data, bytes_after));
|
||||
D_SELECT(("Got selection info: Actual type %d (format %d), %lu items at 0x%08x, %lu bytes left over.\n",
|
||||
(int) actual_type, actual_fmt, nitems, data, bytes_after));
|
||||
|
||||
if (nitems == 0) {
|
||||
D_SELECT(("Retrieval of incremental selection complete.\n"));
|
||||
|
@ -2523,14 +2531,15 @@ selection_fetch(Window win, unsigned prop, int delete)
|
|||
void
|
||||
selection_copy_string(Atom sel, char *str, size_t len)
|
||||
{
|
||||
D_SELECT(("Copying %ul bytes from 0x%08x to selection %d\n", len, str, (int) sel));
|
||||
if (str == NULL || len == 0) {
|
||||
return;
|
||||
}
|
||||
if (IS_SELECTION(sel)) {
|
||||
D_SELECT(("Copying selection to selection %d\n", (int) sel));
|
||||
D_SELECT(("Changing ownership of selection %d to my window 0x%08x\n", (int) sel, (int) TermWin.vt));
|
||||
XSetSelectionOwner(Xdisplay, sel, TermWin.vt, CurrentTime);
|
||||
if (XGetSelectionOwner(Xdisplay, sel) != TermWin.vt) {
|
||||
print_error("Can't take ownership of selection\n");
|
||||
libast_print_error("Can't take ownership of selection\n");
|
||||
}
|
||||
} else {
|
||||
D_SELECT(("Copying selection to cut buffer %d\n", (int) sel));
|
||||
|
@ -2549,30 +2558,25 @@ selection_copy(Atom sel)
|
|||
void
|
||||
selection_paste(Atom sel)
|
||||
{
|
||||
D_SELECT(("Attempting to paste selection %d.\n", (int) sel));
|
||||
if (selection.text != NULL) {
|
||||
/* If we have a selection of our own, paste it. */
|
||||
D_SELECT(("Pasting my current selection of length %lu\n", selection.len));
|
||||
selection_write(selection.text, selection.len);
|
||||
} else if (IS_SELECTION(sel)) {
|
||||
if (XGetSelectionOwner(Xdisplay, sel) == None) {
|
||||
/* If nobody owns the current selection, just try to paste it ourselves. */
|
||||
D_SELECT(("Current selection %d unowned. Attempting to paste the default cut buffer.\n", (int) sel));
|
||||
selection_fetch(Xroot, XA_CUT_BUFFER0, False);
|
||||
} else {
|
||||
/* If someone owns the current selection, send a request to that client to
|
||||
convert the selection to the appropriate form (usually XA_STRING) and
|
||||
save it for us in the VT_SELECTION property. We'll then get a SelectionNotify. */
|
||||
D_SELECT(("Requesting current selection (%d) -> VT_SELECTION (%d)\n", sel, props[PROP_SELECTION_DEST]));
|
||||
/* Request the current selection be converted to the appropriate
|
||||
form (usually XA_STRING) and save it for us in the VT_SELECTION
|
||||
property. We'll then get a SelectionNotify. */
|
||||
D_SELECT(("Requesting current selection (%d) -> VT_SELECTION (%d)\n", sel, props[PROP_SELECTION_DEST]));
|
||||
#if defined(MULTI_CHARSET) && defined(HAVE_X11_XMU_ATOMS_H)
|
||||
if (encoding_method != LATIN1) {
|
||||
XConvertSelection(Xdisplay, sel, XA_COMPOUND_TEXT(Xdisplay), props[PROP_SELECTION_DEST], TermWin.vt, CurrentTime);
|
||||
} else {
|
||||
XConvertSelection(Xdisplay, sel, XA_STRING, props[PROP_SELECTION_DEST], TermWin.vt, CurrentTime);
|
||||
}
|
||||
#else
|
||||
if (encoding_method != LATIN1) {
|
||||
XConvertSelection(Xdisplay, sel, XA_COMPOUND_TEXT(Xdisplay), props[PROP_SELECTION_DEST], TermWin.vt, CurrentTime);
|
||||
} else {
|
||||
XConvertSelection(Xdisplay, sel, XA_STRING, props[PROP_SELECTION_DEST], TermWin.vt, CurrentTime);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
XConvertSelection(Xdisplay, sel, XA_STRING, props[PROP_SELECTION_DEST], TermWin.vt, CurrentTime);
|
||||
#endif
|
||||
} else {
|
||||
D_SELECT(("Pasting cut buffer %d.\n", (int) sel));
|
||||
selection_fetch(Xroot, sel, False);
|
||||
|
@ -3287,13 +3291,6 @@ selection_rotate(int x, int y)
|
|||
selection_extend_colrow(col, row, 1, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* On some systems, the Atom typedef is 64 bits wide. We need to have a type
|
||||
* that is exactly 32 bits wide, because a format of 64 is not allowed by
|
||||
* the X11 protocol.
|
||||
*/
|
||||
typedef CARD32 Atom32;
|
||||
|
||||
/*
|
||||
* Respond to a request for our current selection
|
||||
* EXT: SelectionRequest
|
||||
|
@ -3302,7 +3299,7 @@ void
|
|||
selection_send(XSelectionRequestEvent * rq)
|
||||
{
|
||||
XEvent ev;
|
||||
Atom32 target_list[2];
|
||||
long target_list[2];
|
||||
|
||||
ev.xselection.type = SelectionNotify;
|
||||
ev.xselection.property = None;
|
||||
|
@ -3313,10 +3310,10 @@ selection_send(XSelectionRequestEvent * rq)
|
|||
ev.xselection.time = rq->time;
|
||||
|
||||
if (rq->target == props[PROP_SELECTION_TARGETS]) {
|
||||
target_list[0] = (Atom32) props[PROP_SELECTION_TARGETS];
|
||||
target_list[1] = (Atom32) XA_STRING;
|
||||
target_list[0] = props[PROP_SELECTION_TARGETS];
|
||||
target_list[1] = XA_STRING;
|
||||
XChangeProperty(Xdisplay, rq->requestor, rq->property, rq->target,
|
||||
(8 * sizeof(target_list[0])), PropModeReplace, (unsigned char *) target_list,
|
||||
32, PropModeReplace, (unsigned char *) target_list,
|
||||
(sizeof(target_list) / sizeof(target_list[0])));
|
||||
ev.xselection.property = rq->property;
|
||||
#if defined(MULTI_CHARSET) && defined(HAVE_X11_XMU_ATOMS_H)
|
||||
|
@ -3329,8 +3326,8 @@ selection_send(XSelectionRequestEvent * rq)
|
|||
xtextp.nitems = 0;
|
||||
if (XmbTextListToTextProperty(Xdisplay, l, 1, XCompoundTextStyle, &xtextp) == Success) {
|
||||
if (xtextp.nitems > 0 && xtextp.value != NULL) {
|
||||
XChangeProperty(Xdisplay, rq->requestor, rq->property, XA_COMPOUND_TEXT(Xdisplay), 8, PropModeReplace, xtextp.value,
|
||||
xtextp.nitems);
|
||||
XChangeProperty(Xdisplay, rq->requestor, rq->property, XA_COMPOUND_TEXT(Xdisplay),
|
||||
8, PropModeReplace, xtextp.value, xtextp.nitems);
|
||||
ev.xselection.property = rq->property;
|
||||
}
|
||||
}
|
||||
|
|
106
src/script.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -103,13 +103,13 @@ eterm_handle_winop(char *action)
|
|||
int x, y, n;
|
||||
char *xx, *yy;
|
||||
|
||||
n = num_words(action);
|
||||
n = spiftool_num_words(action);
|
||||
if (n == 3 || n == 4) {
|
||||
if (n == 3) {
|
||||
win = TermWin.parent;
|
||||
}
|
||||
xx = get_pword(n - 1, action);
|
||||
yy = get_pword(n, action);
|
||||
xx = spiftool_get_pword(n - 1, action);
|
||||
yy = spiftool_get_pword(n, action);
|
||||
x = (int) strtol(xx, (char **) NULL, 0);
|
||||
y = (int) strtol(yy, (char **) NULL, 0);
|
||||
XMoveWindow(Xdisplay, win, x, y);
|
||||
|
@ -118,13 +118,13 @@ eterm_handle_winop(char *action)
|
|||
int w, h, n;
|
||||
char *ww, *hh;
|
||||
|
||||
n = num_words(action);
|
||||
n = spiftool_num_words(action);
|
||||
if (n == 3 || n == 4) {
|
||||
if (n == 3) {
|
||||
win = TermWin.parent;
|
||||
}
|
||||
ww = get_pword(n - 1, action);
|
||||
hh = get_pword(n, action);
|
||||
ww = spiftool_get_pword(n - 1, action);
|
||||
hh = spiftool_get_pword(n, action);
|
||||
w = (int) strtol(ww, (char **) NULL, 0);
|
||||
h = (int) strtol(hh, (char **) NULL, 0);
|
||||
XResizeWindow(Xdisplay, win, w, h);
|
||||
|
@ -134,7 +134,7 @@ eterm_handle_winop(char *action)
|
|||
} else if (!BEG_STRCASECMP(action, "iconify")) {
|
||||
XIconifyWindow(Xdisplay, win, Xscreen);
|
||||
} else {
|
||||
print_error("IPC Error: Unrecognized window operation \"%s\"\n", action);
|
||||
libast_print_error("IPC Error: Unrecognized window operation \"%s\"\n", action);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -153,7 +153,7 @@ eterm_handle_winop(char *action)
|
|||
* the "primary" buffer (XA_PRIMARY in Xlib-speak).
|
||||
*/
|
||||
void
|
||||
script_handler_copy(char **params)
|
||||
script_handler_copy(spif_charptr_t *params)
|
||||
{
|
||||
unsigned char i;
|
||||
char *buffer_id;
|
||||
|
@ -171,7 +171,7 @@ script_handler_copy(char **params)
|
|||
} else if (!BEG_STRCASECMP(buffer_id, "secondary")) {
|
||||
sel = XA_SECONDARY;
|
||||
} else {
|
||||
print_error("Invalid parameter to copy(): \"%s\"\n", buffer_id);
|
||||
libast_print_error("Invalid parameter to copy(): \"%s\"\n", buffer_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,9 +186,9 @@ script_handler_copy(char **params)
|
|||
* <string> is the string of characters to send to the pty.
|
||||
*/
|
||||
void
|
||||
script_handler_echo(char **params)
|
||||
script_handler_echo(spif_charptr_t *params)
|
||||
{
|
||||
char **tmp;
|
||||
spif_charptr_t *tmp;
|
||||
|
||||
for (tmp = params; tmp && *tmp; tmp++) {
|
||||
tt_write(*tmp, strlen(*tmp));
|
||||
|
@ -205,7 +205,7 @@ script_handler_echo(char **params)
|
|||
* and no message.
|
||||
*/
|
||||
void
|
||||
script_handler_exit(char **params)
|
||||
script_handler_exit(spif_charptr_t *params)
|
||||
{
|
||||
unsigned char code = 0;
|
||||
char *tmp;
|
||||
|
@ -214,7 +214,7 @@ script_handler_exit(char **params)
|
|||
if (isdigit(params[0][0]) || (params[0][0] == '-' && isdigit(params[0][1]))) {
|
||||
code = (unsigned char) atoi(params[0]);
|
||||
} else {
|
||||
tmp = join(" ", params);
|
||||
tmp = spiftool_join(" ", params);
|
||||
printf("Exiting: %s\n", tmp);
|
||||
FREE(tmp);
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ script_handler_exit(char **params)
|
|||
* specified, SIGTERM is the default.
|
||||
*/
|
||||
void
|
||||
script_handler_kill(char **params)
|
||||
script_handler_kill(spif_charptr_t *params)
|
||||
{
|
||||
int sig;
|
||||
|
||||
|
@ -254,7 +254,7 @@ script_handler_kill(char **params)
|
|||
* the "primary" buffer (XA_PRIMARY in Xlib-speak).
|
||||
*/
|
||||
void
|
||||
script_handler_paste(char **params)
|
||||
script_handler_paste(spif_charptr_t *params)
|
||||
{
|
||||
unsigned char i;
|
||||
char *buffer_id;
|
||||
|
@ -272,7 +272,7 @@ script_handler_paste(char **params)
|
|||
} else if (!BEG_STRCASECMP(buffer_id, "secondary")) {
|
||||
sel = XA_SECONDARY;
|
||||
} else {
|
||||
print_error("Invalid parameter to paste(): \"%s\"\n", buffer_id);
|
||||
libast_print_error("Invalid parameter to paste(): \"%s\"\n", buffer_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ script_handler_paste(char **params)
|
|||
* will be theme.cfg.
|
||||
*/
|
||||
void
|
||||
script_handler_save(char **params)
|
||||
script_handler_save(spif_charptr_t *params)
|
||||
{
|
||||
if (params && *params) {
|
||||
if (!strcasecmp(params[0], "theme")) {
|
||||
|
@ -312,7 +312,7 @@ script_handler_save(char **params)
|
|||
* the specified file.
|
||||
*/
|
||||
void
|
||||
script_handler_save_buff(char **params)
|
||||
script_handler_save_buff(spif_charptr_t *params)
|
||||
{
|
||||
if (params && *params) {
|
||||
scr_dump_to_file(params[0]);
|
||||
|
@ -334,7 +334,7 @@ script_handler_save_buff(char **params)
|
|||
* and the type may be passed as a second parameter if you wish.
|
||||
*/
|
||||
void
|
||||
script_handler_scroll(char **params)
|
||||
script_handler_scroll(spif_charptr_t *params)
|
||||
{
|
||||
char *type;
|
||||
double cnt_float;
|
||||
|
@ -361,7 +361,7 @@ script_handler_scroll(char **params)
|
|||
} else if (str_leading_match("buffers", type)) {
|
||||
count = (long) (cnt_float * (TermWin.nrow + TermWin.saveLines));
|
||||
} else {
|
||||
print_error("Invalid modifier \"%s\" in scroll()\n", type);
|
||||
libast_print_error("Invalid modifier \"%s\" in scroll()\n", type);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
@ -384,7 +384,7 @@ script_handler_scroll(char **params)
|
|||
* search() will clear the previously-highlighted search term.
|
||||
*/
|
||||
void
|
||||
script_handler_search(char **params)
|
||||
script_handler_search(spif_charptr_t *params)
|
||||
{
|
||||
static char *search = NULL;
|
||||
|
||||
|
@ -406,12 +406,12 @@ script_handler_search(char **params)
|
|||
* If no command is specified, the default is to execute another Eterm.
|
||||
*/
|
||||
void
|
||||
script_handler_spawn(char **params)
|
||||
script_handler_spawn(spif_charptr_t *params)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
if (params && *params) {
|
||||
tmp = join(" ", params);
|
||||
tmp = spiftool_join(" ", params);
|
||||
system_no_wait(tmp);
|
||||
FREE(tmp);
|
||||
} else {
|
||||
|
@ -426,9 +426,9 @@ script_handler_spawn(char **params)
|
|||
* <string> is the string of characters to send to the handler.
|
||||
*/
|
||||
void
|
||||
script_handler_string(char **params)
|
||||
script_handler_string(spif_charptr_t *params)
|
||||
{
|
||||
char **tmp;
|
||||
spif_charptr_t *tmp;
|
||||
|
||||
for (tmp = params; tmp && *tmp; tmp++) {
|
||||
cmd_write(*tmp, strlen(*tmp));
|
||||
|
@ -442,13 +442,13 @@ script_handler_string(char **params)
|
|||
* <command> is the command to be executed.
|
||||
*/
|
||||
void
|
||||
script_handler_exec_dialog(char **params)
|
||||
script_handler_exec_dialog(spif_charptr_t *params)
|
||||
{
|
||||
char *tmp;
|
||||
int ret;
|
||||
|
||||
if (params && *params) {
|
||||
tmp = join(" ", params);
|
||||
tmp = spiftool_join(" ", params);
|
||||
} else {
|
||||
tmp = NULL;
|
||||
}
|
||||
|
@ -469,12 +469,12 @@ script_handler_exec_dialog(char **params)
|
|||
* <message> is the message to present.
|
||||
*/
|
||||
void
|
||||
script_handler_msgbox(char **params)
|
||||
script_handler_msgbox(spif_charptr_t *params)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
if (params && *params) {
|
||||
tmp = join(" ", params);
|
||||
tmp = spiftool_join(" ", params);
|
||||
scr_refresh(DEFAULT_REFRESH);
|
||||
menu_dialog(NULL, tmp, 1, NULL, NULL);
|
||||
FREE(tmp);
|
||||
|
@ -500,7 +500,7 @@ script_handler_msgbox(char **params)
|
|||
* scrollback - View the scrollback for a display
|
||||
*/
|
||||
void
|
||||
script_handler_es_display(char **params)
|
||||
script_handler_es_display(spif_charptr_t *params)
|
||||
{
|
||||
_ns_sess *sess = TermWin.screen;
|
||||
char *p, *a;
|
||||
|
@ -511,7 +511,7 @@ script_handler_es_display(char **params)
|
|||
return;
|
||||
}
|
||||
|
||||
p = downcase_str(*params);
|
||||
p = spiftool_downcase_str(*params);
|
||||
a = params[index++];
|
||||
if (a && isdigit(*a)) {
|
||||
no = atoi(a);
|
||||
|
@ -565,7 +565,7 @@ script_handler_es_display(char **params)
|
|||
D_ESCREEN(("View scrollback on display %d\n", no));
|
||||
ns_sbb_disp(sess, no);
|
||||
} else {
|
||||
print_error("Error in script: \"display\" has no sub-function \"%s\".\n", p);
|
||||
libast_print_error("Error in script: \"display\" has no sub-function \"%s\".\n", p);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -588,7 +588,7 @@ script_handler_es_display(char **params)
|
|||
* scrollback - View the scrollback for a region
|
||||
*/
|
||||
void
|
||||
script_handler_es_region(char **params)
|
||||
script_handler_es_region(spif_charptr_t *params)
|
||||
{
|
||||
_ns_sess *sess = TermWin.screen;
|
||||
_ns_disp *disp;
|
||||
|
@ -606,7 +606,7 @@ script_handler_es_region(char **params)
|
|||
return;
|
||||
}
|
||||
|
||||
p = downcase_str(*params);
|
||||
p = spiftool_downcase_str(*params);
|
||||
a = params[index++];
|
||||
if (a && isdigit(*a)) {
|
||||
no = atoi(a);
|
||||
|
@ -626,7 +626,7 @@ script_handler_es_region(char **params)
|
|||
} else if (!strcmp(p, "toggle")) {
|
||||
D_ESCREEN(("Toggle region of display %8p\n", disp));
|
||||
ns_tog_region(sess, disp);
|
||||
} else if (!strcmp(p, "new") || !strcmp(p, "split")) {
|
||||
} else if (!strcmp(p, "new") || !strcmp(p, "spiftool_split")) {
|
||||
if (!a || !*a || !strcasecmp(a, "ask")) {
|
||||
D_ESCREEN(("region new ask\n"));
|
||||
ns_add_region(sess, disp, no, NULL);
|
||||
|
@ -660,7 +660,7 @@ script_handler_es_region(char **params)
|
|||
D_ESCREEN(("View scrollback for region %d of display %8p\n", no, disp));
|
||||
ns_sbb_region(sess, disp, no);
|
||||
} else {
|
||||
print_error("Error in script: \"region\" has no sub-function \"%s\".\n", p);
|
||||
libast_print_error("Error in script: \"region\" has no sub-function \"%s\".\n", p);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -671,12 +671,12 @@ script_handler_es_region(char **params)
|
|||
* <statement> is the Escreen (screen) statement to execute.
|
||||
*/
|
||||
void
|
||||
script_handler_es_statement(char **params)
|
||||
script_handler_es_statement(spif_charptr_t *params)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
if (params && *params) {
|
||||
tmp = join(" ", params);
|
||||
tmp = spiftool_join(" ", params);
|
||||
ns_statement(TermWin.screen, tmp);
|
||||
FREE(tmp);
|
||||
} else {
|
||||
|
@ -689,7 +689,7 @@ script_handler_es_statement(char **params)
|
|||
* Syntax: es_reset()
|
||||
*/
|
||||
void
|
||||
script_handler_es_reset(char **params)
|
||||
script_handler_es_reset(spif_charptr_t *params)
|
||||
{
|
||||
USE_VAR(params);
|
||||
ns_reset(TermWin.screen, 0);
|
||||
|
@ -703,7 +703,7 @@ script_handler_es_reset(char **params)
|
|||
* This function can be used to cancel undesired default behavior.
|
||||
*/
|
||||
void
|
||||
script_handler_nop(char **params)
|
||||
script_handler_nop(spif_charptr_t *params)
|
||||
{
|
||||
USE_VAR(params);
|
||||
}
|
||||
|
@ -728,7 +728,7 @@ eterm_script_handler_t *script_find_handler(const char *name)
|
|||
void
|
||||
script_parse(char *s)
|
||||
{
|
||||
char **token_list, **param_list;
|
||||
spif_charptr_t *token_list, *param_list;
|
||||
register char *pstr;
|
||||
register unsigned long i;
|
||||
char *func_name, *params, *tmp;
|
||||
|
@ -739,7 +739,7 @@ script_parse(char *s)
|
|||
|
||||
D_SCRIPT(("Parsing: \"%s\"\n", s));
|
||||
|
||||
token_list = split(";", s);
|
||||
token_list = spiftool_split(";", s);
|
||||
if (token_list == NULL) {
|
||||
D_SCRIPT(("No tokens found; ignoring script.\n"));
|
||||
return;
|
||||
|
@ -747,7 +747,7 @@ script_parse(char *s)
|
|||
|
||||
for (i = 0; token_list[i]; i++) {
|
||||
pstr = token_list[i];
|
||||
chomp(pstr);
|
||||
spiftool_chomp(pstr);
|
||||
if (!(*pstr)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -758,15 +758,15 @@ script_parse(char *s)
|
|||
strncpy(func_name, pstr, len);
|
||||
func_name[len] = 0;
|
||||
} else {
|
||||
print_error("Error in script \"%s\": Missing function name before \"%s\".\n", s, params);
|
||||
free_array((void **) token_list, 0);
|
||||
libast_print_error("Error in script \"%s\": Missing function name before \"%s\".\n", s, params);
|
||||
spiftool_free_array((void **) token_list, 0);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
func_name = STRDUP(pstr);
|
||||
}
|
||||
if (!func_name) {
|
||||
free_array((void **) token_list, 0);
|
||||
spiftool_free_array((void **) token_list, 0);
|
||||
return;
|
||||
}
|
||||
if (params) {
|
||||
|
@ -774,11 +774,11 @@ script_parse(char *s)
|
|||
if ((tmp = strrchr(params, ')')) != NULL) {
|
||||
*tmp = 0;
|
||||
} else {
|
||||
print_error("Error in script \"%s\": Missing closing parentheses for \"%s\".\n", s, token_list[i]);
|
||||
free_array((void **) token_list, 0);
|
||||
libast_print_error("Error in script \"%s\": Missing closing parentheses for \"%s\".\n", s, token_list[i]);
|
||||
spiftool_free_array((void **) token_list, 0);
|
||||
return;
|
||||
}
|
||||
param_list = split(", \t", params);
|
||||
param_list = spiftool_split(", \t", params);
|
||||
} else {
|
||||
param_list = NULL;
|
||||
}
|
||||
|
@ -786,12 +786,12 @@ script_parse(char *s)
|
|||
if ((func = script_find_handler(func_name)) != NULL) {
|
||||
(func->handler) (param_list);
|
||||
} else {
|
||||
print_error("Error in script \"%s\": No such function \"%s\".\n", s, func_name);
|
||||
libast_print_error("Error in script \"%s\": No such function \"%s\".\n", s, func_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (params) {
|
||||
free_array((void **) param_list, 0);
|
||||
spiftool_free_array((void **) param_list, 0);
|
||||
}
|
||||
free_array((void **) token_list, 0);
|
||||
spiftool_free_array((void **) token_list, 0);
|
||||
}
|
||||
|
|
40
src/script.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -31,7 +31,7 @@
|
|||
/************ Macros and Definitions ************/
|
||||
|
||||
/************ Structures ************/
|
||||
typedef void (*eterm_script_handler_function_t)(char **);
|
||||
typedef void (*eterm_script_handler_function_t)(spif_charptr_t *);
|
||||
typedef struct {
|
||||
char *name;
|
||||
eterm_script_handler_function_t handler;
|
||||
|
@ -43,26 +43,26 @@ typedef struct {
|
|||
_XFUNCPROTOBEGIN
|
||||
|
||||
/* Handlers */
|
||||
extern void script_handler_copy(char **);
|
||||
extern void script_handler_echo(char **);
|
||||
extern void script_handler_exec_dialog(char **);
|
||||
extern void script_handler_exit(char **);
|
||||
extern void script_handler_kill(char **);
|
||||
extern void script_handler_msgbox(char **);
|
||||
extern void script_handler_paste(char **);
|
||||
extern void script_handler_save(char **);
|
||||
extern void script_handler_save_buff(char **);
|
||||
extern void script_handler_scroll(char **);
|
||||
extern void script_handler_search(char **);
|
||||
extern void script_handler_spawn(char **);
|
||||
extern void script_handler_string(char **);
|
||||
extern void script_handler_nop(char **);
|
||||
extern void script_handler_copy(spif_charptr_t *);
|
||||
extern void script_handler_echo(spif_charptr_t *);
|
||||
extern void script_handler_exec_dialog(spif_charptr_t *);
|
||||
extern void script_handler_exit(spif_charptr_t *);
|
||||
extern void script_handler_kill(spif_charptr_t *);
|
||||
extern void script_handler_msgbox(spif_charptr_t *);
|
||||
extern void script_handler_paste(spif_charptr_t *);
|
||||
extern void script_handler_save(spif_charptr_t *);
|
||||
extern void script_handler_save_buff(spif_charptr_t *);
|
||||
extern void script_handler_scroll(spif_charptr_t *);
|
||||
extern void script_handler_search(spif_charptr_t *);
|
||||
extern void script_handler_spawn(spif_charptr_t *);
|
||||
extern void script_handler_string(spif_charptr_t *);
|
||||
extern void script_handler_nop(spif_charptr_t *);
|
||||
|
||||
#ifdef ESCREEN
|
||||
extern void script_handler_es_display(char **);
|
||||
extern void script_handler_es_region(char **);
|
||||
extern void script_handler_es_statement(char **);
|
||||
extern void script_handler_es_reset(char **);
|
||||
extern void script_handler_es_display(spif_charptr_t *);
|
||||
extern void script_handler_es_region(spif_charptr_t *);
|
||||
extern void script_handler_es_statement(spif_charptr_t *);
|
||||
extern void script_handler_es_reset(spif_charptr_t *);
|
||||
#endif
|
||||
|
||||
/* Engine */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -924,7 +924,7 @@ scrollbar_drawing_init(void)
|
|||
#ifdef XTERM_SCROLLBAR
|
||||
gcvalue.stipple = XCreateBitmapFromData(Xdisplay, scrollbar.win, (char *) xterm_sb_bits, 12, 2);
|
||||
if (!gcvalue.stipple) {
|
||||
print_error("Unable to create xterm scrollbar bitmap.\n\n");
|
||||
libast_print_error("Unable to create xterm scrollbar bitmap.\n\n");
|
||||
if (scrollbar_get_type() == SCROLLBAR_XTERM) {
|
||||
scrollbar_set_type(SCROLLBAR_MOTIF);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
755
src/sse2_cmod.c
|
@ -1,12 +1,17 @@
|
|||
/* File: sse2_cmod.c
|
||||
* Written and Copyright (C) 2005 by Tres Melton
|
||||
/*
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted to Michael Jennings to license this code as
|
||||
* he sees fit. I'd prefer the GPL but he will choose the BSD. The debate
|
||||
* is moot as this is to become a part of the Eterm project, for which he is
|
||||
* the primary author. For users of this code I ask that any modifications
|
||||
* be released back into the community but with Michael Jennings chooses the
|
||||
* BSD license then that request has no backing in law.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies of the Software, its documentation and marketing & publicity
|
||||
* materials, and acknowledgment shall be given in the documentation, materials
|
||||
* and software packages that this Software was used.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
|
@ -15,8 +20,9 @@
|
|||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Ported from <willem@stack.nl> Willem Monsuwe's original x86/MMX assembly
|
||||
* code by Tres Melton in 2005 and 2006. Anything copyrightable by me is
|
||||
* assigned to the Eterm project and its founder/maintainer: Michael Jennings.
|
||||
*
|
||||
* Much inspiration was drawn from the original x86 MMX port written by
|
||||
* Willem Monsuwe <willem@stack.nl> in pure x86/MMX Assembly. The MMX
|
||||
|
@ -25,6 +31,8 @@
|
|||
* ensure they worked with various gcc options. Further the code was
|
||||
* extended to take advantage of the 128 bit xmm registers in SSE2.
|
||||
*
|
||||
* The imlib2 code in Enlightenment also has a lot to teach on the subject.
|
||||
*
|
||||
* Manuals used in this port:
|
||||
* The Gnu Assembler
|
||||
* http://www.gnu.org/software/binutils/manual/gas-2.9.1/html_mono/as.html
|
||||
|
@ -65,21 +73,7 @@
|
|||
* assembly code in C functions is the only way to ensure that this code will continue to
|
||||
* function through a (however unlikely) change. If pure assembly were to be used as the
|
||||
* original MMX author, Willem Monsuwe, did and the ABI changed then this code would cease
|
||||
* to function properly. After examination of Willem's code I'm wondering if he
|
||||
* wrote it for GNU/Linux originally. The ENTER and LEAVE macros put all of the
|
||||
* parameters on the stack so that they can be accessed by references to the Base_Pointer
|
||||
* the way that ANSI C is defined. If he originally wrote this for GNU/Linux then he most
|
||||
* likely would have just used the registers instead of unwinding those optimizations
|
||||
* manually by pushing them to the stack. And if he explicitly wanted to use the stack
|
||||
* then there are parameters to gcc that would have performed those operations for him:
|
||||
* -mregparm/-mmemparm. Other gcc options that can tweak with the stack and the number
|
||||
* of registers available for function parameters are: -fcall-used/-fcall-saved,
|
||||
* -fcaller-saves, -fstack-protector, -fPIC/-fpic, -mno-push-args, etc.. It might be
|
||||
* advisable to check for these switches when using the original MMX code and emit a
|
||||
* warning if any are enabled. I know that the PIC option trashes the BX register and
|
||||
* that both Willem and I use that register. In other words If you do manage to get it
|
||||
* to compile & run w/ -fpic it WILL break. On the plus side, you can keep the pieces! :-)
|
||||
* On the other hand I could be wrong about everything
|
||||
* to function properly.
|
||||
*
|
||||
* In Conclusion:
|
||||
* Using C functions and inline assembly code should alleviate all of the concerns as the
|
||||
|
@ -94,268 +88,473 @@
|
|||
|
||||
#ifdef HAVE_SSE2
|
||||
|
||||
void
|
||||
shade_ximage_15_sse2(volatile void *data, volatile int bpl, volatile int w, volatile int h, volatile int rm, volatile int gm,
|
||||
volatile int bm)
|
||||
void shade_ximage_15_sse2( volatile void *data, volatile int bpl, volatile int w, volatile int h, volatile int rm, volatile int gm, volatile int bm )
|
||||
{
|
||||
__asm__ __volatile__(".align 16 \n\t" /* SIMD instructions should be aligned on 16 byte (128 bit) boundraries for performance reasons. */
|
||||
"leaq -14(%%rsi, %%rbx, 2), %%rsi\n\t" /* Load the stack index register with a pointer to data + ( width * bytes/pixel ) -6 */
|
||||
"negq %%rbx \n\t" /* Negate the width to that we can increment the counter */
|
||||
"jz 10f \n\t" /* Jump to end if the line count is zero */
|
||||
"movd %[red_mod], %%xmm5 \n\t" /* Load the color modifiers into mmx registers */
|
||||
"movd %[green_mod], %%xmm6 \n\t" /* " " */
|
||||
"movd %[blue_mod], %%xmm7 \n\t" /* " " */
|
||||
"punpcklwd %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low words. From A64_128bit_Media_Programming (p. 380) */
|
||||
"punpcklwd %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 16 bits into the next 16 bits (both operands are the same) */
|
||||
"punpcklwd %%xmm7, %%xmm7 \n\t" "punpckldq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low double words. From A64_128bit_Media_Programming (p. 376) */
|
||||
"punpckldq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 32 bits into the next 32 bits (both operands are the same) */
|
||||
"punpckldq %%xmm7, %%xmm7 \n\t" "punpcklqdq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low quad words. From A64_128bit_Media_Programming (p. 378) */
|
||||
"punpcklqdq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 64 bits into the next 64 bits (both operands are the same) */
|
||||
"punpcklqdq %%xmm7, %%xmm7 \n\t" "or %[red_mod], %[green_mod] \n\t" /* This, and the following 4 instructions, check to see if all three colormodifiers are */
|
||||
"or %[blue_mod], %[green_mod] \n\t" /* less than 256. If any of the modifiers are > 256 then they will have the 9th, or higher, */
|
||||
"sar $8, %[green_mod] \n\t" /* bit set. Then we shift off eight bits, leaving something set if a modifier > 256. */
|
||||
"movq %%rax, %[blue_mod] \n\t" /* Use the register named blue_mod to now store bytes_per_line. */
|
||||
"xor %[red_mod], %[red_mod] \n\t" /* zero red so we don't have to load an immediate value for the following compare. */
|
||||
"cmp %[red_mod], %[green_mod] \n\t" /* Compare the left over bits to zero */
|
||||
"jg 5f \n\t" /* If one of the colors (might) need saturated then jump to the secondary set of loops. */
|
||||
"1: \n\t" /* Start of the outer loop (lines). */
|
||||
"movq %%rbx, %%rcx \n\t" /* Move the width into the count register */
|
||||
"addq $7, %%rcx \n\t" "jns 3f \n\t" "2: \n\t" /* Start of the inner loop (pixels 8 at a time --> 8 * 16 = 128bits/xmm register ) */
|
||||
"movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t" /* Load the 16 bits of the pixel (5 bits for red, 6 bits for green, 5 bits for blue) */
|
||||
"movdqu %%xmm0, %%xmm1 \n\t" /* Create a copy of the pixel for the green color */
|
||||
"movdqu %%xmm0, %%xmm2 \n\t" /* Create a copy of the pixel for the blue color */
|
||||
"psrlw $5, %%xmm1 \n\t" /* Packed Shift Right Logical Words */
|
||||
/* From A64_128bit_Media_Programming (p. 347) */
|
||||
/* Shifts the blue off of the green color */
|
||||
"psrlw $10, %%xmm0 \n\t" /* Shifts the blue & green off of the red color */
|
||||
"psllw $11, %%xmm2 \n\t" /* Packed Shift Left Logical Words */
|
||||
/* From A64_128bit_Media_Programming (p. 330) */
|
||||
/* Shifts the red & green off of the blue color */
|
||||
"psllw $11, %%xmm1 \n\t" /* Shifts the red off of the green color */
|
||||
"psllw $8, %%xmm0 \n\t" /* Shifts the red color into position */
|
||||
"psrlw $3, %%xmm1 \n\t" /* Shifts the green color into position */
|
||||
"psrlw $3, %%xmm2 \n\t" /* Shifts the blue color into position */
|
||||
"pmulhw %%xmm5, %%xmm0 \n\t" /* color *= modifier */
|
||||
"pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" "psllw $10, %%xmm0 \n\t" /* Shift red back into its original position */
|
||||
"psllw $5, %%xmm1 \n\t" /* Shift green back into its original position */
|
||||
"por %%xmm2, %%xmm0 \n\t" /* Mesh the colors back together */
|
||||
"por %%xmm1, %%xmm0 \n\t" "movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t" /* Place the shaded 8 pixels back into the image map */
|
||||
"addq $8, %%rcx \n\t" "js 2b \n\t" "jmp 4f \n\t" "3: \n\t" /* Deal with pixels one at a time here. */
|
||||
"movw (%%rsi, %%rcx, 2), %%ax \n\t" "movd %%eax, %%xmm0 \n\t" "movq %%xmm0, %%xmm1 \n\t" "movq %%xmm0, %%xmm2 \n\t" "psrlw $5, %%xmm1 \n\t" "psrlw $10, %%xmm0 \n\t" "psllw $11, %%xmm2 \n\t" "psllw $11, %%xmm1 \n\t" "psllw $8, %%xmm0 \n\t" "psrlw $3, %%xmm1 \n\t" "psrlw $3, %%xmm2 \n\t" "pmulhw %%xmm5, %%xmm0 \n\t" "pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" "psllw $10, %%xmm0 \n\t" "psllw $5, %%xmm1 \n\t" "por %%xmm2, %%xmm0 \n\t" "por %%xmm1, %%xmm0 \n\t" "movd %%xmm0, %%eax \n\t" "movw %%ax, (%%rsi, %%rcx, 2) \n\t" "incq %%rcx \n\t" "4: \n\t" "cmpq $6, %%rcx \n\t" "jng 3b \n\t" "addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */
|
||||
"decq %%rdx \n\t" "jnz 1b \n\t" "jmp 10f \n\t" /* We're done! */
|
||||
"5: \n\t" /* Saturation is required */
|
||||
"pcmpeqw %%xmm3, %%xmm3 \n\t" /* Packed Compare Equal Words */
|
||||
/* From A64_128bit_Media_Programming (p. 276) */
|
||||
/* This sets xmm3 to 128 1's (since mm6 = mm6) */
|
||||
"psllw $5, %%xmm3 \n\t" /* xmm3 = 8 copies of 1111 1111 1110 0000 */
|
||||
"6: \n\t" "movq %%rbx, %%rcx \n\t" "addq $7, %%rcx \n\t" "jns 8f \n\t" "7: \n\t" "movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t" "movdqu %%xmm0, %%xmm1 \n\t" "movdqu %%xmm0, %%xmm2 \n\t" "psrlw $5, %%xmm1 \n\t" "psrlw $10, %%xmm0 \n\t" "psllw $11, %%xmm2 \n\t" "psllw $11, %%xmm1 \n\t" "psllw $8, %%xmm0 \n\t" "psrlw $3, %%xmm1 \n\t" "psrlw $3, %%xmm2 \n\t" "pmulhw %%xmm5, %%xmm0 \n\t" "pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" "paddusw %%xmm3, %%xmm0 \n\t" "paddusw %%xmm3, %%xmm1 \n\t" "paddusw %%xmm3, %%xmm2 \n\t" "psubw %%xmm3, %%xmm0 \n\t" /* FIXME: This line needs added to the original asm code */
|
||||
"psubw %%xmm3, %%xmm1 \n\t" "psubw %%xmm3, %%xmm2 \n\t" "psllw $10, %%xmm0 \n\t" "psllw $5, %%xmm1 \n\t" "por %%xmm2, %%xmm0 \n\t" "por %%xmm1, %%xmm0 \n\t" "movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t" "addq $8, %%rcx \n\t" "js 7b \n\t" "jmp 9f \n\t" "8: \n\t" "movw (%%rsi, %%rcx, 2), %%ax \n\t" "movd %%eax, %%xmm0 \n\t" "movq %%xmm0, %%xmm1 \n\t" "movq %%xmm0, %%xmm2 \n\t" "psrlw $5, %%xmm1 \n\t" "psrlw $10, %%xmm0 \n\t" "psllw $11, %%xmm2 \n\t" "psllw $11, %%xmm1 \n\t" "psllw $8, %%xmm0 \n\t" "psrlw $3, %%xmm1 \n\t" "psrlw $3, %%xmm2 \n\t" "pmulhw %%xmm5, %%xmm0 \n\t" "pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" "paddusw %%xmm3, %%xmm0 \n\t" "paddusw %%xmm3, %%xmm1 \n\t" "paddusw %%xmm3, %%xmm2 \n\t" "psubw %%xmm3, %%xmm0 \n\t" /* FIXME: This line needs added to the original asm code */
|
||||
"psubw %%xmm3, %%xmm1 \n\t" "psubw %%xmm3, %%xmm2 \n\t" "psllw $10, %%xmm0 \n\t" "psllw $5, %%xmm1 \n\t" "por %%xmm2, %%xmm0 \n\t" "por %%xmm1, %%xmm0 \n\t" "movd %%xmm0, %%eax \n\t" "movw %%ax, (%%rsi, %%rcx, 2) \n\t" "incq %%rcx \n\t" "9: \n\t" "cmpq $6, %%rcx \n\t" "jng 8b \n\t" "addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */
|
||||
"decq %%rdx \n\t" "jnz 6b \n\t" "10: \n\t" /* This is the end. Jump here if the line count is zero. */
|
||||
"emms \n\t" /* exit multi-media state (last asm instruction) */
|
||||
: /* outputs: none */
|
||||
/* inputs: (many operations cannot be performed with a mix of 32bit & 64bit operands directly) */
|
||||
/* (however the compiler/assembler can preload 32bit values into 64bit registers) */
|
||||
/* (that is why certain variables cannot be referenced by name -- use their register) */
|
||||
:[data] "S"(data), /* put the pointer data into the rsi register */
|
||||
[width] "b"(w), /* put the width in the %rbx register (cannot be referenced by name) */
|
||||
[height] "d"(h), /* put the heigth in the %rdx register (cannot be referenced by name) */
|
||||
[red_mod] "r"((unsigned long) (rm)), /* put the red_modifier in a register (referenced by name) */
|
||||
[green_mod] "r"((unsigned long) (gm)), /* put the green_modifier in a register (referenced by name) */
|
||||
[blue_mod] "r"((unsigned long) (bm)), /* put the blue_modifier in a register (referenced by name) Later store the bytes_line here */
|
||||
[bytes_line] "a"(bpl) /* put the bytes_per_line in the %rax register (cannot be referenced by name) */
|
||||
:"memory" /* clobbers: (memory includes all the registers) */
|
||||
); /* End of Assembly */
|
||||
__asm__ __volatile__ (
|
||||
".align 16 \n\t" /* SIMD instructions should be aligned on 16 byte (128 bit) boundraries for performance reasons.*/
|
||||
"leaq -14(%%rsi, %%rbx, 2), %%rsi\n\t" /* Load the stack index register with a pointer to data + ( width * bytes/pixel ) -6 */
|
||||
"negq %%rbx \n\t" /* Negate the width to that we can increment the counter */
|
||||
"jz 10f \n\t" /* Jump to end if the line count is zero */
|
||||
"movd %[red_mod], %%xmm5 \n\t" /* Load the color modifiers into mmx registers */
|
||||
"movd %[green_mod], %%xmm6 \n\t" /* " " */
|
||||
"movd %[blue_mod], %%xmm7 \n\t" /* " " */
|
||||
"punpcklwd %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low words. From A64_128bit_Media_Programming (p. 380) */
|
||||
"punpcklwd %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 16 bits into the next 16 bits (both operands are the same) */
|
||||
"punpcklwd %%xmm7, %%xmm7 \n\t"
|
||||
"punpckldq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low double words. From A64_128bit_Media_Programming (p. 376) */
|
||||
"punpckldq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 32 bits into the next 32 bits (both operands are the same) */
|
||||
"punpckldq %%xmm7, %%xmm7 \n\t"
|
||||
"punpcklqdq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low quad words. From A64_128bit_Media_Programming (p. 378) */
|
||||
"punpcklqdq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 64 bits into the next 64 bits (both operands are the same) */
|
||||
"punpcklqdq %%xmm7, %%xmm7 \n\t"
|
||||
"or %[red_mod], %[green_mod] \n\t" /* This, and the following 4 instructions, check to see if all three colormodifiers are */
|
||||
"or %[blue_mod], %[green_mod] \n\t" /* less than 256. If any of the modifiers are > 256 then they will have the 9th, or higher, */
|
||||
"sar $8, %[green_mod] \n\t" /* bit set. Then we shift off eight bits, leaving something set if a modifier > 256. */
|
||||
"movq %%rax, %[blue_mod] \n\t" /* Use the register named blue_mod to now store bytes_per_line. */
|
||||
"xor %[red_mod], %[red_mod] \n\t" /* zero red so we don't have to load an immediate value for the following compare. */
|
||||
"cmp %[red_mod], %[green_mod] \n\t" /* Compare the left over bits to zero */
|
||||
"jg 5f \n\t" /* If one of the colors (might) need saturated then jump to the secondary set of loops. */
|
||||
"1: \n\t" /* Start of the outer loop (lines). */
|
||||
"movq %%rbx, %%rcx \n\t" /* Move the width into the count register */
|
||||
"addq $7, %%rcx \n\t"
|
||||
"jns 3f \n\t"
|
||||
"2: \n\t" /* Start of the inner loop (pixels 8 at a time --> 8 * 16 = 128bits/xmm register ) */
|
||||
"movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t" /* Load the 16 bits of the pixel (5 bits for red, 6 bits for green, 5 bits for blue) */
|
||||
"movdqa %%xmm0, %%xmm1 \n\t" /* Create a copy of the pixel for the green color */
|
||||
"movdqa %%xmm0, %%xmm2 \n\t" /* Create a copy of the pixel for the blue color */
|
||||
"psrlw $5, %%xmm1 \n\t" /* Packed Shift Right Logical Words */
|
||||
/* From A64_128bit_Media_Programming (p. 347) */
|
||||
/* Shifts the blue off of the green color */
|
||||
"psrlw $10, %%xmm0 \n\t" /* Shifts the blue & green off of the red color */
|
||||
"psllw $11, %%xmm2 \n\t" /* Packed Shift Left Logical Words */
|
||||
/* From A64_128bit_Media_Programming (p. 330) */
|
||||
/* Shifts the red & green off of the blue color */
|
||||
"psllw $11, %%xmm1 \n\t" /* Shifts the red off of the green color */
|
||||
"psllw $8, %%xmm0 \n\t" /* Shifts the red color into position */
|
||||
"psrlw $3, %%xmm1 \n\t" /* Shifts the green color into position */
|
||||
"psrlw $3, %%xmm2 \n\t" /* Shifts the blue color into position */
|
||||
"pmulhw %%xmm5, %%xmm0 \n\t" /* color *= modifier */
|
||||
"pmulhw %%xmm6, %%xmm1 \n\t"
|
||||
"pmulhw %%xmm7, %%xmm2 \n\t"
|
||||
"psllw $10, %%xmm0 \n\t" /* Shift red back into its original position */
|
||||
"psllw $5, %%xmm1 \n\t" /* Shift green back into its original position */
|
||||
"por %%xmm2, %%xmm0 \n\t" /* Mesh the colors back together */
|
||||
"por %%xmm1, %%xmm0 \n\t"
|
||||
"movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t" /* Place the shaded 8 pixels back into the image map */
|
||||
"addq $8, %%rcx \n\t"
|
||||
"js 2b \n\t"
|
||||
"jmp 4f \n\t"
|
||||
"3: \n\t" /* Deal with pixels one at a time here. */
|
||||
"movw (%%rsi, %%rcx, 2), %%ax \n\t"
|
||||
"movd %%eax, %%xmm0 \n\t"
|
||||
"movq %%xmm0, %%xmm1 \n\t"
|
||||
"movq %%xmm0, %%xmm2 \n\t"
|
||||
"psrlw $5, %%xmm1 \n\t"
|
||||
"psrlw $10, %%xmm0 \n\t"
|
||||
"psllw $11, %%xmm2 \n\t"
|
||||
"psllw $11, %%xmm1 \n\t"
|
||||
"psllw $8, %%xmm0 \n\t"
|
||||
"psrlw $3, %%xmm1 \n\t"
|
||||
"psrlw $3, %%xmm2 \n\t"
|
||||
"pmulhw %%xmm5, %%xmm0 \n\t"
|
||||
"pmulhw %%xmm6, %%xmm1 \n\t"
|
||||
"pmulhw %%xmm7, %%xmm2 \n\t"
|
||||
"psllw $10, %%xmm0 \n\t"
|
||||
"psllw $5, %%xmm1 \n\t"
|
||||
"por %%xmm2, %%xmm0 \n\t"
|
||||
"por %%xmm1, %%xmm0 \n\t"
|
||||
"movd %%xmm0, %%eax \n\t"
|
||||
"movw %%ax, (%%rsi, %%rcx, 2) \n\t"
|
||||
"incq %%rcx \n\t"
|
||||
"4: \n\t"
|
||||
"cmpq $6, %%rcx \n\t"
|
||||
"jng 3b \n\t"
|
||||
"addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */
|
||||
"decq %%rdx \n\t"
|
||||
"jnz 1b \n\t"
|
||||
"jmp 10f \n\t" /* We're done! */
|
||||
|
||||
"5: \n\t" /* Saturation is required */
|
||||
"pcmpeqw %%xmm3, %%xmm3 \n\t" /* Packed Compare Equal Words */
|
||||
/* From A64_128bit_Media_Programming (p. 276) */
|
||||
/* This sets xmm3 to 128 1's (since mm6 = mm6) */
|
||||
"psllw $5, %%xmm3 \n\t" /* xmm3 = 8 copies of 1111 1111 1110 0000 */
|
||||
"6: \n\t"
|
||||
"movq %%rbx, %%rcx \n\t"
|
||||
"addq $7, %%rcx \n\t"
|
||||
"jns 8f \n\t"
|
||||
"7: \n\t"
|
||||
"movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t"
|
||||
"movdqa %%xmm0, %%xmm1 \n\t"
|
||||
"movdqa %%xmm0, %%xmm2 \n\t"
|
||||
"psrlw $5, %%xmm1 \n\t"
|
||||
"psrlw $10, %%xmm0 \n\t"
|
||||
"psllw $11, %%xmm2 \n\t"
|
||||
"psllw $11, %%xmm1 \n\t"
|
||||
"psllw $8, %%xmm0 \n\t"
|
||||
"psrlw $3, %%xmm1 \n\t"
|
||||
"psrlw $3, %%xmm2 \n\t"
|
||||
"pmulhw %%xmm5, %%xmm0 \n\t"
|
||||
"pmulhw %%xmm6, %%xmm1 \n\t"
|
||||
"pmulhw %%xmm7, %%xmm2 \n\t"
|
||||
"paddusw %%xmm3, %%xmm0 \n\t"
|
||||
"paddusw %%xmm3, %%xmm1 \n\t"
|
||||
"paddusw %%xmm3, %%xmm2 \n\t"
|
||||
"psubw %%xmm3, %%xmm0 \n\t" /* FIXME: This line needs added to the original asm code */
|
||||
"psubw %%xmm3, %%xmm1 \n\t"
|
||||
"psubw %%xmm3, %%xmm2 \n\t"
|
||||
"psllw $10, %%xmm0 \n\t"
|
||||
"psllw $5, %%xmm1 \n\t"
|
||||
"por %%xmm2, %%xmm0 \n\t"
|
||||
"por %%xmm1, %%xmm0 \n\t"
|
||||
"movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t"
|
||||
"addq $8, %%rcx \n\t"
|
||||
"js 7b \n\t"
|
||||
"jmp 9f \n\t"
|
||||
"8: \n\t"
|
||||
"movw (%%rsi, %%rcx, 2), %%ax \n\t"
|
||||
"movd %%eax, %%xmm0 \n\t"
|
||||
"movq %%xmm0, %%xmm1 \n\t"
|
||||
"movq %%xmm0, %%xmm2 \n\t"
|
||||
"psrlw $5, %%xmm1 \n\t"
|
||||
"psrlw $10, %%xmm0 \n\t"
|
||||
"psllw $11, %%xmm2 \n\t"
|
||||
"psllw $11, %%xmm1 \n\t"
|
||||
"psllw $8, %%xmm0 \n\t"
|
||||
"psrlw $3, %%xmm1 \n\t"
|
||||
"psrlw $3, %%xmm2 \n\t"
|
||||
"pmulhw %%xmm5, %%xmm0 \n\t"
|
||||
"pmulhw %%xmm6, %%xmm1 \n\t"
|
||||
"pmulhw %%xmm7, %%xmm2 \n\t"
|
||||
"paddusw %%xmm3, %%xmm0 \n\t"
|
||||
"paddusw %%xmm3, %%xmm1 \n\t"
|
||||
"paddusw %%xmm3, %%xmm2 \n\t"
|
||||
"psubw %%xmm3, %%xmm0 \n\t" /* FIXME: This line needs added to the original asm code */
|
||||
"psubw %%xmm3, %%xmm1 \n\t"
|
||||
"psubw %%xmm3, %%xmm2 \n\t"
|
||||
"psllw $10, %%xmm0 \n\t"
|
||||
"psllw $5, %%xmm1 \n\t"
|
||||
"por %%xmm2, %%xmm0 \n\t"
|
||||
"por %%xmm1, %%xmm0 \n\t"
|
||||
"movd %%xmm0, %%eax \n\t"
|
||||
"movw %%ax, (%%rsi, %%rcx, 2) \n\t"
|
||||
"incq %%rcx \n\t"
|
||||
"9: \n\t"
|
||||
"cmpq $6, %%rcx \n\t"
|
||||
"jng 8b \n\t"
|
||||
"addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */
|
||||
"decq %%rdx \n\t"
|
||||
"jnz 6b \n\t"
|
||||
"10: \n\t" /* This is the end. Jump here if the line count is zero. */
|
||||
"emms \n\t" /* exit multi-media state (last asm instruction) */
|
||||
: /* outputs: none */
|
||||
/* inputs: (many operations cannot be performed with a mix of 32bit & 64bit operands directly) */
|
||||
/* (however the compiler/assembler can preload 32bit values into 64bit registers) */
|
||||
/* (that is why certain variables cannot be referenced by name -- use their register) */
|
||||
: [data] "S" (data), /* put the pointer data into the rsi register */
|
||||
[width] "b" (w), /* put the width in the %rbx register (cannot be referenced by name) */
|
||||
[height] "d" (h), /* put the heigth in the %rdx register (cannot be referenced by name) */
|
||||
[red_mod] "r" ((unsigned long)(rm)),/* put the red_modifier in a register (referenced by name) */
|
||||
[green_mod] "r" ((unsigned long)(gm)),/* put the green_modifier in a register (referenced by name) */
|
||||
[blue_mod] "r" ((unsigned long)(bm)),/* put the blue_modifier in a register (referenced by name) Later store the bytes_line here */
|
||||
[bytes_line] "a" (bpl) /* put the bytes_per_line in the %rax register (cannot be referenced by name) */
|
||||
: "memory" /* clobbers: (memory includes all the registers) */
|
||||
); /* End of Assembly */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
shade_ximage_16_sse2(volatile void *data, volatile int bpl, volatile int w, volatile int h, volatile int rm, volatile int gm,
|
||||
volatile int bm)
|
||||
void shade_ximage_16_sse2( volatile void *data, volatile int bpl, volatile int w, volatile int h, volatile int rm, volatile int gm, volatile int bm )
|
||||
{
|
||||
__asm__ __volatile__(".align 16 \n\t" /* SIMD instructions should be aligned on 16 byte (128 bit) boundraries for performance reasons. */
|
||||
"leaq -14(%%rsi, %%rbx, 2), %%rsi\n\t" /* Load the stack index register with a pointer to data + ( width * bytes/pixel ) -6 */
|
||||
"negq %%rbx \n\t" /* Negate the width to that we can increment the counter */
|
||||
"jz 10f \n\t" /* Jump to end if the line count is zero */
|
||||
"movd %[red_mod], %%xmm5 \n\t" /* Load the color modifiers into mmx registers */
|
||||
"movd %[green_mod], %%xmm6 \n\t" /* " " */
|
||||
"movd %[blue_mod], %%xmm7 \n\t" /* " " */
|
||||
"punpcklwd %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low words. From A64_128bit_Media_Programming (p. 380) */
|
||||
"punpcklwd %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 16 bits into the next 16 bits (both operands are the same) */
|
||||
"punpcklwd %%xmm7, %%xmm7 \n\t" "punpckldq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low double words. From A64_128bit_Media_Programming (p. 376) */
|
||||
"punpckldq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 32 bits into the next 32 bits (both operands are the same) */
|
||||
"punpckldq %%xmm7, %%xmm7 \n\t" "punpcklqdq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low quad words. From A64_128bit_Media_Programming (p. 378) */
|
||||
"punpcklqdq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 64 bits into the next 64 bits (both operands are the same) */
|
||||
"punpcklqdq %%xmm7, %%xmm7 \n\t" "or %[red_mod], %[green_mod] \n\t" /* This, and the following 4 instructions, check to see if all three colormodifiers are */
|
||||
"or %[blue_mod], %[green_mod] \n\t" /* less than 256. If any of the modifiers are > 256 then they will have the 9th, or higher, */
|
||||
"sar $8, %[green_mod] \n\t" /* bit set. Then we shift off eight bits, leaving something set if a modifier > 256. */
|
||||
"movq %%rax, %[blue_mod] \n\t" /* Use the register named blue_mod to now store bytes_per_line. */
|
||||
"xor %[red_mod], %[red_mod] \n\t" /* zero red so we don't have to load an immediate value for the following compare. */
|
||||
"cmp %[red_mod], %[green_mod] \n\t" /* Compare the left over bits to zero */
|
||||
"jg 5f \n\t" /* If one of the colors (might) need saturated then jump to the secondary set of loops. */
|
||||
"1: \n\t" /* Start of the outer loop (lines). */
|
||||
"movq %%rbx, %%rcx \n\t" /* Move the width into the count register */
|
||||
"addq $7, %%rcx \n\t" "jns 3f \n\t" "2: \n\t" /* Start of the inner loop (pixels 8 at a time --> 8 * 16 = 128bits/xmm register ) */
|
||||
"movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t" /* Load the 16 bits of the pixel (5 bits for red, 6 bits for green, 5 bits for blue) */
|
||||
"movdqu %%xmm0, %%xmm1 \n\t" /* Create a copy of the pixel for the green color */
|
||||
"movdqu %%xmm0, %%xmm2 \n\t" /* Create a copy of the pixel for the blue color */
|
||||
"psrlw $5, %%xmm1 \n\t" /* Packed Shift Right Logical Words */
|
||||
/* From A64_128bit_Media_Programming (p. 347) */
|
||||
/* Shifts the blue off of the green color */
|
||||
"psrlw $11, %%xmm0 \n\t" /* Shifts the blue & green off of the red color */
|
||||
"psllw $11, %%xmm2 \n\t" /* Packed Shift Left Logical Words */
|
||||
/* From A64_128bit_Media_Programming (p. 330) */
|
||||
/* Shifts the red & green off of the blue color */
|
||||
"psllw $10, %%xmm1 \n\t" /* Shifts the red off of the green color */
|
||||
"psllw $8, %%xmm0 \n\t" /* Shifts the red color into position */
|
||||
"psrlw $2, %%xmm1 \n\t" /* Shifts the green color into position */
|
||||
"psrlw $3, %%xmm2 \n\t" /* Shifts the blue color into position */
|
||||
"pmulhw %%xmm5, %%xmm0 \n\t" /* color *= modifier */
|
||||
"pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" "psllw $11, %%xmm0 \n\t" /* Shift red back into its original position */
|
||||
"psllw $5, %%xmm1 \n\t" /* Shift green back into its original position */
|
||||
"por %%xmm2, %%xmm0 \n\t" /* Mesh the colors back together */
|
||||
"por %%xmm1, %%xmm0 \n\t" "movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t" /* Place the shaded 8 pixels back into the image map */
|
||||
"addq $8, %%rcx \n\t" "js 2b \n\t" "jmp 4f \n\t" "3: \n\t" /* Deal with pixels one at a time here. */
|
||||
"movw (%%rsi, %%rcx, 2), %%ax \n\t" "movd %%eax, %%xmm0 \n\t" "movq %%xmm0, %%xmm1 \n\t" "movq %%xmm0, %%xmm2 \n\t" "psrlw $5, %%xmm1 \n\t" "psrlw $11, %%xmm0 \n\t" "psllw $11, %%xmm2 \n\t" "psllw $10, %%xmm1 \n\t" "psllw $8, %%xmm0 \n\t" "psrlw $2, %%xmm1 \n\t" "psrlw $3, %%xmm2 \n\t" "pmulhw %%xmm5, %%xmm0 \n\t" "pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" "psllw $11, %%xmm0 \n\t" "psllw $5, %%xmm1 \n\t" "por %%xmm2, %%xmm0 \n\t" "por %%xmm1, %%xmm0 \n\t" "movd %%xmm0, %%eax \n\t" "movw %%ax, (%%rsi, %%rcx, 2) \n\t" "incq %%rcx \n\t" "4: \n\t" "cmpq $6, %%rcx \n\t" "jng 3b \n\t" "addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */
|
||||
"decq %%rdx \n\t" "jnz 1b \n\t" "jmp 10f \n\t" /* We're done! */
|
||||
"5: \n\t" /* Saturation is required */
|
||||
"pcmpeqw %%xmm3, %%xmm3 \n\t" /* Packed Compare Equal Words */
|
||||
/* From A64_128bit_Media_Programming (p. 276) */
|
||||
/* This sets xmm3 to 128 1's (since mm6 = mm6) */
|
||||
"movdqu %%xmm3, %%xmm4 \n\t" /* Make copy of 128 ones */
|
||||
"psllw $5, %%xmm3 \n\t" /* xmm3 = 8 copies of 1111 1111 1110 0000 */
|
||||
"psllw $6, %%xmm4 \n\t" /* xmm4 = 8 copies of 1111 1111 1100 0000 */
|
||||
"6: \n\t" "movq %%rbx, %%rcx \n\t" "addq $7, %%rcx \n\t" "jns 8f \n\t" "7: \n\t" "movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t" "movdqu %%xmm0, %%xmm1 \n\t" "movdqu %%xmm0, %%xmm2 \n\t" "psrlw $5, %%xmm1 \n\t" "psrlw $11, %%xmm0 \n\t" "psllw $11, %%xmm2 \n\t" "psllw $10, %%xmm1 \n\t" "psllw $8, %%xmm0 \n\t" "psrlw $2, %%xmm1 \n\t" "psrlw $3, %%xmm2 \n\t" "pmulhw %%xmm5, %%xmm0 \n\t" "pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" "paddusw %%xmm3, %%xmm0 \n\t" "paddusw %%xmm4, %%xmm1 \n\t" "paddusw %%xmm3, %%xmm2 \n\t" "psubw %%xmm4, %%xmm1 \n\t" "psubw %%xmm3, %%xmm2 \n\t" "psllw $11, %%xmm0 \n\t" "psllw $5, %%xmm1 \n\t" "por %%xmm2, %%xmm0 \n\t" "por %%xmm1, %%xmm0 \n\t" "movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t" "addq $8, %%rcx \n\t" "js 7b \n\t" "jmp 9f \n\t" "8: \n\t" "movw (%%rsi, %%rcx, 2), %%ax \n\t" "movd %%eax, %%xmm0 \n\t" "movq %%xmm0, %%xmm1 \n\t" "movq %%xmm0, %%xmm2 \n\t" "psrlw $5, %%xmm1 \n\t" "psrlw $11, %%xmm0 \n\t" "psllw $11, %%xmm2 \n\t" "psllw $10, %%xmm1 \n\t" "psllw $8, %%xmm0 \n\t" "psrlw $2, %%xmm1 \n\t" "psrlw $3, %%xmm2 \n\t" " \n\t" "pmulhw %%xmm5, %%xmm0 \n\t" "pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" " \n\t" "paddusw %%xmm3, %%xmm0 \n\t" "paddusw %%xmm4, %%xmm1 \n\t" "paddusw %%xmm3, %%xmm2 \n\t" " \n\t" "psubw %%xmm4, %%xmm1 \n\t" "psubw %%xmm3, %%xmm2 \n\t" " \n\t" "psllw $11, %%xmm0 \n\t" "psllw $5, %%xmm1 \n\t" "por %%xmm2, %%xmm0 \n\t" "por %%xmm1, %%xmm0 \n\t" "movd %%xmm0, %%eax \n\t" "movw %%ax, (%%rsi, %%rcx, 2) \n\t" "incq %%rcx \n\t" "9: \n\t" "cmpq $6, %%rcx \n\t" "jng 8b \n\t" "addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */
|
||||
"decq %%rdx \n\t" "jnz 6b \n\t" "10: \n\t" /* This is the end. Jump here if the line count is zero. */
|
||||
"emms \n\t" /* exit multi-media state (last asm instruction) */
|
||||
: /* outputs: none */
|
||||
/* inputs: (many operations cannot be performed with a mix of 32bit & 64bit operands directly) */
|
||||
/* (however the compiler/assembler can preload 32bit values into 64bit registers) */
|
||||
/* (that is why certain variables cannot be referenced by name -- use their register) */
|
||||
:[data] "S"(data), /* put the pointer data into the rsi register */
|
||||
[width] "b"(w), /* put the width in the %rbx register (cannot be referenced by name) */
|
||||
[height] "d"(h), /* put the heigth in the %rdx register (cannot be referenced by name) */
|
||||
[red_mod] "r"((unsigned long) (rm)), /* put the red_modifier in a register (referenced by name) */
|
||||
[green_mod] "r"((unsigned long) (gm)), /* put the green_modifier in a register (referenced by name) */
|
||||
[blue_mod] "r"((unsigned long) (bm)), /* put the blue_modifier in a register (referenced by name) Later store the bytes_line here */
|
||||
[bytes_line] "a"(bpl) /* put the bytes_per_line in the %rax register (cannot be referenced by name) */
|
||||
:"memory" /* clobbers: (memory includes all the registers) */
|
||||
); /* End of Assembly */
|
||||
__asm__ __volatile__ (
|
||||
".align 16 \n\t" /* SIMD instructions should be aligned on 16 byte (128 bit) boundraries for performance reasons.*/
|
||||
"leaq -14(%%rsi, %%rbx, 2), %%rsi\n\t" /* Load the stack index register with a pointer to data + ( width * bytes/pixel ) -6 */
|
||||
"negq %%rbx \n\t" /* Negate the width to that we can increment the counter */
|
||||
"jz 10f \n\t" /* Jump to end if the line count is zero */
|
||||
"movd %[red_mod], %%xmm5 \n\t" /* Load the color modifiers into mmx registers */
|
||||
"movd %[green_mod], %%xmm6 \n\t" /* " " */
|
||||
"movd %[blue_mod], %%xmm7 \n\t" /* " " */
|
||||
"punpcklwd %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low words. From A64_128bit_Media_Programming (p. 380) */
|
||||
"punpcklwd %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 16 bits into the next 16 bits (both operands are the same) */
|
||||
"punpcklwd %%xmm7, %%xmm7 \n\t"
|
||||
"punpckldq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low double words. From A64_128bit_Media_Programming (p. 376) */
|
||||
"punpckldq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 32 bits into the next 32 bits (both operands are the same) */
|
||||
"punpckldq %%xmm7, %%xmm7 \n\t"
|
||||
"punpcklqdq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low quad words. From A64_128bit_Media_Programming (p. 378) */
|
||||
"punpcklqdq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 64 bits into the next 64 bits (both operands are the same) */
|
||||
"punpcklqdq %%xmm7, %%xmm7 \n\t"
|
||||
"or %[red_mod], %[green_mod] \n\t" /* This, and the following 4 instructions, check to see if all three colormodifiers are */
|
||||
"or %[blue_mod], %[green_mod] \n\t" /* less than 256. If any of the modifiers are > 256 then they will have the 9th, or higher, */
|
||||
"sar $8, %[green_mod] \n\t" /* bit set. Then we shift off eight bits, leaving something set if a modifier > 256. */
|
||||
"movq %%rax, %[blue_mod] \n\t" /* Use the register named blue_mod to now store bytes_per_line. */
|
||||
"xor %[red_mod], %[red_mod] \n\t" /* zero red so we don't have to load an immediate value for the following compare. */
|
||||
"cmp %[red_mod], %[green_mod] \n\t" /* Compare the left over bits to zero */
|
||||
"jg 5f \n\t" /* If one of the colors (might) need saturated then jump to the secondary set of loops. */
|
||||
"1: \n\t" /* Start of the outer loop (lines). */
|
||||
"movq %%rbx, %%rcx \n\t" /* Move the width into the count register */
|
||||
"addq $7, %%rcx \n\t"
|
||||
"jns 3f \n\t"
|
||||
"2: \n\t" /* Start of the inner loop (pixels 8 at a time --> 8 * 16 = 128bits/xmm register ) */
|
||||
"movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t" /* Load the 16 bits of the pixel (5 bits for red, 6 bits for green, 5 bits for blue) */
|
||||
"movdqa %%xmm0, %%xmm1 \n\t" /* Create a copy of the pixel for the green color */
|
||||
"movdqa %%xmm0, %%xmm2 \n\t" /* Create a copy of the pixel for the blue color */
|
||||
"psrlw $5, %%xmm1 \n\t" /* Packed Shift Right Logical Words */
|
||||
/* From A64_128bit_Media_Programming (p. 347) */
|
||||
/* Shifts the blue off of the green color */
|
||||
"psrlw $11, %%xmm0 \n\t" /* Shifts the blue & green off of the red color */
|
||||
"psllw $11, %%xmm2 \n\t" /* Packed Shift Left Logical Words */
|
||||
/* From A64_128bit_Media_Programming (p. 330) */
|
||||
/* Shifts the red & green off of the blue color */
|
||||
"psllw $10, %%xmm1 \n\t" /* Shifts the red off of the green color */
|
||||
"psllw $8, %%xmm0 \n\t" /* Shifts the red color into position */
|
||||
"psrlw $2, %%xmm1 \n\t" /* Shifts the green color into position */
|
||||
"psrlw $3, %%xmm2 \n\t" /* Shifts the blue color into position */
|
||||
"pmulhw %%xmm5, %%xmm0 \n\t" /* color *= modifier */
|
||||
"pmulhw %%xmm6, %%xmm1 \n\t"
|
||||
"pmulhw %%xmm7, %%xmm2 \n\t"
|
||||
"psllw $11, %%xmm0 \n\t" /* Shift red back into its original position */
|
||||
"psllw $5, %%xmm1 \n\t" /* Shift green back into its original position */
|
||||
"por %%xmm2, %%xmm0 \n\t" /* Mesh the colors back together */
|
||||
"por %%xmm1, %%xmm0 \n\t"
|
||||
"movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t" /* Place the shaded 8 pixels back into the image map */
|
||||
"addq $8, %%rcx \n\t"
|
||||
"js 2b \n\t"
|
||||
"jmp 4f \n\t"
|
||||
"3: \n\t" /* Deal with pixels one at a time here. */
|
||||
"movw (%%rsi, %%rcx, 2), %%ax \n\t"
|
||||
"movd %%eax, %%xmm0 \n\t"
|
||||
"movq %%xmm0, %%xmm1 \n\t"
|
||||
"movq %%xmm0, %%xmm2 \n\t"
|
||||
"psrlw $5, %%xmm1 \n\t"
|
||||
"psrlw $11, %%xmm0 \n\t"
|
||||
"psllw $11, %%xmm2 \n\t"
|
||||
"psllw $10, %%xmm1 \n\t"
|
||||
"psllw $8, %%xmm0 \n\t"
|
||||
"psrlw $2, %%xmm1 \n\t"
|
||||
"psrlw $3, %%xmm2 \n\t"
|
||||
"pmulhw %%xmm5, %%xmm0 \n\t"
|
||||
"pmulhw %%xmm6, %%xmm1 \n\t"
|
||||
"pmulhw %%xmm7, %%xmm2 \n\t"
|
||||
"psllw $11, %%xmm0 \n\t"
|
||||
"psllw $5, %%xmm1 \n\t"
|
||||
"por %%xmm2, %%xmm0 \n\t"
|
||||
"por %%xmm1, %%xmm0 \n\t"
|
||||
"movd %%xmm0, %%eax \n\t"
|
||||
"movw %%ax, (%%rsi, %%rcx, 2) \n\t"
|
||||
"incq %%rcx \n\t"
|
||||
"4: \n\t"
|
||||
"cmpq $6, %%rcx \n\t"
|
||||
"jng 3b \n\t"
|
||||
"addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */
|
||||
"decq %%rdx \n\t"
|
||||
"jnz 1b \n\t"
|
||||
"jmp 10f \n\t" /* We're done! */
|
||||
|
||||
"5: \n\t" /* Saturation is required */
|
||||
"pcmpeqw %%xmm3, %%xmm3 \n\t" /* Packed Compare Equal Words */
|
||||
/* From A64_128bit_Media_Programming (p. 276) */
|
||||
/* This sets xmm3 to 128 1's (since mm6 = mm6) */
|
||||
"movdqa %%xmm3, %%xmm4 \n\t" /* Make copy of 128 ones */
|
||||
"psllw $5, %%xmm3 \n\t" /* xmm3 = 8 copies of 1111 1111 1110 0000 */
|
||||
"psllw $6, %%xmm4 \n\t" /* xmm4 = 8 copies of 1111 1111 1100 0000 */
|
||||
"6: \n\t"
|
||||
"movq %%rbx, %%rcx \n\t"
|
||||
"addq $7, %%rcx \n\t"
|
||||
"jns 8f \n\t"
|
||||
"7: \n\t"
|
||||
"movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t"
|
||||
"movdqa %%xmm0, %%xmm1 \n\t"
|
||||
"movdqa %%xmm0, %%xmm2 \n\t"
|
||||
"psrlw $5, %%xmm1 \n\t"
|
||||
"psrlw $11, %%xmm0 \n\t"
|
||||
"psllw $11, %%xmm2 \n\t"
|
||||
"psllw $10, %%xmm1 \n\t"
|
||||
"psllw $8, %%xmm0 \n\t"
|
||||
"psrlw $2, %%xmm1 \n\t"
|
||||
"psrlw $3, %%xmm2 \n\t"
|
||||
"pmulhw %%xmm5, %%xmm0 \n\t"
|
||||
"pmulhw %%xmm6, %%xmm1 \n\t"
|
||||
"pmulhw %%xmm7, %%xmm2 \n\t"
|
||||
"paddusw %%xmm3, %%xmm0 \n\t"
|
||||
"paddusw %%xmm4, %%xmm1 \n\t"
|
||||
"paddusw %%xmm3, %%xmm2 \n\t"
|
||||
"psubw %%xmm4, %%xmm1 \n\t"
|
||||
"psubw %%xmm3, %%xmm2 \n\t"
|
||||
"psllw $11, %%xmm0 \n\t"
|
||||
"psllw $5, %%xmm1 \n\t"
|
||||
"por %%xmm2, %%xmm0 \n\t"
|
||||
"por %%xmm1, %%xmm0 \n\t"
|
||||
"movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t"
|
||||
"addq $8, %%rcx \n\t"
|
||||
"js 7b \n\t"
|
||||
"jmp 9f \n\t"
|
||||
"8: \n\t"
|
||||
"movw (%%rsi, %%rcx, 2), %%ax \n\t"
|
||||
"movd %%eax, %%xmm0 \n\t"
|
||||
"movq %%xmm0, %%xmm1 \n\t"
|
||||
"movq %%xmm0, %%xmm2 \n\t"
|
||||
"psrlw $5, %%xmm1 \n\t"
|
||||
"psrlw $11, %%xmm0 \n\t"
|
||||
"psllw $11, %%xmm2 \n\t"
|
||||
"psllw $10, %%xmm1 \n\t"
|
||||
"psllw $8, %%xmm0 \n\t"
|
||||
"psrlw $2, %%xmm1 \n\t"
|
||||
"psrlw $3, %%xmm2 \n\t"
|
||||
" \n\t"
|
||||
"pmulhw %%xmm5, %%xmm0 \n\t"
|
||||
"pmulhw %%xmm6, %%xmm1 \n\t"
|
||||
"pmulhw %%xmm7, %%xmm2 \n\t"
|
||||
" \n\t"
|
||||
"paddusw %%xmm3, %%xmm0 \n\t"
|
||||
"paddusw %%xmm4, %%xmm1 \n\t"
|
||||
"paddusw %%xmm3, %%xmm2 \n\t"
|
||||
" \n\t"
|
||||
"psubw %%xmm4, %%xmm1 \n\t"
|
||||
"psubw %%xmm3, %%xmm2 \n\t"
|
||||
" \n\t"
|
||||
"psllw $11, %%xmm0 \n\t"
|
||||
"psllw $5, %%xmm1 \n\t"
|
||||
"por %%xmm2, %%xmm0 \n\t"
|
||||
"por %%xmm1, %%xmm0 \n\t"
|
||||
"movd %%xmm0, %%eax \n\t"
|
||||
"movw %%ax, (%%rsi, %%rcx, 2) \n\t"
|
||||
"incq %%rcx \n\t"
|
||||
"9: \n\t"
|
||||
"cmpq $6, %%rcx \n\t"
|
||||
"jng 8b \n\t"
|
||||
"addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */
|
||||
"decq %%rdx \n\t"
|
||||
"jnz 6b \n\t"
|
||||
"10: \n\t" /* This is the end. Jump here if the line count is zero. */
|
||||
"emms \n\t" /* exit multi-media state (last asm instruction) */
|
||||
: /* outputs: none */
|
||||
/* inputs: (many operations cannot be performed with a mix of 32bit & 64bit operands directly) */
|
||||
/* (however the compiler/assembler can preload 32bit values into 64bit registers) */
|
||||
/* (that is why certain variables cannot be referenced by name -- use their register) */
|
||||
: [data] "S" (data), /* put the pointer data into the rsi register */
|
||||
[width] "b" (w), /* put the width in the %rbx register (cannot be referenced by name) */
|
||||
[height] "d" (h), /* put the heigth in the %rdx register (cannot be referenced by name) */
|
||||
[red_mod] "r" ((unsigned long)(rm)),/* put the red_modifier in a register (referenced by name) */
|
||||
[green_mod] "r" ((unsigned long)(gm)),/* put the green_modifier in a register (referenced by name) */
|
||||
[blue_mod] "r" ((unsigned long)(bm)),/* put the blue_modifier in a register (referenced by name) Later store the bytes_line here */
|
||||
[bytes_line] "a" (bpl) /* put the bytes_per_line in the %rax register (cannot be referenced by name) */
|
||||
: "memory" /* clobbers: (memory includes all the registers) */
|
||||
); /* End of Assembly */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
shade_ximage_32_sse2(volatile void *data, volatile int bpl, volatile int w, volatile int h, volatile int rm, volatile int gm,
|
||||
volatile int bm)
|
||||
void shade_ximage_32_sse2( volatile void *data, volatile int bpl, volatile int w, volatile int h, volatile int rm, volatile int gm, volatile int bm )
|
||||
{
|
||||
__asm__ __volatile__(".align 16 \n\t" /* SIMD instructions should be aligned on 16 byte (128 bit) boundraries for performance reasons. */
|
||||
"leaq -4(%%rsi, %%rbx, 4), %%rsi\n\t" /* From A64_General_Purpose_and_System_Instructions (p. 182) */
|
||||
/* Intel syntax section:[base + index*scale + disp] (used by AMD manuals) */
|
||||
/* AT&T syntax section:disp(base, index, scale) (used by gas/gcc) */
|
||||
/* Load Effective Address of (rsi + (rbx * size)) into rsi */
|
||||
/* 32 bits per pixel means a multiplier of 4. */
|
||||
"negq %%rbx \n\t" /* two's compliment negation of ebx (width) and sets the Zero Flag based on the results */
|
||||
/* From A64_General_Purpose_and_System_Instructions (p. 212) */
|
||||
"jz 10f \n\t" /* Jump to label 3 forward on Zero */
|
||||
/* Basically if width = 0 blowout */
|
||||
/* I don't understand why the height isn't checked (shouldn't matter, zero loop iterations) */
|
||||
"movd %[red_mod], %%xmm4 \n\t" /* move red modifier into mm4 w/ zero extension to 128bits */
|
||||
/* RGB's are 8 bit values. regardless of them coming in in 32/64 bit they are zero extended */
|
||||
"psllq $16, %%xmm4 \n\t" /* Packed Shift Left Logical Quad words (left shift mm4 16bits twice, once for each 64bit value) */
|
||||
/* From A64_128bit_Media_Programming (p. 328) */
|
||||
"movd %[green_mod], %%xmm5 \n\t" /* move green modifier into mm5 w/ zero extension to 128bits */
|
||||
"por %%xmm5, %%xmm4 \n\t" /* Mesh green modifier into color modifier */
|
||||
"psllq $16, %%xmm4 \n\t" /* Packed Shift Left Logical Quad words (left shift mm4 16bits twice, once for each 64bit value) */
|
||||
"movd %[blue_mod], %%xmm5 \n\t" /* move blue modifier (32 bits) into mm4 w/ zero extension to 128bits */
|
||||
"por %%xmm5, %%xmm4 \n\t" /* Mesh blue modifier into color modifier */
|
||||
/* mm4 (color modifier) now contains 00 00 00 00 : 00 00 00 00 :: 00 00 00 rm : 00 gm 00 bm */
|
||||
"punpcklqdq %%xmm4, %%xmm4 \n\t" /* Unpack and Interleave low quad words. From A64_128bit_Media_Programming (p. 378) */
|
||||
/* Duplicate the bottom 64 bits into the next 64 bits (both operands are the same) */
|
||||
"pcmpeqw %%xmm6, %%xmm6 \n\t" /* Packed Compare Equal Words */
|
||||
/* From A64_128bit_Media_Programming (p. 276) */
|
||||
/* This sets mm6 to 128 1's (since mm6 = mm6) */
|
||||
"psllw $15, %%xmm6 \n\t" /* Packed Shift Left Logical Words */
|
||||
/* From A64_128bit_Media_Programming (p. 330) */
|
||||
/* This sets 8 16 bit values of 1000 0000 0000 0000 in the 128 bit word */
|
||||
"movdqu %%xmm6, %%xmm5 \n\t" /* Copy mm6 to mm5 (we need mm6 later) */
|
||||
"pmulhw %%xmm4, %%xmm5 \n\t" /* Packed Multiply High Signed Word */
|
||||
/* mm4 = ( mm4 * mm5 ) >> 16 (8 times, once for each 16bit value) */
|
||||
/* For each color_ modifier (cm) */
|
||||
/* (( cm * 80 00 ) >> 16 ) = (( cm << 15 ) >> 16 ) = cm >> 1 */
|
||||
"1: \n\t" /* The start of the outer loop (lines) */
|
||||
"movq %%rbx, %%rcx \n\t" /* Load the counting register (rcx) with the width of the window to shade */
|
||||
"incq %%rcx \n\t" "2: \n\t" /* The start of the inner loop (columns) */
|
||||
"movq (%%rsi, %%rcx, 4), %%xmm1 \n\t" /* sets mm1 to the 32bit color in the image map (data[ rcx ]) */
|
||||
/* 32 bit color is still 4 bytes so leave the multiplier alone it is zero extended to 128 bits */
|
||||
/* only move 32 bits with movd so we don't get two pixels worth of colors */
|
||||
"pxor %%xmm0, %%xmm0 \n\t" /* 128bit exclusive or (sets mm0 to 0) */
|
||||
"punpcklbw %%xmm1, %%xmm0 \n\t" /* Unpack and interleave low bytes */
|
||||
/* For each color of the pixel expand to 16 bits and shift left 8 bits */
|
||||
/* From A64_128bit_Media_Programming (p. 374) */
|
||||
/* discard high 64 bits and expand both mm0 and mm1 a byte at a time into mm0 (mm0 first) */
|
||||
"pxor %%xmm6, %%xmm0 \n\t" /* This flips the sign of the 16 bit red, green, and blue colors. (mm6 ~= 1000:0000 8 times) */
|
||||
"pmulhw %%xmm4, %%xmm0 \n\t" /* Package Multiply High Signed Word (an SSE2 instruction) 128bit mm0=color mm4=cm */
|
||||
/* Each 16 bit signed int in mm4 (8) is multiplied by the same in mm0 */
|
||||
/* and the high 16 bits of the result replace the 16 bits used from mm0 */
|
||||
/* For (( each 16 bit color * each 16 bit color modifier ) >> 16 ) */
|
||||
"psubw %%xmm5, %%xmm0 \n\t" /* Packed Subtract Words */
|
||||
/* From A64_128bit_Media_Programming (p. 364) */
|
||||
/* mm0=modified color mm5=corrected color modifier. mm0 = ( mm0 - mm5 ) */
|
||||
/* 16 bit corrected modified color = ( modified color - corrected color modifier ) */
|
||||
"packuswb %%xmm0, %%xmm0 \n\t" /* Pack with Saturation Signed Word to Unsigned Byte */
|
||||
/* From A64_128bit_Media_Programming (p. 246) */
|
||||
/* if mm0 > 255 then mm0=255 elsif mm0 < 0 mm0=0 else mm0=mm0 */
|
||||
/* The top 64 bits are now trashed. The remaining 64 bits are 2 pixels */
|
||||
"movq %%xmm0, (%%rsi, %%rcx, 4) \n\t" /* puts the new 32 bit color value back into the data (image map) */
|
||||
/* 32 bit color is still a double word so movd stays movd */
|
||||
"addq $2, %%rcx \n\t" /* Increment the count register (more pixels left) */
|
||||
"js 2b \n\t" /* Jump backwards to label 2 (restart inner loop) on negative (more pixels left) */
|
||||
"jmp 5f \n\t" /* Jump to single pixel section after pairs are exhausted */
|
||||
"4: \n\t" /* The start of the inner loop (columns) */
|
||||
"movd (%%rsi, %%rcx, 4), %%xmm1 \n\t" /* sets mm1 to the 32bit color in the image map (data[ rcx ]) */
|
||||
/* 32 bit color is still 4 bytes so leave the multiplier alone it is zero extended to 128 bits */
|
||||
/* only move 32 bits with movd so we don't get two pixels worth of colors */
|
||||
"pxor %%xmm0, %%xmm0 \n\t" /* 128bit exclusive or (sets mm0 to 0) */
|
||||
"punpcklbw %%xmm1, %%xmm0 \n\t" /* Unpack and interleave low bytes */
|
||||
/* For each color of the pixel expand to 16 bits and shift left 8 bits */
|
||||
/* From A64_128bit_Media_Programming (p. 374) */
|
||||
/* discard high 64 bits and expand both mm0 and mm1 a byte at a time into mm0 (mm0 first) */
|
||||
"pxor %%xmm6, %%xmm0 \n\t" /* This flips the sign of the 16 bit red, green, and blue colors. (mm6 ~= 1000:0000 8 times) */
|
||||
"pmulhw %%xmm4, %%xmm0 \n\t" /* Package Multiply High Signed Word (an SSE2 instruction) 128bit mm0=color mm4=cm */
|
||||
/* Each 16 bit signed int in mm4 (8) is multiplied by the same in mm0 */
|
||||
/* and the high 16 bits of the result replace the 16 bits used from mm0 */
|
||||
/* For (( each 16 bit color * each 16 bit color modifier ) >> 16 ) */
|
||||
"psubw %%xmm5, %%xmm0 \n\t" /* Packed Subtract Words */
|
||||
/* From A64_128bit_Media_Programming (p. 364) */
|
||||
/* mm0=modified color mm5=corrected color modifier. mm0 = ( mm0 - mm5 ) */
|
||||
/* 16 bit corrected modified color = ( modified color - corrected color modifier ) */
|
||||
"packuswb %%xmm0, %%xmm0 \n\t" /* Pack with Saturation Signed Word to Unsigned Byte */
|
||||
/* From A64_128bit_Media_Programming (p. 246) */
|
||||
/* if mm0 > 255 then mm0=255 elsif mm0 < 0 mm0=0 else mm0=mm0 */
|
||||
"movd %%xmm0, (%%rsi, %%rcx, 4) \n\t" /* puts the new 32 bit color value back into the data (image map) */
|
||||
/* 32 bit color is still a double word so movd stays movd */
|
||||
"incq %%rcx \n\t" /* Increment the count register (more pixels left) */
|
||||
"5: \n\t" /* Jump here after all pairs of pixels are exhausted */
|
||||
"cmpq $0, %%rcx \n\t" /* Increment the count register (more pixels left) */
|
||||
"jng 4b \n\t" /* Jump backwards to label 2 (restart inner loop) on NOT zero (more pixels left) */
|
||||
"addq %%rax, %%rsi \n\t" /* Add bytes per line to the data pointer (advance the pointer to the next line) */
|
||||
"decq %%rdx \n\t" /* Decrement the dx register (row count) */
|
||||
"jnz 1b \n\t" /* Jump backwards to label 1 (restart outer loop) if not zero (more rows left) */
|
||||
"10: \n\t" /* End of function (jump here to clean up and return to caller */
|
||||
"emms \n\t" /* exit multi-media state (last asm instruction) */
|
||||
: /* outputs: none */
|
||||
/* inputs: (many operations cannot be performed with a mix of 32bit & 64bit operands directly) */
|
||||
/* (however the compiler/assembler can preload 32bit values into 64bit registers) */
|
||||
/* (that is why certain variables cannot be referenced by name -- use their register) */
|
||||
:[data] "S"(data), /* put the pointer data into the rsi register */
|
||||
[width] "b"(w), /* put the width in the %rbx register (cannot be referenced by name) */
|
||||
[height] "d"(h), /* put the heigth in the %rdx register (cannot be referenced by name) */
|
||||
[red_mod] "r"(rm), /* put the red_modifier in a register (referenced by name) */
|
||||
[green_mod] "r"(gm), /* put the green_modifier in a register (referenced by name) */
|
||||
[blue_mod] "r"(bm), /* put the blue_modifier in a register (referenced by name) */
|
||||
[bytes_line] "a"(bpl) /* put the bytes_per_line in the %rax register (cannot be referenced by name) */
|
||||
:"memory" /* clobbers: (memory includes all the registers) */
|
||||
); /* End of Assembly */
|
||||
__asm__ __volatile__ (
|
||||
".align 16 \n\t" /* SIMD instructions should be aligned on 16 byte (128 bit) boundraries for performance reasons.*/
|
||||
"leaq -4(%%rsi, %%rbx, 4), %%rsi\n\t" /* From A64_General_Purpose_and_System_Instructions (p. 182) */
|
||||
/* Intel syntax section:[base + index*scale + disp] (used by AMD manuals) */
|
||||
/* AT&T syntax section:disp(base, index, scale) (used by gas/gcc) */
|
||||
/* Load Effective Address of (rsi + (rbx * size)) into rsi */
|
||||
/* 32 bits per pixel means a multiplier of 4. */
|
||||
"negq %%rbx \n\t" /* two's compliment negation of ebx (width) and sets the Zero Flag based on the results */
|
||||
/* From A64_General_Purpose_and_System_Instructions (p. 212) */
|
||||
"jz 10f \n\t" /* Jump to label 3 forward on Zero */
|
||||
/* Basically if width = 0 blowout */
|
||||
/* I don't understand why the height isn't checked (shouldn't matter, zero loop iterations) */
|
||||
"movd %[red_mod], %%xmm4 \n\t" /* move red modifier into mm4 w/ zero extension to 128bits */
|
||||
/* RGB's are 8 bit values. regardless of them coming in in 32/64 bit they are zero extended */
|
||||
"psllq $16, %%xmm4 \n\t" /* Packed Shift Left Logical Quad words (left shift mm4 16bits twice, once for each 64bit value)*/
|
||||
/* From A64_128bit_Media_Programming (p. 328) */
|
||||
"movd %[green_mod], %%xmm5 \n\t" /* move green modifier into mm5 w/ zero extension to 128bits */
|
||||
"por %%xmm5, %%xmm4 \n\t" /* Mesh green modifier into color modifier */
|
||||
"psllq $16, %%xmm4 \n\t" /* Packed Shift Left Logical Quad words (left shift mm4 16bits twice, once for each 64bit value)*/
|
||||
"movd %[blue_mod], %%xmm5 \n\t" /* move blue modifier (32 bits) into mm4 w/ zero extension to 128bits */
|
||||
"por %%xmm5, %%xmm4 \n\t" /* Mesh blue modifier into color modifier */
|
||||
/* mm4 (color modifier) now contains 00 00 00 00 : 00 00 00 00 :: 00 00 00 rm : 00 gm 00 bm */
|
||||
"punpcklqdq %%xmm4, %%xmm4 \n\t" /* Unpack and Interleave low quad words. From A64_128bit_Media_Programming (p. 378) */
|
||||
/* Duplicate the bottom 64 bits into the next 64 bits (both operands are the same) */
|
||||
"pcmpeqw %%xmm6, %%xmm6 \n\t" /* Packed Compare Equal Words */
|
||||
/* From A64_128bit_Media_Programming (p. 276) */
|
||||
/* This sets mm6 to 128 1's (since mm6 = mm6) */
|
||||
"psllw $15, %%xmm6 \n\t" /* Packed Shift Left Logical Words */
|
||||
/* From A64_128bit_Media_Programming (p. 330) */
|
||||
/* This sets 8 16 bit values of 1000 0000 0000 0000 in the 128 bit word */
|
||||
"movdqa %%xmm6, %%xmm5 \n\t" /* Copy mm6 to mm5 (we need mm6 later) */
|
||||
"pmulhw %%xmm4, %%xmm5 \n\t" /* Packed Multiply High Signed Word */
|
||||
/* mm4 = ( mm4 * mm5 ) >> 16 (8 times, once for each 16bit value) */
|
||||
/* For each color_ modifier (cm) */
|
||||
/* (( cm * 80 00 ) >> 16 ) = (( cm << 15 ) >> 16 ) = cm >> 1 */
|
||||
"1: \n\t" /* The start of the outer loop (lines) */
|
||||
"movq %%rbx, %%rcx \n\t" /* Load the counting register (rcx) with the width of the window to shade */
|
||||
"incq %%rcx \n\t"
|
||||
"2: \n\t" /* The start of the inner loop (columns) */
|
||||
"movq (%%rsi, %%rcx, 4), %%xmm1 \n\t" /* sets mm1 to the 32bit color in the image map (data[ rcx ]) */
|
||||
/* 32 bit color is still 4 bytes so leave the multiplier alone it is zero extended to 128 bits */
|
||||
/* only move 32 bits with movd so we don't get two pixels worth of colors */
|
||||
"pxor %%xmm0, %%xmm0 \n\t" /* 128bit exclusive or (sets mm0 to 0) */
|
||||
"punpcklbw %%xmm1, %%xmm0 \n\t" /* Unpack and interleave low bytes */
|
||||
/* For each color of the pixel expand to 16 bits and shift left 8 bits */
|
||||
/* From A64_128bit_Media_Programming (p. 374) */
|
||||
/* discard high 64 bits and expand both mm0 and mm1 a byte at a time into mm0 (mm0 first) */
|
||||
"pxor %%xmm6, %%xmm0 \n\t" /* This flips the sign of the 16 bit red, green, and blue colors. (mm6 ~= 1000:0000 8 times) */
|
||||
"pmulhw %%xmm4, %%xmm0 \n\t" /* Package Multiply High Signed Word (an SSE2 instruction) 128bit mm0=color mm4=cm */
|
||||
/* Each 16 bit signed int in mm4 (8) is multiplied by the same in mm0 */
|
||||
/* and the high 16 bits of the result replace the 16 bits used from mm0 */
|
||||
/* For (( each 16 bit color * each 16 bit color modifier ) >> 16 ) */
|
||||
"psubw %%xmm5, %%xmm0 \n\t" /* Packed Subtract Words */
|
||||
/* From A64_128bit_Media_Programming (p. 364) */
|
||||
/* mm0=modified color mm5=corrected color modifier. mm0 = ( mm0 - mm5 ) */
|
||||
/* 16 bit corrected modified color = ( modified color - corrected color modifier ) */
|
||||
"packuswb %%xmm0, %%xmm0 \n\t" /* Pack with Saturation Signed Word to Unsigned Byte */
|
||||
/* From A64_128bit_Media_Programming (p. 246) */
|
||||
/* if mm0 > 255 then mm0=255 elsif mm0 < 0 mm0=0 else mm0=mm0 */
|
||||
/* The top 64 bits are now trashed. The remaining 64 bits are 2 pixels */
|
||||
"movq %%xmm0, (%%rsi, %%rcx, 4) \n\t" /* puts the new 32 bit color value back into the data (image map) */
|
||||
/* 32 bit color is still a double word so movd stays movd */
|
||||
"addq $2, %%rcx \n\t" /* Increment the count register (more pixels left) */
|
||||
"js 2b \n\t" /* Jump backwards to label 2 (restart inner loop) on negative (more pixels left) */
|
||||
"jmp 5f \n\t" /* Jump to single pixel section after pairs are exhausted */
|
||||
"4: \n\t" /* The start of the inner loop (columns) */
|
||||
"movd (%%rsi, %%rcx, 4), %%xmm1 \n\t" /* sets mm1 to the 32bit color in the image map (data[ rcx ]) */
|
||||
/* 32 bit color is still 4 bytes so leave the multiplier alone it is zero extended to 128 bits */
|
||||
/* only move 32 bits with movd so we don't get two pixels worth of colors */
|
||||
"pxor %%xmm0, %%xmm0 \n\t" /* 128bit exclusive or (sets mm0 to 0) */
|
||||
"punpcklbw %%xmm1, %%xmm0 \n\t" /* Unpack and interleave low bytes */
|
||||
/* For each color of the pixel expand to 16 bits and shift left 8 bits */
|
||||
/* From A64_128bit_Media_Programming (p. 374) */
|
||||
/* discard high 64 bits and expand both mm0 and mm1 a byte at a time into mm0 (mm0 first) */
|
||||
"pxor %%xmm6, %%xmm0 \n\t" /* This flips the sign of the 16 bit red, green, and blue colors. (mm6 ~= 1000:0000 8 times) */
|
||||
"pmulhw %%xmm4, %%xmm0 \n\t" /* Package Multiply High Signed Word (an SSE2 instruction) 128bit mm0=color mm4=cm */
|
||||
/* Each 16 bit signed int in mm4 (8) is multiplied by the same in mm0 */
|
||||
/* and the high 16 bits of the result replace the 16 bits used from mm0 */
|
||||
/* For (( each 16 bit color * each 16 bit color modifier ) >> 16 ) */
|
||||
"psubw %%xmm5, %%xmm0 \n\t" /* Packed Subtract Words */
|
||||
/* From A64_128bit_Media_Programming (p. 364) */
|
||||
/* mm0=modified color mm5=corrected color modifier. mm0 = ( mm0 - mm5 ) */
|
||||
/* 16 bit corrected modified color = ( modified color - corrected color modifier ) */
|
||||
"packuswb %%xmm0, %%xmm0 \n\t" /* Pack with Saturation Signed Word to Unsigned Byte */
|
||||
/* From A64_128bit_Media_Programming (p. 246) */
|
||||
/* if mm0 > 255 then mm0=255 elsif mm0 < 0 mm0=0 else mm0=mm0 */
|
||||
"movd %%xmm0, (%%rsi, %%rcx, 4) \n\t" /* puts the new 32 bit color value back into the data (image map) */
|
||||
/* 32 bit color is still a double word so movd stays movd */
|
||||
"incq %%rcx \n\t" /* Increment the count register (more pixels left) */
|
||||
"5: \n\t" /* Jump here after all pairs of pixels are exhausted */
|
||||
"cmpq $0, %%rcx \n\t" /* Increment the count register (more pixels left) */
|
||||
"jng 4b \n\t" /* Jump backwards to label 2 (restart inner loop) on NOT zero (more pixels left) */
|
||||
|
||||
"addq %%rax, %%rsi \n\t" /* Add bytes per line to the data pointer (advance the pointer to the next line) */
|
||||
"decq %%rdx \n\t" /* Decrement the dx register (row count) */
|
||||
"jnz 1b \n\t" /* Jump backwards to label 1 (restart outer loop) if not zero (more rows left) */
|
||||
"10: \n\t" /* End of function (jump here to clean up and return to caller */
|
||||
"emms \n\t" /* exit multi-media state (last asm instruction) */
|
||||
: /* outputs: none */
|
||||
/* inputs: (many operations cannot be performed with a mix of 32bit & 64bit operands directly) */
|
||||
/* (however the compiler/assembler can preload 32bit values into 64bit registers) */
|
||||
/* (that is why certain variables cannot be referenced by name -- use their register) */
|
||||
: [data] "S" (data), /* put the pointer data into the rsi register */
|
||||
[width] "b" (w), /* put the width in the %rbx register (cannot be referenced by name) */
|
||||
[height] "d" (h), /* put the heigth in the %rdx register (cannot be referenced by name) */
|
||||
[red_mod] "r" (rm), /* put the red_modifier in a register (referenced by name) */
|
||||
[green_mod] "r" (gm), /* put the green_modifier in a register (referenced by name) */
|
||||
[blue_mod] "r" (bm), /* put the blue_modifier in a register (referenced by name) */
|
||||
[bytes_line] "a" (bpl) /* put the bytes_per_line in the %rax register (cannot be referenced by name) */
|
||||
: "memory" /* clobbers: (memory includes all the registers) */
|
||||
); /* End of Assembly */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -73,7 +73,6 @@ Atom props[NUM_PROPS];
|
|||
int
|
||||
eterm_bootstrap(int argc, char *argv[])
|
||||
{
|
||||
|
||||
int i;
|
||||
char *val;
|
||||
|
||||
|
@ -81,7 +80,7 @@ eterm_bootstrap(int argc, char *argv[])
|
|||
static char windowid_string[20], *display_string, *term_string;
|
||||
|
||||
orig_argv0 = argv[0];
|
||||
|
||||
|
||||
/* Security enhancements -- mej */
|
||||
putenv("IFS= \t\n");
|
||||
my_ruid = getuid();
|
||||
|
@ -96,9 +95,7 @@ eterm_bootstrap(int argc, char *argv[])
|
|||
init_libast();
|
||||
|
||||
/* Open display, get options/resources and create the window */
|
||||
if (getenv("DISPLAY") == NULL) {
|
||||
display_name = STRDUP(":0");
|
||||
} else {
|
||||
if (getenv("DISPLAY") != NULL) {
|
||||
display_name = STRDUP(getenv("DISPLAY"));
|
||||
}
|
||||
|
||||
|
@ -116,8 +113,10 @@ eterm_bootstrap(int argc, char *argv[])
|
|||
#ifdef NEED_LINUX_HACK
|
||||
privileges(REVERT);
|
||||
#endif
|
||||
if (!Xdisplay) {
|
||||
print_error("can't open display %s\n", display_name);
|
||||
|
||||
if (!Xdisplay && !(Xdisplay = XOpenDisplay(display_name))) {
|
||||
libast_print_error("Can't open display %s. Set $DISPLAY or use --display\n",
|
||||
NONULL(display_name));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
XSetErrorHandler((XErrorHandler) xerror_handler);
|
||||
|
@ -154,21 +153,23 @@ eterm_bootstrap(int argc, char *argv[])
|
|||
props[PROP_EWMH_ICON] = XInternAtom(Xdisplay, "_NET_WM_ICON", False);
|
||||
props[PROP_EWMH_OPACITY] = XInternAtom(Xdisplay, "_NET_WM_WINDOW_OPACITY", True);
|
||||
props[PROP_EWMH_STARTUP_ID] = XInternAtom(Xdisplay, "_NET_STARTUP_ID", False);
|
||||
props[PROP_EWMH_STATE] = XInternAtom(Xdisplay, "_NET_WM_STATE", False);
|
||||
props[PROP_EWMH_STATE_STICKY] = XInternAtom(Xdisplay, "_NET_WM_STATE_STICKY", False);
|
||||
|
||||
if ((theme_dir = conf_parse_theme(&rs_theme, THEME_CFG, PARSE_TRY_ALL)) != NULL) {
|
||||
if ((theme_dir = spifconf_parse_theme(&rs_theme, THEME_CFG, PARSE_TRY_ALL)) != NULL) {
|
||||
char *tmp;
|
||||
|
||||
D_OPTIONS(("conf_parse_theme() returned \"%s\"\n", theme_dir));
|
||||
D_OPTIONS(("spifconf_parse_theme() returned \"%s\"\n", theme_dir));
|
||||
tmp = (char *) MALLOC(strlen(theme_dir) + sizeof("ETERM_THEME_ROOT=\0"));
|
||||
sprintf(tmp, "ETERM_THEME_ROOT=%s", theme_dir);
|
||||
putenv(tmp);
|
||||
}
|
||||
if ((user_dir =
|
||||
conf_parse_theme(&rs_theme, (rs_config_file ? rs_config_file : USER_CFG),
|
||||
spifconf_parse_theme(&rs_theme, (rs_config_file ? rs_config_file : USER_CFG),
|
||||
(PARSE_TRY_USER_THEME | PARSE_TRY_NO_THEME))) != NULL) {
|
||||
char *tmp;
|
||||
|
||||
D_OPTIONS(("conf_parse_theme() returned \"%s\"\n", user_dir));
|
||||
D_OPTIONS(("spifconf_parse_theme() returned \"%s\"\n", user_dir));
|
||||
tmp = (char *) MALLOC(strlen(user_dir) + sizeof("ETERM_USER_ROOT=\0"));
|
||||
sprintf(tmp, "ETERM_USER_ROOT=%s", user_dir);
|
||||
putenv(tmp);
|
||||
|
@ -262,24 +263,10 @@ eterm_bootstrap(int argc, char *argv[])
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef DISPLAY_IS_IP
|
||||
/* Fixup display_name for export over pty to any interested terminal
|
||||
* clients via "ESC[7n" (e.g. shells). Note we use the pure IP number
|
||||
* (for the first non-loopback interface) that we get from
|
||||
* network_display(). This is more "name-resolution-portable", if you
|
||||
* will, and probably allows for faster x-client startup if your name
|
||||
* server is beyond a slow link or overloaded at client startup. Of
|
||||
* course that only helps the shell's child processes, not us.
|
||||
*
|
||||
* Giving out the display_name also affords a potential security hole
|
||||
*/
|
||||
|
||||
val = display_name = network_display(display_name);
|
||||
if (val == NULL)
|
||||
#endif /* DISPLAY_IS_IP */
|
||||
val = XDisplayString(Xdisplay);
|
||||
if (display_name == NULL)
|
||||
display_name = val; /* use broken `:0' value */
|
||||
val = XDisplayString(Xdisplay);
|
||||
if (display_name == NULL) {
|
||||
display_name = val;
|
||||
}
|
||||
|
||||
i = strlen(val);
|
||||
display_string = MALLOC(i + 9);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -106,6 +106,8 @@ enum {
|
|||
PROP_EWMH_ICON,
|
||||
PROP_EWMH_OPACITY,
|
||||
PROP_EWMH_STARTUP_ID,
|
||||
PROP_EWMH_STATE,
|
||||
PROP_EWMH_STATE_STICKY,
|
||||
NUM_PROPS
|
||||
};
|
||||
|
||||
|
|
26
src/system.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -52,6 +52,7 @@ wait_for_chld(int system_pid)
|
|||
while (1) {
|
||||
do {
|
||||
errno = 0;
|
||||
usleep(10);
|
||||
} while ((((pid = waitpid(system_pid, &status, WNOHANG)) == -1) && (errno == EINTR)) || !pid);
|
||||
/* If the child that exited is the command we spawned, or if the
|
||||
child exited before fork() returned in the parent, it must be
|
||||
|
@ -79,32 +80,20 @@ wait_for_chld(int system_pid)
|
|||
}
|
||||
|
||||
/* Replace the system() call with a fork-and-exec that unprivs the child process */
|
||||
|
||||
int
|
||||
system_wait(char *command)
|
||||
{
|
||||
|
||||
pid_t pid;
|
||||
|
||||
D_OPTIONS(("system_wait(%s) called.\n", command));
|
||||
|
||||
if (!(pid = fork())) {
|
||||
setreuid(my_ruid, my_ruid);
|
||||
setregid(my_rgid, my_rgid);
|
||||
execl("/bin/sh", "sh", "-c", command, (char *) NULL);
|
||||
print_error("execl(%s) failed -- %s\n", command, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
D_OPTIONS(("%d: fork() returned %d\n", getpid(), pid));
|
||||
return (wait_for_chld(pid));
|
||||
}
|
||||
ASSERT_NOTREACHED_RVAL(0);
|
||||
pid = system_no_wait(command);
|
||||
return (wait_for_chld(pid));
|
||||
}
|
||||
|
||||
int
|
||||
pid_t
|
||||
system_no_wait(char *command)
|
||||
{
|
||||
|
||||
pid_t pid;
|
||||
|
||||
D_OPTIONS(("system_no_wait(%s) called.\n", command));
|
||||
|
@ -113,8 +102,9 @@ system_no_wait(char *command)
|
|||
setreuid(my_ruid, my_ruid);
|
||||
setregid(my_rgid, my_rgid);
|
||||
execl("/bin/sh", "sh", "-c", command, (char *) NULL);
|
||||
print_error("execl(%s) failed -- %s\n", command, strerror(errno));
|
||||
libast_print_error("execl(%s) failed -- %s\n", command, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
return (0);
|
||||
D_OPTIONS(("%d: fork() returned %d\n", getpid(), pid));
|
||||
return (pid);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -36,6 +36,6 @@ typedef RETSIGTYPE (*eterm_sighandler_t)(int);
|
|||
|
||||
extern int wait_for_chld(int);
|
||||
extern int system_wait(char *);
|
||||
extern int system_no_wait(char *);
|
||||
extern pid_t system_no_wait(char *);
|
||||
|
||||
#endif /* _SYSTEM_H_ */
|
||||
|
|
18
src/term.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -1077,11 +1077,11 @@ popen_printer(void)
|
|||
FILE *stream;
|
||||
|
||||
if (((my_ruid != my_euid) || (my_rgid != my_egid)) && (strcmp(rs_print_pipe, PRINTPIPE))) {
|
||||
print_warning("Running setuid/setgid. Refusing to use custom printpipe.\n");
|
||||
libast_print_warning("Running setuid/setgid. Refusing to use custom printpipe.\n");
|
||||
RESET_AND_ASSIGN(rs_print_pipe, STRDUP(PRINTPIPE));
|
||||
}
|
||||
if ((stream = (FILE *) popen(rs_print_pipe, "w")) == NULL) {
|
||||
print_error("Can't open printer pipe \"%s\" -- %s\n", rs_print_pipe, strerror(errno));
|
||||
libast_print_error("Can't open printer pipe \"%s\" -- %s\n", rs_print_pipe, strerror(errno));
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
@ -2526,22 +2526,22 @@ xterm_seq(int op, const char *str)
|
|||
#ifdef XTERM_SCROLLBAR
|
||||
scrollbar_change_type(SCROLLBAR_XTERM);
|
||||
#else
|
||||
print_error("Support for xterm scrollbars was not compiled in. Sorry.\n");
|
||||
libast_print_error("Support for xterm scrollbars was not compiled in. Sorry.\n");
|
||||
#endif
|
||||
} else if (!strcasecmp(nstr, "next")) {
|
||||
#ifdef NEXT_SCROLLBAR
|
||||
scrollbar_change_type(SCROLLBAR_NEXT);
|
||||
#else
|
||||
print_error("Support for NeXT scrollbars was not compiled in. Sorry.\n");
|
||||
libast_print_error("Support for NeXT scrollbars was not compiled in. Sorry.\n");
|
||||
#endif
|
||||
} else if (!strcasecmp(nstr, "motif")) {
|
||||
#ifdef MOTIF_SCROLLBAR
|
||||
scrollbar_change_type(SCROLLBAR_MOTIF);
|
||||
#else
|
||||
print_error("Support for motif scrollbars was not compiled in. Sorry.\n");
|
||||
libast_print_error("Support for motif scrollbars was not compiled in. Sorry.\n");
|
||||
#endif
|
||||
} else {
|
||||
print_error("Unrecognized scrollbar type \"%s\".\n", nstr);
|
||||
libast_print_error("Unrecognized scrollbar type \"%s\".\n", nstr);
|
||||
}
|
||||
}
|
||||
nstr = (char *) strsep(&tnstr, ";");
|
||||
|
@ -2619,6 +2619,10 @@ xterm_seq(int op, const char *str)
|
|||
XSetWMHints(Xdisplay, TermWin.parent, wm_hints);
|
||||
XFree(wm_hints);
|
||||
break;
|
||||
case 28:
|
||||
nstr = (char *) strsep(&tnstr, ";");
|
||||
OPT_SET_OR_TOGGLE(nstr, vt_options, VT_OPTIONS_URG_ALERT);
|
||||
break;
|
||||
case 40:
|
||||
nstr = (char *) strsep(&tnstr, ";");
|
||||
if (nstr) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
24
src/utmp.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -38,7 +38,7 @@ 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(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
|
||||
# if defined(USE_SYSV_UTMP) || defined(NEW_BSD_UTMP) || defined(__OpenBSD__)
|
||||
static char ut_id[5]; /* remember if entry to utmp made */
|
||||
# else
|
||||
static int utmp_pos; /* BSD position of utmp-stamp */
|
||||
|
@ -117,7 +117,7 @@ add_utmp_entry(const char *pty, const char *hostname, int fd)
|
|||
if (sscanf(pty, "pts/%d", &n) == 1)
|
||||
sprintf(ut_id, "vt%02x", n); /* sysv naming */
|
||||
else {
|
||||
print_error("can't parse tty name \"%s\"\n", pty);
|
||||
libast_print_error("can't parse tty name \"%s\"\n", pty);
|
||||
ut_id[0] = '\0'; /* entry not made */
|
||||
return;
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ remove_utmp_entry(void)
|
|||
# else /* USE_SYSV_UTMP */
|
||||
/* BSD utmp support */
|
||||
|
||||
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
|
||||
# ifdef NEW_BSD_UTMP
|
||||
|
||||
/* used to hold the line we are using */
|
||||
static char ut_line[32];
|
||||
|
@ -270,7 +270,7 @@ b_login(struct utmp *ut)
|
|||
}
|
||||
}
|
||||
|
||||
# else /* __FreeBSD__ || NetBSD || BSDI */
|
||||
# else /* NEW_BSD_UTMP */
|
||||
static int utmp_pos = 0; /* position of utmp-stamp */
|
||||
|
||||
/*----------------------------------------------------------------------*
|
||||
|
@ -328,7 +328,7 @@ write_utmp(struct utmp *putmp)
|
|||
return rval;
|
||||
}
|
||||
|
||||
# endif /* __FreeBSD__ || NetBSD || BSDI */
|
||||
# endif /* NEW_BSD_UTMP */
|
||||
|
||||
void
|
||||
add_utmp_entry(const char *pty, const char *hostname, int fd)
|
||||
|
@ -343,12 +343,12 @@ add_utmp_entry(const char *pty, const char *hostname, int fd)
|
|||
if (!strncmp(pty, "pty", 3) || !strncmp(pty, "tty", 3))
|
||||
strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */
|
||||
else {
|
||||
print_error("can't parse tty name \"%s\"\n", pty);
|
||||
libast_print_error("can't parse tty name \"%s\"\n", pty);
|
||||
ut_id[0] = '\0'; /* entry not made */
|
||||
return;
|
||||
}
|
||||
|
||||
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
|
||||
# ifdef NEW_BSD_UTMP
|
||||
strncpy(ut_line, pty, 31);
|
||||
|
||||
strncpy(utmp.ut_line, pty, UT_LINESIZE);
|
||||
|
@ -357,7 +357,7 @@ add_utmp_entry(const char *pty, const char *hostname, int fd)
|
|||
utmp.ut_time = time(NULL);
|
||||
|
||||
b_login(&utmp);
|
||||
# else /* __FreeBSD__ || NetBSD || BSDI */
|
||||
# else /* NEW_BSD_UTMP */
|
||||
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));
|
||||
|
@ -376,10 +376,10 @@ add_utmp_entry(const char *pty, const char *hostname, int fd)
|
|||
void
|
||||
remove_utmp_entry(void)
|
||||
{
|
||||
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
|
||||
# ifdef NEW_BSD_UTMP
|
||||
logout(ut_line);
|
||||
logwtmp(ut_line, "", "");
|
||||
# else /* __FreeBSD__ */
|
||||
# else /* NEW_BSD_UTMP */
|
||||
FILE *fd;
|
||||
|
||||
privileges(INVOKE);
|
||||
|
@ -393,7 +393,7 @@ remove_utmp_entry(void)
|
|||
fclose(fd);
|
||||
}
|
||||
privileges(REVERT);
|
||||
# endif /* __FreeBSD__ || NetBSD || BSDI */
|
||||
# endif /* NEW_BSD_UTMP */
|
||||
}
|
||||
|
||||
# endif /* USE_SYSV_UTMP */
|
||||
|
|
105
src/windows.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -96,7 +96,7 @@ get_tint_by_color_name(const char *color)
|
|||
|
||||
D_PIXMAP(("Tint string is \"%s\", white color is rgbi:%d/%d/%d\n", color, wcol.red, wcol.green, wcol.blue));
|
||||
if (!XParseColor(Xdisplay, cmap, color, &xcol)) {
|
||||
print_error("Unable to parse tint color \"%s\". Ignoring.\n", color);
|
||||
libast_print_error("Unable to parse tint color \"%s\". Ignoring.\n", color);
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ get_bottom_shadow_color(Pixel norm_color, const char *type)
|
|||
xcol.blue /= 2;
|
||||
|
||||
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
|
||||
print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red,
|
||||
libast_print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red,
|
||||
xcol.green, xcol.blue);
|
||||
xcol.pixel = PixColors[minColor];
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ get_top_shadow_color(Pixel norm_color, const char *type)
|
|||
xcol.blue = MIN(white.blue, (xcol.blue * 7) / 5);
|
||||
|
||||
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
|
||||
print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red,
|
||||
libast_print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red,
|
||||
xcol.green, xcol.blue);
|
||||
xcol.pixel = PixColors[WhiteColor];
|
||||
}
|
||||
|
@ -204,11 +204,11 @@ get_color_by_name(const char *name, const char *fallback)
|
|||
}
|
||||
}
|
||||
if (!XParseColor(Xdisplay, cmap, name, &xcol)) {
|
||||
print_warning("Unable to resolve \"%s\" as a color name. Falling back on \"%s\".\n", name, NONULL(fallback));
|
||||
libast_print_warning("Unable to resolve \"%s\" as a color name. Falling back on \"%s\".\n", name, NONULL(fallback));
|
||||
name = fallback;
|
||||
if (name) {
|
||||
if (!XParseColor(Xdisplay, cmap, name, &xcol)) {
|
||||
print_warning
|
||||
libast_print_warning
|
||||
("Unable to resolve \"%s\" as a color name. This should never fail. Please repair/restore your RGB database.\n",
|
||||
name);
|
||||
return ((Pixel) - 1);
|
||||
|
@ -218,12 +218,12 @@ get_color_by_name(const char *name, const char *fallback)
|
|||
}
|
||||
}
|
||||
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
|
||||
print_warning("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map. Falling back on \"%s\".\n",
|
||||
libast_print_warning("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map. Falling back on \"%s\".\n",
|
||||
name, xcol.pixel, xcol.red, xcol.green, xcol.blue, NONULL(fallback));
|
||||
name = fallback;
|
||||
if (name) {
|
||||
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
|
||||
print_warning("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", name, xcol.pixel,
|
||||
libast_print_warning("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", name, xcol.pixel,
|
||||
xcol.red, xcol.green, xcol.blue);
|
||||
return ((Pixel) - 1);
|
||||
}
|
||||
|
@ -241,19 +241,19 @@ get_color_by_pixel(Pixel pixel, Pixel fallback)
|
|||
|
||||
xcol.pixel = pixel;
|
||||
if (!XQueryColor(Xdisplay, cmap, &xcol)) {
|
||||
print_warning("Unable to convert pixel value 0x%08x to an XColor structure. Falling back on 0x%08x.\n", pixel, fallback);
|
||||
libast_print_warning("Unable to convert pixel value 0x%08x to an XColor structure. Falling back on 0x%08x.\n", pixel, fallback);
|
||||
xcol.pixel = fallback;
|
||||
if (!XQueryColor(Xdisplay, cmap, &xcol)) {
|
||||
print_warning("Unable to convert pixel value 0x%08x to an XColor structure.\n", xcol.pixel);
|
||||
libast_print_warning("Unable to convert pixel value 0x%08x to an XColor structure.\n", xcol.pixel);
|
||||
return ((Pixel) 0);
|
||||
}
|
||||
}
|
||||
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
|
||||
print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map. Falling back on 0x%08x.\n", xcol.pixel,
|
||||
libast_print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map. Falling back on 0x%08x.\n", xcol.pixel,
|
||||
xcol.red, xcol.green, xcol.blue, fallback);
|
||||
xcol.pixel = fallback;
|
||||
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
|
||||
print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map.\n", xcol.pixel, xcol.red,
|
||||
libast_print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map.\n", xcol.pixel, xcol.red,
|
||||
xcol.green, xcol.blue);
|
||||
return ((Pixel) 0);
|
||||
}
|
||||
|
@ -363,6 +363,48 @@ 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[])
|
||||
|
@ -378,14 +420,13 @@ Create_Windows(int argc, char *argv[])
|
|||
MWMHints mwmhints;
|
||||
|
||||
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_BORDERLESS)) {
|
||||
prop = XInternAtom(Xdisplay, "_MOTIF_WM_INFO", True);
|
||||
if (prop == None) {
|
||||
print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");
|
||||
Attributes.override_redirect = TRUE;
|
||||
mwmhints.flags = 0;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
mwmhints.flags = 0;
|
||||
|
@ -498,10 +539,16 @@ Create_Windows(int argc, char *argv[])
|
|||
XChangeProperty(Xdisplay, TermWin.parent, props[PROP_DESKTOP], XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &val, 1);
|
||||
}
|
||||
|
||||
/* Make window sticky if requested */
|
||||
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_STICKY)) {
|
||||
XChangeProperty(Xdisplay, TermWin.parent, props[PROP_EWMH_STATE], XA_ATOM, 32, PropModeReplace,
|
||||
(unsigned char *) &props[PROP_EWMH_STATE_STICKY], 1);
|
||||
}
|
||||
|
||||
/* Set startup ID property if given by the launching application. */
|
||||
if (getenv("DESKTOP_STARTUP_ID")) {
|
||||
Atom atom;
|
||||
unsigned char *tmp = SPIF_CAST_PTR(uchar) getenv("DESKTOP_STARTUP_ID");
|
||||
unsigned char *tmp = (spif_uchar_t *) getenv("DESKTOP_STARTUP_ID");
|
||||
|
||||
atom = XInternAtom(Xdisplay, "UTF8_STRING", False);
|
||||
XChangeProperty(Xdisplay, TermWin.parent, props[PROP_EWMH_STARTUP_ID], atom, 8, PropModeReplace, tmp, strlen(tmp) + 1);
|
||||
|
@ -511,9 +558,9 @@ Create_Windows(int argc, char *argv[])
|
|||
/* Set window opacity if needed. */
|
||||
if ((props[PROP_EWMH_OPACITY] != None) && (rs_opacity != 0xff)) {
|
||||
XChangeProperty(Xdisplay, TermWin.parent, props[PROP_EWMH_OPACITY],
|
||||
XA_CARDINAL, 32, PropModeReplace, SPIF_CAST_PTR(uchar) & rs_opacity, 1);
|
||||
XA_CARDINAL, 32, PropModeReplace, (spif_uchar_t *) &rs_opacity, 1);
|
||||
XChangeProperty(Xdisplay, TermWin.vt, props[PROP_EWMH_OPACITY],
|
||||
XA_CARDINAL, 32, PropModeReplace, SPIF_CAST_PTR(uchar) & rs_opacity, 1);
|
||||
XA_CARDINAL, 32, PropModeReplace, (spif_uchar_t *) &rs_opacity, 1);
|
||||
}
|
||||
|
||||
/* We're done creating our windows. Now let's initialize the event subsystem to handle them. */
|
||||
|
@ -691,11 +738,19 @@ handle_resize(unsigned int width, unsigned int height)
|
|||
void
|
||||
handle_move(int x, int y)
|
||||
{
|
||||
int dx, dy;
|
||||
|
||||
if ((TermWin.x != x) || (TermWin.y != y)) {
|
||||
dx = abs(TermWin.x - x);
|
||||
dy = abs(TermWin.y - y);
|
||||
TermWin.x = x;
|
||||
TermWin.y = y;
|
||||
/* If we've moved an even multiple of the screen size, there's no
|
||||
need to redraw trans/viewport images; the images will line up. */
|
||||
if (image_mode_any(MODE_TRANS | MODE_VIEWPORT)) {
|
||||
redraw_images_by_mode(MODE_TRANS | MODE_VIEWPORT);
|
||||
if ((dx % DisplayWidth(Xdisplay, Xscreen)) || (dy % DisplayHeight(Xdisplay, Xscreen))) {
|
||||
redraw_images_by_mode(MODE_TRANS | MODE_VIEWPORT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -740,12 +795,12 @@ set_window_color(int idx, const char *color)
|
|||
} else if (i >= 0 && i <= 7) { /* normal colors */
|
||||
PixColors[idx] = PixColors[minColor + i];
|
||||
} else {
|
||||
print_warning("Color index %d is invalid.\n", i);
|
||||
libast_print_warning("Color index %d is invalid.\n", i);
|
||||
return;
|
||||
}
|
||||
} else if (XParseColor(Xdisplay, cmap, color, &xcol)) {
|
||||
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
|
||||
print_warning("Unable to allocate \"%s\" in the color map.\n", color);
|
||||
libast_print_warning("Unable to allocate \"%s\" in the color map.\n", color);
|
||||
return;
|
||||
}
|
||||
if ((idx > maxBright) && (idx < 256) && (PixColors[idx])) {
|
||||
|
@ -753,7 +808,7 @@ set_window_color(int idx, const char *color)
|
|||
}
|
||||
PixColors[idx] = xcol.pixel;
|
||||
} else {
|
||||
print_warning("Unable to resolve \"%s\" as a color name.\n", color);
|
||||
libast_print_warning("Unable to resolve \"%s\" as a color name.\n", color);
|
||||
return;
|
||||
}
|
||||
set_colorfgbg();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
timestamp
|
|
@ -5,7 +5,7 @@
|
|||
* This program is distributed under the GNU Public License (GPL) as
|
||||
* outlined in the COPYING file.
|
||||
*
|
||||
* Copyright (C) 1997-2000, Brian McFee.
|
||||
* Copyright (C) 1997-2009, Brian McFee.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
/* Ettable -- Eterm ASCII Table Display Utility
|
||||
|
||||
* This file is original work by Michael Jennings <mej@eterm.org>.
|
||||
* This program is distributed under the GNU Public License (GPL) as
|
||||
* outlined in the COPYING file.
|
||||
*
|
||||
* Copyright (C) 1997-2004, Michael Jennings
|
||||
* Copyright (C) 1997-2009, Michael Jennings
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies of the Software, its documentation and marketing & publicity
|
||||
* materials, and acknowledgment shall be given in the documentation, materials
|
||||
* and software packages that this Software was used.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
static const char cvs_ident[] = "$Id$";
|
||||
|
|
|
@ -56,7 +56,7 @@ while (<in>) {
|
|||
}
|
||||
close (in);
|
||||
|
||||
system("@BINDIR@/Esetroot $PixMapMode-display :0 $PixMap");
|
||||
system("@BINDIR@/Esetroot $PixMapMode $PixMap");
|
||||
|
||||
if (!-e "$HOME/Desktop/Autostart/kEsetroot.kdelnk") {
|
||||
print "Do you want to start kEsetroot when KDE starts? y/n [y] ";
|
||||
|
|