mirror of
https://github.com/amiwm/amiwm.git
synced 2026-04-14 11:04:18 +00:00
Compare commits
100 Commits
redspl_ini
...
d7e7a8a6a2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7e7a8a6a2 | ||
|
|
f13edf56fd | ||
|
|
bf4806c066 | ||
|
|
beccf8b0fb | ||
|
|
f3fc2a7015 | ||
|
|
0c23eb0126 | ||
|
|
6685043266 | ||
|
|
8a59e5cc9e | ||
|
|
5bbae05fec | ||
|
|
1212e7a78c | ||
|
|
0a400a366a | ||
|
|
38913a983d | ||
|
|
a33d487fab | ||
|
|
a8f92b4e5b | ||
|
|
d3be9b113f | ||
|
|
d148a44402 | ||
|
|
78b416044c | ||
|
|
00025ae390 | ||
|
|
def62797f9 | ||
|
|
5823492992 | ||
|
|
a010c4406f | ||
|
|
f1e182de80 | ||
|
|
9b3846e15a | ||
|
|
147cb92b7f | ||
|
|
0f16b49701 | ||
|
|
c7b5bbe441 | ||
|
|
c3185246ca | ||
|
|
d91710ba03 | ||
|
|
cf6e360a7e | ||
|
|
34c0c7af02 | ||
|
|
9978760d7f | ||
|
|
f1bcd15eb6 | ||
|
|
798adaa45b | ||
|
|
a9d59a9fd4 | ||
|
|
3c29995649 | ||
|
|
f77c715b24 | ||
|
|
87ba044ea4 | ||
|
|
1a8a15e24f | ||
|
|
ecf427324c | ||
|
|
9ce1822bff | ||
|
|
93863ec396 | ||
|
|
631176c9a2 | ||
|
|
c0450d83bc | ||
|
|
229d2b2c4d | ||
|
|
5577e78cc8 | ||
|
|
918365056b | ||
|
|
feb42adcc6 | ||
|
|
e6f7a1bc17 | ||
|
|
21423a0c10 | ||
|
|
f116f9c335 | ||
|
|
2a9bd912a1 | ||
|
|
fc23b3e054 | ||
|
|
915b84e403 | ||
|
|
030f55fa2e | ||
|
|
4bd5a665db | ||
|
|
bfc0313ace | ||
|
|
54adc01be4 | ||
|
|
18e858ae80 | ||
|
|
e42512c034 | ||
|
|
9ac42a9f4a | ||
|
|
e73f47e1fb | ||
|
|
48f15595a4 | ||
|
|
0e5c81f6e3 | ||
|
|
161a78e648 | ||
|
|
e0c13213c5 | ||
|
|
72742103b5 | ||
|
|
d00be9ffa8 | ||
|
|
84caa252d1 | ||
|
|
743a7a666b | ||
|
|
6bd141dec1 | ||
|
|
64d540a026 | ||
|
|
26cecc8487 | ||
|
|
4162377f10 | ||
|
|
2a05c6f3e4 | ||
|
|
31b98f3ef0 | ||
|
|
32cfb5ab21 | ||
|
|
9825ecbe6b | ||
|
|
1ce0d7c975 | ||
|
|
294256771a | ||
|
|
77239205d7 | ||
|
|
b0830232ff | ||
|
|
54cb67609e | ||
|
|
5365f97cbe | ||
|
|
59eae9c029 | ||
|
|
31b2a069ea | ||
|
|
8e0948ca98 | ||
|
|
f90e57437d | ||
|
|
8bbae1ef0b | ||
|
|
fc0ecd5ecb | ||
|
|
6bde9903d9 | ||
|
|
b6d25b8f9b | ||
|
|
910c15cece | ||
|
|
a6cbde4cd7 | ||
|
|
a6b29a59ba | ||
|
|
5e6ed1191b | ||
|
|
03aaf742af | ||
|
|
d35ad096fc | ||
|
|
956d408386 | ||
|
|
a6ffcd2abc | ||
|
|
9113cdefc5 |
26
.gitignore
vendored
Normal file
26
.gitignore
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
*.a
|
||||||
|
*.o
|
||||||
|
Makefile
|
||||||
|
|
||||||
|
/Filesystem
|
||||||
|
/Keyboard
|
||||||
|
/Launcher
|
||||||
|
/Xinitrc
|
||||||
|
/Xsession
|
||||||
|
/Xsession2
|
||||||
|
/amiwm
|
||||||
|
/autom4te.cache/
|
||||||
|
/config.log
|
||||||
|
/config.status
|
||||||
|
/config_util
|
||||||
|
/configure
|
||||||
|
/executecmd
|
||||||
|
/gram.tab.c
|
||||||
|
/gram.tab.h
|
||||||
|
/kbdlexer.c
|
||||||
|
/kbdmodule.tab.c
|
||||||
|
/kbdmodule.tab.h
|
||||||
|
/lex.c
|
||||||
|
/ppmtoinfo
|
||||||
|
/requestchoice
|
||||||
|
/system.amiwmrc
|
||||||
7
Background_resize
Executable file
7
Background_resize
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "$3" = "0x00000000" ]; then
|
||||||
|
display -resize $(xwininfo -root | grep geometry | sed "s/-geometry //" | sed "s/+0+0//") -window root "$4" > /dev/null
|
||||||
|
else
|
||||||
|
display -resize $(xwininfo -root | grep geometry | sed "s/-geometry //" | sed "s/+0+0//") -window "$3" "$4" > /dev/null
|
||||||
|
fi
|
||||||
6
Background_stretch
Executable file
6
Background_stretch
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
if [ "$3" = "0x00000000" ]; then
|
||||||
|
display -resize $(xwininfo -root | grep geometry | sed "s/-geometry //" | sed "s/+0+0//")\! -window root "$4" > /dev/null
|
||||||
|
else
|
||||||
|
display -resize $(xwininfo -root | grep geometry | sed "s/-geometry //" | sed "s/+0+0//")\! -window "$3" "$4" > /dev/null
|
||||||
|
fi
|
||||||
87
Imakefile
87
Imakefile
@@ -1,87 +0,0 @@
|
|||||||
|
|
||||||
PROGRAMS = amiwm requestchoice executecmd
|
|
||||||
|
|
||||||
AMIWM_HOME = /usr/X11/lib/X11/amiwm
|
|
||||||
|
|
||||||
SRCS1 = main.c drawinfo.c client.c frame.c icc.c \
|
|
||||||
icon.c menu.c diskobject.c gram.c lex.c rc.c
|
|
||||||
OBJS1 = main.o drawinfo.o client.o frame.o icc.o \
|
|
||||||
icon.o menu.o diskobject.o gram.o lex.o rc.o
|
|
||||||
|
|
||||||
SRCS2 = requestchoice.c drawinfo.c
|
|
||||||
OBJS2 = requestchoice.o drawinfo.o
|
|
||||||
|
|
||||||
SRCS3 = executecmd.c drawinfo.c
|
|
||||||
OBJS3 = executecmd.o drawinfo.o
|
|
||||||
|
|
||||||
YFLAGS = -d
|
|
||||||
|
|
||||||
all::
|
|
||||||
|
|
||||||
/* Some old implementations does not have LexFile and YaccFile... */
|
|
||||||
|
|
||||||
#ifndef LexFile
|
|
||||||
#define LexFile(file) @@\
|
|
||||||
depend:: file.c @@\
|
|
||||||
@@\
|
|
||||||
clean:: @@\
|
|
||||||
$(RM) lex.yy.c file.c
|
|
||||||
#endif /* LexFile */
|
|
||||||
|
|
||||||
#ifndef YaccFile
|
|
||||||
#define YaccFile(file,flags) @@\
|
|
||||||
depend:: file.c @@\
|
|
||||||
@@\
|
|
||||||
file.h file.c: file.y @@\
|
|
||||||
$(YACC) flags file.y @@\
|
|
||||||
$(MV) y.tab.c file.c @@\
|
|
||||||
$(MV) y.tab.h file.h @@\
|
|
||||||
@@\
|
|
||||||
clean:: @@\
|
|
||||||
$(RM) y.tab.c y.tab.h file.h file.c
|
|
||||||
#endif /* YaccFile */
|
|
||||||
|
|
||||||
LexFile(lex)
|
|
||||||
|
|
||||||
YaccFile(gram,$(YFLAGS))
|
|
||||||
|
|
||||||
ComplexProgramTarget_1(amiwm, $(XLIB) $(XMULIB), $(OTHER_LIBS))
|
|
||||||
|
|
||||||
ComplexProgramTarget_2(requestchoice, $(XLIB), $(OTHER_LIBS))
|
|
||||||
|
|
||||||
ComplexProgramTarget_3(executecmd, $(XLIB), $(OTHER_LIBS))
|
|
||||||
|
|
||||||
SpecialCObjectRule(menu,$(_NOOP_),'-DAMIWM_HOME="$(AMIWM_HOME)"')
|
|
||||||
SpecialCObjectRule(rc,$(_NOOP_),'-DAMIWM_HOME="$(AMIWM_HOME)"')
|
|
||||||
|
|
||||||
install ::
|
|
||||||
MakeDir($(AMIWM_HOME))
|
|
||||||
RemoveFile($(AMIWM_HOME)/requestchoice)
|
|
||||||
$(LN) $(BINDIR)/requestchoice $(AMIWM_HOME)/requestchoice
|
|
||||||
RemoveFile($(AMIWM_HOME)/executecmd)
|
|
||||||
$(LN) $(BINDIR)/executecmd $(AMIWM_HOME)/executecmd
|
|
||||||
|
|
||||||
InstallNonExec(system.amiwmrc, $(AMIWM_HOME)/system.amiwmrc)
|
|
||||||
InstallNonExec(def_tool.info, $(AMIWM_HOME)/def_tool.info)
|
|
||||||
|
|
||||||
|
|
||||||
/* Targets for my private use. Not very portable. // Marcus */
|
|
||||||
|
|
||||||
DISTFILES = README INSTALL Imakefile smakefile scoptions *.[chly] \
|
|
||||||
system.amiwmrc def_tool.info
|
|
||||||
|
|
||||||
patch :
|
|
||||||
mv version.h old_version.h
|
|
||||||
sed < old_version.h 's/l/"/' | awk '-F"' '{ printf "%s\"%sl%s\"\n",$$1,$$2,1+$$3 }' > version.h
|
|
||||||
rm old_version.h
|
|
||||||
|
|
||||||
dist : version.h clean
|
|
||||||
( version=`sed < version.h -e 's/^[^"]*"//' -e 's/"[^"]*$$//'`; \
|
|
||||||
tarname="amiwm$$version.tar"; \
|
|
||||||
mkdir amiwm; \
|
|
||||||
cp $(DISTFILES) amiwm/; \
|
|
||||||
rm -f $$tarname $$tarname.gz; \
|
|
||||||
tar cf $$tarname amiwm; \
|
|
||||||
rm -rf amiwm/; \
|
|
||||||
gzip $$tarname; \
|
|
||||||
)
|
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
|
|
||||||
amiwm is Copyright 1995-1998 by Marcus Comstedt <marcus@lysator.liu.se>
|
**amiwm** is Copyright 1995-2011 by Marcus Comstedt <marcus@lysator.liu.se>
|
||||||
|
|
||||||
Amiga, AmigaOS and Workbench are registered trademarks of
|
Amiga, AmigaOS and Workbench are registered trademarks of
|
||||||
AMIGA International Inc.
|
AMIGA International Inc.
|
||||||
|
|
||||||
|
# Generic amiwm License
|
||||||
|
|
||||||
Generic amiwm License
|
|
||||||
=====================
|
|
||||||
|
|
||||||
This license applies to whomever receives this file. It is a generic
|
This license applies to whomever receives this file. It is a generic
|
||||||
license to use and distribute amiwm. If you want to acquire the software
|
license to use and distribute amiwm. If you want to acquire the software
|
||||||
@@ -18,7 +17,7 @@ non-commercial purposes, is hereby granted without fee, provided
|
|||||||
that this license information and copyright notice appear in all copies.
|
that this license information and copyright notice appear in all copies.
|
||||||
|
|
||||||
If you redistribute amiwm, the *entire* contents of this distribution
|
If you redistribute amiwm, the *entire* contents of this distribution
|
||||||
must be distributed, including the README, INSTALL and LICENSE files,
|
must be distributed, including the README.md and LICENSE.md files,
|
||||||
the sources, and the various scripts and Makefiles.
|
the sources, and the various scripts and Makefiles.
|
||||||
|
|
||||||
You may distribute binaries built from the unmodified amiwm sources, for
|
You may distribute binaries built from the unmodified amiwm sources, for
|
||||||
@@ -40,5 +39,4 @@ freely distribute patches against the unmodified source code.
|
|||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the author be held liable for any damages
|
warranty. In no event will the author be held liable for any damages
|
||||||
arising from the use of this software.
|
arising from the use of this software.
|
||||||
|
|
||||||
221
Makefile
221
Makefile
@@ -1,221 +0,0 @@
|
|||||||
srcdir = .
|
|
||||||
|
|
||||||
SHELL = /bin/sh
|
|
||||||
CC = gcc
|
|
||||||
LEX = flex
|
|
||||||
YACC = bison -y
|
|
||||||
CFLAGS = -g -O2
|
|
||||||
YFLAGS = -d
|
|
||||||
DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_RESOURCE_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_TERMIO_H=1 -DHAVE_X11_EXTENSIONS_SHAPE_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DRETSIGTYPE=void -DHAVE_WAIT3=1 -DHAVE_SELECT=1 -DHAVE_STRDUP=1 -DHAVE_WAITPID=1 -DHAVE_XSHAPE=1 -DBSD_STYLE_GETTIMEOFDAY=1 -DHAVE_XCREATEFONTSET=1 -DHAVE_XMBTEXTESCAPEMENT=1 -DHAVE_XUTF8DRAWIMAGESTRING=1 -DUSE_FONTSETS=1 -DLAME_ENDIAN=1
|
|
||||||
ALL_CFLAGS = -I. -I. -I./libami $(DEFS) $(CFLAGS)
|
|
||||||
LIBS = -lSM -lICE -Llibami -lami -lXext -lXmu \
|
|
||||||
-lX11
|
|
||||||
prefix = /usr/local
|
|
||||||
exec_prefix = ${prefix}
|
|
||||||
bindir = $(exec_prefix)/bin
|
|
||||||
libdir = $(exec_prefix)/lib
|
|
||||||
mandir = $(prefix)/man
|
|
||||||
INSTALL = /usr/bin/install -c
|
|
||||||
LN_S = ln -s
|
|
||||||
RM = -rm -f
|
|
||||||
LIBAMI = libami/libami.a
|
|
||||||
DT_DIR = /etc/dt
|
|
||||||
STRIPFLAG = -s
|
|
||||||
|
|
||||||
PROGS = amiwm requestchoice executecmd ppmtoinfo
|
|
||||||
|
|
||||||
MODULES = $(srcdir)/Background Keyboard Launcher
|
|
||||||
|
|
||||||
OBJS = main.o screen.o client.o frame.o icc.o \
|
|
||||||
icon.o menu.o diskobject.o gram.o lex.o rc.o \
|
|
||||||
module.o
|
|
||||||
|
|
||||||
SRCS = main.c screen.c client.c frame.c icc.c \
|
|
||||||
icon.c menu.c diskobject.c gram.c lex.c rc.c \
|
|
||||||
module.c \
|
|
||||||
requestchoice.c executecmd.c kbdmodule.c kbdlexer.c \
|
|
||||||
launchermodule.c
|
|
||||||
|
|
||||||
DISTFILES = README README.modules INSTALL LICENSE amiwm.1 \
|
|
||||||
configure configure.in Makefile.in install-sh smakefile scoptions \
|
|
||||||
*.[chly] system.amiwmrc def_*.info *.map \
|
|
||||||
Background Xresources.amiwm.in Amilogo.?m Xsession*.in Xinitrc.in \
|
|
||||||
amiwm-init libami/Makefile.in libami/*.[chly]
|
|
||||||
|
|
||||||
PACKAGENAME = amiwm
|
|
||||||
|
|
||||||
AMIWM_HOME = $(libdir)/amiwm
|
|
||||||
|
|
||||||
all : lib_all
|
|
||||||
@$(MAKE) local_all
|
|
||||||
|
|
||||||
local_all : $(PROGS) $(MODULES)
|
|
||||||
|
|
||||||
lib_all :
|
|
||||||
@( cd libami; $(MAKE) all )
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
|
|
||||||
|
|
||||||
menu.o : menu.c
|
|
||||||
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
|
|
||||||
|
|
||||||
rc.o : rc.c
|
|
||||||
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
|
|
||||||
|
|
||||||
diskobject.o : diskobject.c
|
|
||||||
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
|
|
||||||
|
|
||||||
filesystem.o : joke_fs.c
|
|
||||||
$(CC) -o $@ -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
|
|
||||||
|
|
||||||
ppmtoinfo.o : ppmtoinfo.c
|
|
||||||
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
|
|
||||||
|
|
||||||
gram.h gram.c: gram.y
|
|
||||||
$(YACC) $(YFLAGS) $<
|
|
||||||
mv y.tab.c gram.c
|
|
||||||
mv y.tab.h gram.h
|
|
||||||
|
|
||||||
lex.c : lex.l
|
|
||||||
$(LEX) -t $< > lex.c
|
|
||||||
|
|
||||||
kbdmodule.h kbdmodule.c: kbdmodule.y
|
|
||||||
$(YACC) $(YFLAGS) $<
|
|
||||||
mv y.tab.c kbdmodule.c
|
|
||||||
mv y.tab.h kbdmodule.h
|
|
||||||
|
|
||||||
kbdlexer.c : kbdlexer.l
|
|
||||||
$(LEX) -t $< > kbdlexer.c
|
|
||||||
|
|
||||||
install : $(PROGS) $(MODULES) Xsession Xsession2 Xinitrc amiwm-init
|
|
||||||
-mkdir -p $(AMIWM_HOME)
|
|
||||||
$(INSTALL) $(STRIPFLAG) requestchoice $(AMIWM_HOME)/requestchoice
|
|
||||||
$(INSTALL) $(STRIPFLAG) executecmd $(AMIWM_HOME)/executecmd
|
|
||||||
for module in $(MODULES); do \
|
|
||||||
if [ "$$module" = "$(srcdir)/Background" ]; then \
|
|
||||||
$(INSTALL) $$module $(AMIWM_HOME)/Background; \
|
|
||||||
else \
|
|
||||||
$(INSTALL) $(STRIPFLAG) $$module $(AMIWM_HOME)/$$module; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
$(INSTALL) -m 644 $(srcdir)/system.amiwmrc $(AMIWM_HOME)/system.amiwmrc
|
|
||||||
$(INSTALL) -m 644 $(srcdir)/def_tool.info $(AMIWM_HOME)/def_tool.info
|
|
||||||
$(INSTALL) -m 644 $(srcdir)/system.map $(AMIWM_HOME)/system.map
|
|
||||||
$(INSTALL) -m 644 $(srcdir)/magicwb.map $(AMIWM_HOME)/magicwb.map
|
|
||||||
$(INSTALL) -m 644 $(srcdir)/schwartz.map $(AMIWM_HOME)/schwartz.map
|
|
||||||
$(INSTALL) -m 755 Xsession $(AMIWM_HOME)/Xsession
|
|
||||||
$(INSTALL) -m 755 Xsession2 $(AMIWM_HOME)/Xsession2
|
|
||||||
$(INSTALL) -m 755 Xinitrc $(AMIWM_HOME)/Xinitrc
|
|
||||||
$(INSTALL) -m 755 $(srcdir)/amiwm-init $(AMIWM_HOME)/amiwm-init
|
|
||||||
-mkdir -p $(bindir)
|
|
||||||
$(INSTALL) $(STRIPFLAG) amiwm $(bindir)/amiwm
|
|
||||||
$(INSTALL) $(STRIPFLAG) ppmtoinfo $(bindir)/ppmtoinfo
|
|
||||||
$(RM) $(bindir)/requestchoice
|
|
||||||
$(LN_S) $(AMIWM_HOME)/requestchoice $(bindir)/requestchoice
|
|
||||||
-mkdir -p $(mandir)/man1
|
|
||||||
$(INSTALL) -m 644 $(srcdir)/amiwm.1 $(mandir)/man1/amiwm.1
|
|
||||||
|
|
||||||
fs-install : Filesystem
|
|
||||||
$(INSTALL) $(STRIPFLAG) Filesystem $(AMIWM_HOME)/Filesystem
|
|
||||||
$(INSTALL) -m 644 def_disk.info $(AMIWM_HOME)/def_disk.info
|
|
||||||
$(INSTALL) -m 644 def_drawer.info $(AMIWM_HOME)/def_disk.info
|
|
||||||
|
|
||||||
cde-install : Xresources.amiwm Amilogo.bm Amilogo.pm
|
|
||||||
-mkdir -p $(DT_DIR)/config/C/Xresources.d
|
|
||||||
$(INSTALL) -m 644 Xresources.amiwm $(DT_DIR)/config/C/Xresources.d/Xresources.amiwm
|
|
||||||
-mkdir -p $(DT_DIR)/appconfig/icons/C
|
|
||||||
$(INSTALL) -m 644 Amilogo.bm $(DT_DIR)/appconfig/icons/C/Amilogo.bm
|
|
||||||
$(INSTALL) -m 644 Amilogo.pm $(DT_DIR)/appconfig/icons/C/Amilogo.pm
|
|
||||||
|
|
||||||
|
|
||||||
amiwm : $(OBJS) $(LIBAMI)
|
|
||||||
$(CC) -o amiwm $(OBJS) $(LIBS)
|
|
||||||
|
|
||||||
requestchoice : requestchoice.o $(LIBAMI)
|
|
||||||
$(CC) -o requestchoice requestchoice.o $(LIBS)
|
|
||||||
|
|
||||||
executecmd : executecmd.o $(LIBAMI)
|
|
||||||
$(CC) -o executecmd executecmd.o $(LIBS)
|
|
||||||
|
|
||||||
Filesystem : filesystem.o $(LIBAMI)
|
|
||||||
$(CC) -o Filesystem filesystem.o $(LIBS)
|
|
||||||
|
|
||||||
Keyboard : kbdmodule.o kbdlexer.o $(LIBAMI)
|
|
||||||
$(CC) -o Keyboard kbdmodule.o kbdlexer.o $(LIBS)
|
|
||||||
|
|
||||||
Launcher : launchermodule.o $(LIBAMI)
|
|
||||||
$(CC) -o Launcher launchermodule.o $(LIBS)
|
|
||||||
|
|
||||||
ppmtoinfo : ppmtoinfo.o
|
|
||||||
$(CC) -o ppmtoinfo ppmtoinfo.o -lm
|
|
||||||
|
|
||||||
localetest : localetest.o $(LIBAMI)
|
|
||||||
$(CC) -o localetest localetest.o $(LIBS)
|
|
||||||
|
|
||||||
clean :
|
|
||||||
$(RM) core $(PROGS) $(LIBAMI) Keyboard Launcher *.o libami/*.o
|
|
||||||
$(RM) lex.yy.c lex.c y.tab.c y.tab.h gram.h gram.c
|
|
||||||
$(RM) kbdlexer.c kbdmodule.h kbdmodule.c
|
|
||||||
$(RM) config.log
|
|
||||||
|
|
||||||
distclean : clean
|
|
||||||
$(RM) config.status config.cache *~
|
|
||||||
$(RM) Makefile libami/Makefile Xresources.amiwm Xsession Xsession2 Xinitrc
|
|
||||||
|
|
||||||
spotless : distclean
|
|
||||||
|
|
||||||
TAGS:
|
|
||||||
etags *.[ch] libami/*.[ch]
|
|
||||||
|
|
||||||
patch :
|
|
||||||
mv version.h old_version.h
|
|
||||||
sed < old_version.h 's/l/"/' | awk '-F"' '{ printf "%s\"%sl%s\"\n",$$1,$$2,1+$$3 }' > version.h
|
|
||||||
rm old_version.h
|
|
||||||
|
|
||||||
dist : version.h clean
|
|
||||||
( version=`sed < version.h -e 's/^[^"]*"//' -e 's/"[^"]*$$//'`; \
|
|
||||||
tarname="$(PACKAGENAME)$$version.tar"; \
|
|
||||||
mkdir $(PACKAGENAME)$$version; \
|
|
||||||
tar cf - $(DISTFILES) | (cd $(PACKAGENAME)$$version/; tar xf - ); \
|
|
||||||
rm -f $$tarname $$tarname.gz; \
|
|
||||||
tar cf $$tarname $(PACKAGENAME)$$version; \
|
|
||||||
rm -rf $(PACKAGENAME)$$version; \
|
|
||||||
gzip $$tarname; \
|
|
||||||
)
|
|
||||||
|
|
||||||
$(srcdir)/configure: $(srcdir)/configure.in
|
|
||||||
autoconf $(srcdir)/configure.in > $(srcdir)/configure
|
|
||||||
|
|
||||||
config.status: $(srcdir)/configure
|
|
||||||
$(srcdir)/configure
|
|
||||||
|
|
||||||
Makefile: $(srcdir)/Makefile.in config.status
|
|
||||||
./config.status
|
|
||||||
|
|
||||||
libami/Makefile: $(srcdir)/libami/Makefile.in config.status
|
|
||||||
./config.status
|
|
||||||
|
|
||||||
Xresources.amiwm: $(srcdir)/Xresources.amiwm.in
|
|
||||||
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xresources.amiwm.in > Xresources.amiwm
|
|
||||||
|
|
||||||
Xsession: $(srcdir)/Xsession.in config.status
|
|
||||||
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xsession.in > Xsession
|
|
||||||
|
|
||||||
Xsession2: $(srcdir)/Xsession2.in config.status
|
|
||||||
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xsession2.in > Xsession2
|
|
||||||
|
|
||||||
Xinitrc: $(srcdir)/Xinitrc.in config.status
|
|
||||||
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xinitrc.in > Xinitrc
|
|
||||||
|
|
||||||
|
|
||||||
depend:: $(SRCS)
|
|
||||||
-@rm Makefile.bak
|
|
||||||
mv Makefile Makefile.bak
|
|
||||||
( sed '/^#--DO NOT REMOVE THIS LINE--$$/q' < Makefile.bak ; \
|
|
||||||
$(CC) -MM $(ALL_CFLAGS) $(SRCS) ) > Makefile
|
|
||||||
|
|
||||||
depend::
|
|
||||||
@( cd libami; $(MAKE) depend )
|
|
||||||
|
|
||||||
#--DO NOT REMOVE THIS LINE--
|
|
||||||
232
Makefile.in
232
Makefile.in
@@ -5,16 +5,16 @@ CC = @CC@
|
|||||||
LEX = @LEX@
|
LEX = @LEX@
|
||||||
YACC = @YACC@
|
YACC = @YACC@
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
YFLAGS = -d
|
LDFLAGS = @LDFLAGS@
|
||||||
DEFS = @DEFS@
|
DEFS = @DEFS@
|
||||||
ALL_CFLAGS = -I. -I@srcdir@ -I@srcdir@/libami $(DEFS) $(CFLAGS) @X_CFLAGS@
|
ALL_CFLAGS = -Wall -I. -I@srcdir@ -I@srcdir@/libami $(DEFS) $(CFLAGS) @X_CFLAGS@
|
||||||
LIBS = @X_LIBS@ @X_PRE_LIBS@ -Llibami -lami @XT_LIB_KLUDGE@ -lXext -lXmu \
|
LIBS = @X_LIBS@ @X_PRE_LIBS@ -Llibami -lami @XT_LIB_KLUDGE@ -lXext -lXmu \
|
||||||
-lX11 @X_EXTRA_LIBS@ @LIBS@
|
-lX11 @X_EXTRA_LIBS@ @LIBS@
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
exec_prefix = @exec_prefix@
|
exec_prefix = @exec_prefix@
|
||||||
bindir = $(exec_prefix)/bin
|
bindir = @bindir@
|
||||||
libdir = $(exec_prefix)/lib
|
libdir = @libdir@
|
||||||
mandir = $(prefix)/man
|
mandir = @mandir@
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
LN_S = @LN_S@
|
LN_S = @LN_S@
|
||||||
RM = -rm -f
|
RM = -rm -f
|
||||||
@@ -22,158 +22,186 @@ LIBAMI = libami/libami.a
|
|||||||
DT_DIR = /etc/dt
|
DT_DIR = /etc/dt
|
||||||
STRIPFLAG = -s
|
STRIPFLAG = -s
|
||||||
|
|
||||||
PROGS = amiwm requestchoice executecmd ppmtoinfo
|
PROGS = amiwm requestchoice executecmd ppmtoinfo config_util
|
||||||
|
|
||||||
MODULES = $(srcdir)/Background Keyboard Launcher
|
MODULES = Background Keyboard Background_resize Background_stretch \
|
||||||
|
def_tool.info Filesystem Launcher
|
||||||
|
|
||||||
OBJS = main.o screen.o client.o frame.o icc.o \
|
OBJS = main.o screen.o client.o frame.o icc.o \
|
||||||
icon.o menu.o diskobject.o gram.o lex.o rc.o \
|
icon.o menu.o diskobject.o gram.tab.o lex.o rc.o \
|
||||||
module.o
|
module.o
|
||||||
|
|
||||||
SRCS = main.c screen.c client.c frame.c icc.c \
|
SRCS = main.c screen.c client.c frame.c icc.c \
|
||||||
icon.c menu.c diskobject.c gram.c lex.c rc.c \
|
icon.c menu.c diskobject.c gram.tab.c lex.c rc.c \
|
||||||
module.c \
|
module.c \
|
||||||
requestchoice.c executecmd.c kbdmodule.c kbdlexer.c \
|
requestchoice.c executecmd.c kbdmodule.tab.c kbdlexer.c \
|
||||||
launchermodule.c
|
config_util.c launchermodule.c
|
||||||
|
|
||||||
DISTFILES = README README.modules INSTALL LICENSE amiwm.1 \
|
DISTFILES = README.md MODULES.md INSTALL LICENSE amiwm.1 \
|
||||||
configure configure.in Makefile.in install-sh smakefile scoptions \
|
configure configure.ac Makefile.in install-sh \
|
||||||
*.[chly] system.amiwmrc def_*.info *.map \
|
*.[chly] system.amiwmrc.in def_*.info *.map \
|
||||||
Background Xresources.amiwm.in Amilogo.?m Xsession*.in Xinitrc.in \
|
Background Background_resize Background_resize_norepeat \
|
||||||
amiwm-init libami/Makefile.in libami/*.[chly]
|
Background_stretch Launcher Xresources.amiwm.in Amilogo.?m \
|
||||||
|
Xsession*.in Xinitrc.in amiwm-init libami/Makefile.in libami/*.[chly] \
|
||||||
|
|
||||||
PACKAGENAME = amiwm
|
PACKAGENAME = amiwm
|
||||||
|
|
||||||
AMIWM_HOME = $(libdir)/amiwm
|
AMIWM_HOME = $(libdir)/amiwm
|
||||||
|
AMIWM_MODULES = $(libdir)/amiwm/modules
|
||||||
|
|
||||||
all : lib_all
|
all: lib_all
|
||||||
@$(MAKE) local_all
|
@$(MAKE) local_all
|
||||||
|
|
||||||
local_all : $(PROGS) $(MODULES)
|
local_all: $(PROGS) $(MODULES)
|
||||||
|
|
||||||
lib_all :
|
lib_all:
|
||||||
@( cd libami; $(MAKE) all )
|
@( cd libami; $(MAKE) all )
|
||||||
|
|
||||||
|
lib_clean:
|
||||||
|
@( cd libami; $(MAKE) clean )
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
|
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
|
||||||
|
|
||||||
menu.o : menu.c
|
menu.o: menu.c
|
||||||
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
|
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
|
||||||
|
|
||||||
rc.o : rc.c
|
rc.o: rc.c gram.tab.h
|
||||||
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
|
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
|
||||||
|
|
||||||
diskobject.o : diskobject.c
|
diskobject.o: diskobject.c
|
||||||
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
|
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
|
||||||
|
|
||||||
filesystem.o : joke_fs.c
|
filesystem.o: joke_fs.c
|
||||||
$(CC) -o $@ -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
|
$(CC) -o $@ -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" joke_fs.c
|
||||||
|
|
||||||
ppmtoinfo.o : ppmtoinfo.c
|
ppmtoinfo.o: ppmtoinfo.c
|
||||||
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
|
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
|
||||||
|
|
||||||
gram.h gram.c: gram.y
|
gram.tab.c gram.tab.h: gram.y
|
||||||
$(YACC) $(YFLAGS) $<
|
$(YACC) -b gram -d gram.y
|
||||||
mv y.tab.c gram.c
|
|
||||||
mv y.tab.h gram.h
|
|
||||||
|
|
||||||
lex.c : lex.l
|
kbdmodule.tab.c kbdmodule.tab.h: kbdmodule.y
|
||||||
|
$(YACC) -b kbdmodule -d kbdmodule.y
|
||||||
|
|
||||||
|
lex.c: lex.l
|
||||||
$(LEX) -t $< > lex.c
|
$(LEX) -t $< > lex.c
|
||||||
|
|
||||||
kbdmodule.h kbdmodule.c: kbdmodule.y
|
kbdlexer.c: kbdlexer.l
|
||||||
$(YACC) $(YFLAGS) $<
|
|
||||||
mv y.tab.c kbdmodule.c
|
|
||||||
mv y.tab.h kbdmodule.h
|
|
||||||
|
|
||||||
kbdlexer.c : kbdlexer.l
|
|
||||||
$(LEX) -t $< > kbdlexer.c
|
$(LEX) -t $< > kbdlexer.c
|
||||||
|
|
||||||
install : $(PROGS) $(MODULES) Xsession Xsession2 Xinitrc amiwm-init
|
lex.o: gram.tab.h
|
||||||
-mkdir -p $(AMIWM_HOME)
|
kbdlexer.o: kbdmodule.tab.h
|
||||||
$(INSTALL) $(STRIPFLAG) requestchoice $(AMIWM_HOME)/requestchoice
|
|
||||||
$(INSTALL) $(STRIPFLAG) executecmd $(AMIWM_HOME)/executecmd
|
install: $(PROGS) $(MODULES) system.amiwmrc Xsession Xsession2 Xinitrc amiwm-init
|
||||||
|
-mkdir -p $(DESTDIR)$(AMIWM_HOME)
|
||||||
|
-mkdir -p $(DESTDIR)$(AMIWM_MODULES)
|
||||||
|
$(INSTALL) $(STRIPFLAG) requestchoice $(DESTDIR)$(AMIWM_HOME)/requestchoice
|
||||||
|
$(INSTALL) $(STRIPFLAG) config_util $(DESTDIR)$(AMIWM_HOME)/config_util
|
||||||
|
$(INSTALL) $(STRIPFLAG) executecmd $(DESTDIR)$(AMIWM_HOME)/executecmd
|
||||||
for module in $(MODULES); do \
|
for module in $(MODULES); do \
|
||||||
if [ "$$module" = "$(srcdir)/Background" ]; then \
|
if [ "$$module" = "Background" ]; then \
|
||||||
$(INSTALL) $$module $(AMIWM_HOME)/Background; \
|
$(INSTALL) $$module $(DESTDIR)$(AMIWM_MODULES)/Background; \
|
||||||
else \
|
else \
|
||||||
$(INSTALL) $(STRIPFLAG) $$module $(AMIWM_HOME)/$$module; \
|
if [ "$$module" = "Background_resize" ]; then \
|
||||||
|
$(INSTALL) $$module $(DESTDIR)$(AMIWM_MODULES)/Background_resize; \
|
||||||
|
else \
|
||||||
|
if [ "$$module" = "Background_stretch" ]; then \
|
||||||
|
$(INSTALL) $$module $(DESTDIR)$(AMIWM_MODULES)/Background_stretch; \
|
||||||
|
else \
|
||||||
|
if [ "$$module" = "def_tool.info" ]; then \
|
||||||
|
$(INSTALL) $$module $(DESTDIR)$(AMIWM_MODULES)/def_tool.info; \
|
||||||
|
else \
|
||||||
|
$(INSTALL) $(STRIPFLAG) $$module $(DESTDIR)$(AMIWM_MODULES)/$$module; \
|
||||||
|
fi; \
|
||||||
|
fi; \
|
||||||
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
$(INSTALL) -m 644 $(srcdir)/system.amiwmrc $(AMIWM_HOME)/system.amiwmrc
|
$(INSTALL) -m 644 system.amiwmrc $(DESTDIR)$(AMIWM_HOME)/system.amiwmrc
|
||||||
$(INSTALL) -m 644 $(srcdir)/def_tool.info $(AMIWM_HOME)/def_tool.info
|
$(INSTALL) -m 644 $(srcdir)/def_disk.info $(DESTDIR)$(AMIWM_HOME)/def_tool.info
|
||||||
$(INSTALL) -m 644 $(srcdir)/system.map $(AMIWM_HOME)/system.map
|
$(INSTALL) -m 644 $(srcdir)/def_drawer.info $(DESTDIR)$(AMIWM_HOME)/def_drawer.info
|
||||||
$(INSTALL) -m 644 $(srcdir)/magicwb.map $(AMIWM_HOME)/magicwb.map
|
$(INSTALL) -m 644 $(srcdir)/def_project.info $(DESTDIR)$(AMIWM_HOME)/def_project.info
|
||||||
$(INSTALL) -m 644 $(srcdir)/schwartz.map $(AMIWM_HOME)/schwartz.map
|
$(INSTALL) -m 644 $(srcdir)/def_tool.info $(DESTDIR)$(AMIWM_HOME)/def_tool.info
|
||||||
$(INSTALL) -m 755 Xsession $(AMIWM_HOME)/Xsession
|
$(INSTALL) -m 644 $(srcdir)/system.map $(DESTDIR)$(AMIWM_HOME)/system.map
|
||||||
$(INSTALL) -m 755 Xsession2 $(AMIWM_HOME)/Xsession2
|
$(INSTALL) -m 644 $(srcdir)/magicwb.map $(DESTDIR)$(AMIWM_HOME)/magicwb.map
|
||||||
$(INSTALL) -m 755 Xinitrc $(AMIWM_HOME)/Xinitrc
|
$(INSTALL) -m 644 $(srcdir)/schwartz.map $(DESTDIR)$(AMIWM_HOME)/schwartz.map
|
||||||
$(INSTALL) -m 755 $(srcdir)/amiwm-init $(AMIWM_HOME)/amiwm-init
|
$(INSTALL) -m 755 Xsession $(DESTDIR)$(AMIWM_HOME)/Xsession
|
||||||
-mkdir -p $(bindir)
|
$(INSTALL) -m 755 Xsession2 $(DESTDIR)$(AMIWM_HOME)/Xsession2
|
||||||
$(INSTALL) $(STRIPFLAG) amiwm $(bindir)/amiwm
|
$(INSTALL) -m 755 Xinitrc $(DESTDIR)$(AMIWM_HOME)/Xinitrc
|
||||||
$(INSTALL) $(STRIPFLAG) ppmtoinfo $(bindir)/ppmtoinfo
|
$(INSTALL) -m 755 $(srcdir)/amiwm-init $(DESTDIR)$(AMIWM_HOME)/amiwm-init
|
||||||
$(RM) $(bindir)/requestchoice
|
-mkdir -p $(DESTDIR)$(bindir)
|
||||||
$(LN_S) $(AMIWM_HOME)/requestchoice $(bindir)/requestchoice
|
$(INSTALL) $(STRIPFLAG) amiwm $(DESTDIR)$(bindir)/amiwm
|
||||||
-mkdir -p $(mandir)/man1
|
$(INSTALL) $(STRIPFLAG) ppmtoinfo $(DESTDIR)$(bindir)/ppmtoinfo
|
||||||
$(INSTALL) -m 644 $(srcdir)/amiwm.1 $(mandir)/man1/amiwm.1
|
$(RM) $(DESTDIR)$(bindir)/requestchoice
|
||||||
|
$(LN_S) $(AMIWM_HOME)/requestchoice $(DESTDIR)$(bindir)/requestchoice
|
||||||
|
-mkdir -p $(DESTDIR)$(mandir)/man1
|
||||||
|
$(INSTALL) -m 644 $(srcdir)/amiwm.1 $(DESTDIR)$(mandir)/man1/amiwm.1
|
||||||
|
|
||||||
fs-install : Filesystem
|
fs-install: Filesystem
|
||||||
$(INSTALL) $(STRIPFLAG) Filesystem $(AMIWM_HOME)/Filesystem
|
$(INSTALL) $(STRIPFLAG) Filesystem $(DESTDIR)$(AMIWM_HOME)/Filesystem
|
||||||
$(INSTALL) -m 644 def_disk.info $(AMIWM_HOME)/def_disk.info
|
$(INSTALL) -m 644 def_disk.info $(DESTDIR)$(AMIWM_HOME)/def_disk.info
|
||||||
$(INSTALL) -m 644 def_drawer.info $(AMIWM_HOME)/def_disk.info
|
$(INSTALL) -m 644 def_drawer.info $(DESTDIR)$(AMIWM_HOME)/def_disk.info
|
||||||
|
|
||||||
cde-install : Xresources.amiwm Amilogo.bm Amilogo.pm
|
cde-install: Xresources.amiwm Amilogo.bm Amilogo.pm
|
||||||
-mkdir -p $(DT_DIR)/config/C/Xresources.d
|
-mkdir -p $(DESTDIR)$(DT_DIR)/config/C/Xresources.d
|
||||||
$(INSTALL) -m 644 Xresources.amiwm $(DT_DIR)/config/C/Xresources.d/Xresources.amiwm
|
$(INSTALL) -m 644 Xresources.amiwm $(DESTDIR)$(DT_DIR)/config/C/Xresources.d/Xresources.amiwm
|
||||||
-mkdir -p $(DT_DIR)/appconfig/icons/C
|
-mkdir -p $(DESTDIR)$(DT_DIR)/appconfig/icons/C
|
||||||
$(INSTALL) -m 644 Amilogo.bm $(DT_DIR)/appconfig/icons/C/Amilogo.bm
|
$(INSTALL) -m 644 Amilogo.bm $(DESTDIR)$(DT_DIR)/appconfig/icons/C/Amilogo.bm
|
||||||
$(INSTALL) -m 644 Amilogo.pm $(DT_DIR)/appconfig/icons/C/Amilogo.pm
|
$(INSTALL) -m 644 Amilogo.pm $(DESTDIR)$(DT_DIR)/appconfig/icons/C/Amilogo.pm
|
||||||
|
|
||||||
|
|
||||||
amiwm : $(OBJS) $(LIBAMI)
|
amiwm: $(OBJS) $(LIBAMI)
|
||||||
$(CC) -o amiwm $(OBJS) $(LIBS)
|
$(CC) $(LDFLAGS) -o amiwm $(OBJS) $(LIBS)
|
||||||
|
|
||||||
requestchoice : requestchoice.o $(LIBAMI)
|
requestchoice: requestchoice.o $(LIBAMI)
|
||||||
$(CC) -o requestchoice requestchoice.o $(LIBS)
|
$(CC) $(LDFLAGS) -o requestchoice requestchoice.o $(LIBS)
|
||||||
|
|
||||||
executecmd : executecmd.o $(LIBAMI)
|
config_util: config_util.o $(LIBAMI)
|
||||||
$(CC) -o executecmd executecmd.o $(LIBS)
|
$(CC) $(LDFLAGS) -o config_util config_util.o $(LIBS)
|
||||||
|
|
||||||
Filesystem : filesystem.o $(LIBAMI)
|
executecmd: executecmd.o $(LIBAMI)
|
||||||
$(CC) -o Filesystem filesystem.o $(LIBS)
|
$(CC) $(LDFLAGS) -o executecmd executecmd.o $(LIBS)
|
||||||
|
|
||||||
Keyboard : kbdmodule.o kbdlexer.o $(LIBAMI)
|
Filesystem: filesystem.o $(LIBAMI)
|
||||||
$(CC) -o Keyboard kbdmodule.o kbdlexer.o $(LIBS)
|
$(CC) $(LDFLAGS) -o Filesystem filesystem.o $(LIBS)
|
||||||
|
|
||||||
Launcher : launchermodule.o $(LIBAMI)
|
Keyboard: kbdmodule.tab.o kbdlexer.o $(LIBAMI)
|
||||||
$(CC) -o Launcher launchermodule.o $(LIBS)
|
$(CC) $(LDFLAGS) -o Keyboard kbdmodule.tab.o kbdlexer.o $(LIBS)
|
||||||
|
|
||||||
ppmtoinfo : ppmtoinfo.o
|
Battery: battery_module.o $(LIBAMI)
|
||||||
$(CC) -o ppmtoinfo ppmtoinfo.o -lm
|
$(CC) $(LDFLAGS) -o Battery battery_module.o $(LIBS)
|
||||||
|
|
||||||
localetest : localetest.o $(LIBAMI)
|
Launcher: launchermodule.o $(LIBAMI)
|
||||||
$(CC) -o localetest localetest.o $(LIBS)
|
$(CC) $(LDFLAGS) -o Launcher launchermodule.o $(LIBS)
|
||||||
|
|
||||||
clean :
|
ppmtoinfo: ppmtoinfo.o
|
||||||
$(RM) core $(PROGS) $(LIBAMI) Keyboard Launcher *.o libami/*.o
|
$(CC) $(LDFLAGS) -o ppmtoinfo ppmtoinfo.o -lm
|
||||||
$(RM) lex.yy.c lex.c y.tab.c y.tab.h gram.h gram.c
|
|
||||||
$(RM) kbdlexer.c kbdmodule.h kbdmodule.c
|
localetest: localetest.o $(LIBAMI)
|
||||||
|
$(CC) $(LDFLAGS) -o localetest localetest.o $(LIBS)
|
||||||
|
|
||||||
|
clean: lib_clean
|
||||||
|
$(RM) core $(PROGS) $(LIBAMI) Keyboard Battery Launcher *.o
|
||||||
|
$(RM) lex.yy.c lex.c gram.tab.h gram.tab.c
|
||||||
|
$(RM) kbdlexer.c kbdmodule.tab.h kbdmodule.tab.c
|
||||||
$(RM) config.log
|
$(RM) config.log
|
||||||
|
|
||||||
distclean : clean
|
distclean: clean
|
||||||
$(RM) config.status config.cache *~
|
$(RM) config.status config.cache *~
|
||||||
$(RM) Makefile libami/Makefile Xresources.amiwm Xsession Xsession2 Xinitrc
|
$(RM) Makefile libami/Makefile Xresources.amiwm Xsession Xsession2 Xinitrc
|
||||||
|
|
||||||
spotless : distclean
|
spotless: distclean
|
||||||
|
|
||||||
TAGS:
|
TAGS:
|
||||||
etags *.[ch] libami/*.[ch]
|
etags *.[ch] libami/*.[ch]
|
||||||
|
|
||||||
patch :
|
patch:
|
||||||
mv version.h old_version.h
|
mv version.h old_version.h
|
||||||
sed < old_version.h 's/l/"/' | awk '-F"' '{ printf "%s\"%sl%s\"\n",$$1,$$2,1+$$3 }' > version.h
|
sed < old_version.h 's/l/"/' | awk '-F"' '{ printf "%s\"%sl%s\"\n",$$1,$$2,1+$$3 }' > version.h
|
||||||
rm old_version.h
|
rm old_version.h
|
||||||
|
|
||||||
dist : version.h clean
|
dist: version.h clean
|
||||||
( version=`sed < version.h -e 's/^[^"]*"//' -e 's/"[^"]*$$//'`; \
|
( version=`sed < version.h -e 's/^[^"]*"//' -e 's/"[^"]*$$//'`; \
|
||||||
tarname="$(PACKAGENAME)$$version.tar"; \
|
tarname="$(PACKAGENAME)$$version.tar"; \
|
||||||
mkdir $(PACKAGENAME)$$version; \
|
mkdir $(PACKAGENAME)$$version; \
|
||||||
@@ -184,8 +212,8 @@ dist : version.h clean
|
|||||||
gzip $$tarname; \
|
gzip $$tarname; \
|
||||||
)
|
)
|
||||||
|
|
||||||
$(srcdir)/configure: $(srcdir)/configure.in
|
$(srcdir)/configure: $(srcdir)/configure.ac
|
||||||
autoconf $(srcdir)/configure.in > $(srcdir)/configure
|
autoconf $(srcdir)/configure.ac > $(srcdir)/configure
|
||||||
|
|
||||||
config.status: $(srcdir)/configure
|
config.status: $(srcdir)/configure
|
||||||
$(srcdir)/configure
|
$(srcdir)/configure
|
||||||
@@ -196,18 +224,8 @@ Makefile: $(srcdir)/Makefile.in config.status
|
|||||||
libami/Makefile: $(srcdir)/libami/Makefile.in config.status
|
libami/Makefile: $(srcdir)/libami/Makefile.in config.status
|
||||||
./config.status
|
./config.status
|
||||||
|
|
||||||
Xresources.amiwm: $(srcdir)/Xresources.amiwm.in
|
system.amiwmrc Xresources.amiwm Xsession Xsession2 Xinitrc: %: $(srcdir)/%.in config.status
|
||||||
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xresources.amiwm.in > Xresources.amiwm
|
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < "$<" > "$@"
|
||||||
|
|
||||||
Xsession: $(srcdir)/Xsession.in config.status
|
|
||||||
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xsession.in > Xsession
|
|
||||||
|
|
||||||
Xsession2: $(srcdir)/Xsession2.in config.status
|
|
||||||
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xsession2.in > Xsession2
|
|
||||||
|
|
||||||
Xinitrc: $(srcdir)/Xinitrc.in config.status
|
|
||||||
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xinitrc.in > Xinitrc
|
|
||||||
|
|
||||||
|
|
||||||
depend:: $(SRCS)
|
depend:: $(SRCS)
|
||||||
-@rm Makefile.bak
|
-@rm Makefile.bak
|
||||||
|
|||||||
174
README
174
README
@@ -1,174 +0,0 @@
|
|||||||
|
|
||||||
< amiwm > by Marcus Comstedt (marcus@mc.pp.se)
|
|
||||||
|
|
||||||
|
|
||||||
0. Legal notices
|
|
||||||
|
|
||||||
This program is distributed as FreeWare. The copyright remains with
|
|
||||||
the author. See the file LICENSE for more information.
|
|
||||||
|
|
||||||
Amiga and Workbench are registered trademarks of AMIGA International Inc.
|
|
||||||
|
|
||||||
1. Intro
|
|
||||||
|
|
||||||
This is amiwm, an X window manager that tries to make your workstation
|
|
||||||
look like an Amiga®. "Why?" you ask. Because I wanted it to. So there!
|
|
||||||
|
|
||||||
2. Compiling etc.
|
|
||||||
|
|
||||||
For instructions on building and installing, read the file INSTALL.
|
|
||||||
|
|
||||||
3. Configuration
|
|
||||||
|
|
||||||
amiwm reads the file .amiwmrc in the directory pointed to by $HOME
|
|
||||||
when starting. If this file does not exist, it reads the file
|
|
||||||
system.amiwmrc instead.
|
|
||||||
|
|
||||||
The configuration file can contain any of the following statements:
|
|
||||||
|
|
||||||
FastQuit {yes|no}
|
|
||||||
|
|
||||||
Specifies whether amiwm should quit directly when the Quit menu item
|
|
||||||
is selected, rather than popping up a requester.
|
|
||||||
(on/off or true/false can be used instead of yes/no.)
|
|
||||||
|
|
||||||
SizeBorder {right|bottom|both|none}
|
|
||||||
|
|
||||||
Specifies which border should be enlarged when a sizegadget is present.
|
|
||||||
|
|
||||||
ForceMove {manual|auto|always}
|
|
||||||
|
|
||||||
Enables you to move windows outside the perimeter of the root window
|
|
||||||
when pressing shift, when trying to drag at least 25% of the window
|
|
||||||
ofscreen, or always, respectively.
|
|
||||||
|
|
||||||
IconDir "path"
|
|
||||||
|
|
||||||
Specifies a directory in which amiwm will look for icons.
|
|
||||||
|
|
||||||
DefaultIcon "name"
|
|
||||||
|
|
||||||
Gives the filename of the .info file to use as a default icon.
|
|
||||||
It is relative to the IconDir.
|
|
||||||
|
|
||||||
IconPalette {system|magicwb|schwartz|"filename"}
|
|
||||||
|
|
||||||
Selects either the Workbench® default palette, or the MagicWorkbench
|
|
||||||
standard palette for use with icons. The third option is a 16 color
|
|
||||||
palette used on the "Eric Schwartz Productions CD Archive". Alternatively,
|
|
||||||
the filename of a PPM file representing the palette to use can be used.
|
|
||||||
|
|
||||||
ScreenFont "fontname"
|
|
||||||
|
|
||||||
Selects a font to use for windowtitles etc.
|
|
||||||
|
|
||||||
IconFont "fontname"
|
|
||||||
|
|
||||||
Selects a font for icontitles.
|
|
||||||
|
|
||||||
{detailpen|blockpen|textpen|shinepen|shadowpen|fillpen|filltextpen|
|
|
||||||
backgroundpen|highlighttextpen|bardetailpen|barblockpen|
|
|
||||||
bartrimpen} "colorname"
|
|
||||||
|
|
||||||
Modifies the colour scheme for the window manager.
|
|
||||||
|
|
||||||
CustomIconsOnly {yes|no}
|
|
||||||
|
|
||||||
This prevent applications to display their own icons when in iconified state.
|
|
||||||
Only icons defined in amiwmrc for each apps will be used.
|
|
||||||
Because apps own icon are too different from one eachother.
|
|
||||||
They comes in various sizes and themes. Some icons will be 32x32,
|
|
||||||
while some other will be a 128x128 or even bigger .. By using this option,
|
|
||||||
You have the possibility to decide which icon should be used for each app.
|
|
||||||
If no custom icons are defined at all, the def_tool.info will be used for
|
|
||||||
all iconified apps. Format is: style { class "myClass" icon "myIcon.info" }
|
|
||||||
To find out a given program's class, use "xlsclients -l" to list all opened
|
|
||||||
applications, and then use "xprop -id <0x0000000>" to list a
|
|
||||||
given app's properties. Use either WM_CLASS or WM_ICON_NAME strings in amiwmrc.
|
|
||||||
|
|
||||||
ShortLabelIcons {yes|no}
|
|
||||||
|
|
||||||
This limit the length of the text for iconified programs. For example, if this
|
|
||||||
option is activated, an iconified program text will be limited to 8 chars + ".."
|
|
||||||
Use this option if you don't want iconified program text to be loong strings..
|
|
||||||
|
|
||||||
TitleBarClock {yes|no}
|
|
||||||
|
|
||||||
Enables a clock in the titlebar. It displays the date and time.
|
|
||||||
|
|
||||||
TitleClockFormat [<number>] "time string"
|
|
||||||
|
|
||||||
This lets you choose a new format to display the Title Bar Clock.
|
|
||||||
The time string is formatted with the standard strftime() parameters.
|
|
||||||
The default is "%c". It has been found that "%a %b %e %Y %l:%M %p" works
|
|
||||||
well too. Number is the update interval in seconds.
|
|
||||||
|
|
||||||
ToolItem "name" "command" ["hotkey"]
|
|
||||||
|
|
||||||
Adds an item in the Tools menu with the specified name, which executes
|
|
||||||
the command when selected. A string containing a single uppercase letter
|
|
||||||
may be specified as the third argument, making this letter a hotkey for the
|
|
||||||
item.
|
|
||||||
|
|
||||||
ToolItem Separator
|
|
||||||
|
|
||||||
Inserts a separator bar in the Tools menu.
|
|
||||||
|
|
||||||
ToolItem "name" { <tool item commands> }
|
|
||||||
|
|
||||||
Create ToolItem:s in a submenu with the specified name. It is not legal
|
|
||||||
to create a submenu inside another submenu.
|
|
||||||
|
|
||||||
Screen [<number>] "name"
|
|
||||||
|
|
||||||
Create a new screen with the specified name. It will be placed below all
|
|
||||||
earlier created screens. To move a window between two screens, iconify it
|
|
||||||
and drag the icon over to the other screen. If the second argument is given,
|
|
||||||
this screen is placed on the corresponding X screen.
|
|
||||||
|
|
||||||
ModulePath "path(:path...)"
|
|
||||||
|
|
||||||
Sets one or more directories where amiwm will look for module binaries.
|
|
||||||
The default is AMIWM_HOME. Note that the module binaries cannot be
|
|
||||||
shared amongst different architectures.
|
|
||||||
|
|
||||||
Module "name" ["initstring"]
|
|
||||||
|
|
||||||
Start a module with the specified name. If initstring is specified, it
|
|
||||||
is sent to the module. There are currently two modules shipped with
|
|
||||||
amiwm; Background and Keyboard. These are documented in the file
|
|
||||||
README.modules. If a module is limited to a single screen, like the
|
|
||||||
Background module, the screen that was created last is used.
|
|
||||||
|
|
||||||
InterScreenGap number
|
|
||||||
|
|
||||||
Sets the size in number of pixels of the "video DMA off" area that appears
|
|
||||||
between screens when they are dragged.
|
|
||||||
|
|
||||||
AutoRaise {yes|no}
|
|
||||||
|
|
||||||
Selects wheteher windows will automatically be moved to the front when
|
|
||||||
they are activated.
|
|
||||||
|
|
||||||
Focus {followmouse|sloppy|clicktotype}
|
|
||||||
|
|
||||||
Sets the policy by which windows are given focus. Followmouse is the
|
|
||||||
default and means that the window that contains the mouse pointer will
|
|
||||||
have focus. Sloppy means that the window that had focus last will keep
|
|
||||||
it when the pointer is not over a window. ClickToType is the original AmigaOS
|
|
||||||
policy in which you have to explicitly give focus to windows by clicking
|
|
||||||
in them.
|
|
||||||
|
|
||||||
|
|
||||||
4. Troubleshooting
|
|
||||||
|
|
||||||
The most likely reason for the windowmanager to crash is if it
|
|
||||||
can't find its default icon, or if this is not accepted as an
|
|
||||||
.info file. If this happens, amiwm _will_ dump core. So make
|
|
||||||
sure that either 'make install' runs successfully (in which case
|
|
||||||
amiwm will know where its icon is), or that the file .amiwmrc
|
|
||||||
contains a correct specification of the icon's location.
|
|
||||||
|
|
||||||
Don't mail me bug reports just because amiwm prints "Bad Window" on
|
|
||||||
stderr once in a while. Redirect it to /dev/null or live with it. :)
|
|
||||||
|
|
||||||
62
README.md
62
README.md
@@ -1,2 +1,62 @@
|
|||||||
# amiwm
|
# amiwm
|
||||||
Amiga Workbench-like Window Manager for Xorg
|
Amiga Workbench inspired window manager for Xorg.
|
||||||
|
|
||||||
|
## Upstream repository
|
||||||
|
|
||||||
|
The current upstream repository for this particular fork is at
|
||||||
|
[https://github.com/amiwm/amiwm](https://github.com/amiwm/amiwm).
|
||||||
|
Please file tickets, pull requests, etc there.
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
Before compiling, make sure that you have following packages installed:
|
||||||
|
|
||||||
|
```
|
||||||
|
gcc make autoconf xorg xorg-xinit xorg-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
First, run configuration script:
|
||||||
|
|
||||||
|
```
|
||||||
|
./configure
|
||||||
|
```
|
||||||
|
|
||||||
|
After that, you can either edit the Makefile, or leave it as is. After that, compile and install amiwm using
|
||||||
|
|
||||||
|
```
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
```
|
||||||
|
|
||||||
|
Hopefully, your compilation was succesfull - now you should have amiwm installed!
|
||||||
|
|
||||||
|
## Launching amiwm
|
||||||
|
To launch amiwm, use
|
||||||
|
|
||||||
|
```
|
||||||
|
startx amiwm
|
||||||
|
```
|
||||||
|
|
||||||
|
Or add "amiwm" to your xinitrc file
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
Configuration utility is not yet available; To configure amiwm, you'll need
|
||||||
|
to create and edit .amiwmrc file in your home directory. To do so, read
|
||||||
|
amiwm's manpage.
|
||||||
|
|
||||||
|
## Authors
|
||||||
|
Originally created by **Marcus Comstedt**;
|
||||||
|
Contributions by
|
||||||
|
* Scott Lawrence
|
||||||
|
* Nicolas Sipieter
|
||||||
|
* redsPL.
|
||||||
|
|
||||||
|
## Previous repositories
|
||||||
|
|
||||||
|
Previously, amiwm was using bzr instead of git; The bzr repository can be found [here](http://mc.pp.se/bzr/amiwm/)
|
||||||
|
|
||||||
|
This repository started as a fork from [https://github.com/sdomi/amiwm](https://github.com/sdomi/amiwm).
|
||||||
|
|
||||||
|
## License
|
||||||
|
This project is published under a custom license - see [LICENSE.md](LICENSE.md) for details.
|
||||||
|
|
||||||
|
Amiga, AmigaOS and Workbench are registered trademarks of AMIGA International Inc.
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
|
|
||||||
Background module
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
To get background images on your screens, use the Background module.
|
|
||||||
The Module command should come after the Screen command, and the
|
|
||||||
initstring should be the filename of the picture(*). Example:
|
|
||||||
|
|
||||||
Screen "My Screen"
|
|
||||||
Module "Background" "~/pliki/im"
|
|
||||||
|
|
||||||
The Background module is really a shell script that requires that the
|
|
||||||
program 'display' from imagemagick package. Currently, it doesn't
|
|
||||||
support any standard imagemagick parameters.
|
|
||||||
|
|
||||||
Keyboard module
|
|
||||||
---------------
|
|
||||||
|
|
||||||
With the Keyboard module, you can bind window manager functions to keys
|
|
||||||
on the keyboard. The initstring should consist of keybindings on the
|
|
||||||
form
|
|
||||||
|
|
||||||
modifiers<keysym>:where:func
|
|
||||||
|
|
||||||
modifiers
|
|
||||||
=========
|
|
||||||
|
|
||||||
Modifiers is 0 or more of:
|
|
||||||
Shift Control Meta Lock
|
|
||||||
Mod1 Mod2 Mod3 Mod4 Mod5
|
|
||||||
Button1 Button2 Button3 Button4 Button5
|
|
||||||
|
|
||||||
The modifiers listed must be pressed together with the key to activate
|
|
||||||
the binding.
|
|
||||||
|
|
||||||
keysym
|
|
||||||
======
|
|
||||||
|
|
||||||
Keysym is a standard X keysym name, like F1 or Prior.
|
|
||||||
|
|
||||||
where
|
|
||||||
=====
|
|
||||||
|
|
||||||
where is either "all", or one or more of window, frame, icon, root
|
|
||||||
separated with '|' (bar). This controls in what areas of the screen
|
|
||||||
that the key will be active.
|
|
||||||
|
|
||||||
func
|
|
||||||
====
|
|
||||||
|
|
||||||
The function to perform when the key is pressed.
|
|
||||||
Currently the following are defined:
|
|
||||||
|
|
||||||
rotatescreens - Move the frontmost screen to the back
|
|
||||||
front - Move the window in which the key is pressed to the front
|
|
||||||
back - Move the window in which the key is pressed to the back
|
|
||||||
iconify - Iconify the window in which the key is pressed
|
|
||||||
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
Module "Keyboard" "\
|
|
||||||
Meta<F1>:window|frame:front\
|
|
||||||
Meta<F2>:window|frame:iconify\
|
|
||||||
Meta<F3>:window|frame:back"
|
|
||||||
|
|
||||||
This binds the keys Meta-F1, Meta-F2 and Meta-F3 to front, back and
|
|
||||||
iconify respectively. The will only have effect inside windows and in
|
|
||||||
window frames. (These are the only places that front/iconfy/back has
|
|
||||||
effect anyway.)
|
|
||||||
18
Xinitrc
18
Xinitrc
@@ -1,18 +0,0 @@
|
|||||||
#!/bin/ksh
|
|
||||||
# AmiWM startup script
|
|
||||||
|
|
||||||
xrdb $OPENWINHOME/lib/Xdefaults # Load Default X11 resource database
|
|
||||||
if [ -f $HOME/.Xdefaults ]; then
|
|
||||||
xrdb -merge $HOME/.Xdefaults # Load Users X11 resource database
|
|
||||||
fi
|
|
||||||
|
|
||||||
xsetroot -solid black
|
|
||||||
/usr/local/bin/amiwm & wmpid=$!
|
|
||||||
|
|
||||||
if [ -x $HOME/.amiwm-init ]; then
|
|
||||||
$HOME/.amiwm-init # Custom amiwm tools
|
|
||||||
else
|
|
||||||
/usr/local/lib/amiwm/amiwm-init # Default amiwm tools
|
|
||||||
fi
|
|
||||||
|
|
||||||
wait $wmpid # Wait for wm (key client) to exit
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/ksh
|
#!/bin/sh
|
||||||
# AmiWM startup script
|
# AmiWM startup script
|
||||||
|
|
||||||
xrdb $OPENWINHOME/lib/Xdefaults # Load Default X11 resource database
|
xrdb $OPENWINHOME/lib/Xdefaults # Load Default X11 resource database
|
||||||
|
|||||||
26
Xsession
26
Xsession
@@ -1,26 +0,0 @@
|
|||||||
#!/bin/ksh
|
|
||||||
|
|
||||||
if [ -z "$SESSIONTYPE" ]
|
|
||||||
then
|
|
||||||
export SESSIONTYPE="altDt"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$DTSTARTIMS" ]
|
|
||||||
then
|
|
||||||
export DTSTARTIMS="False"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$SDT_ALT_SESSION" ]
|
|
||||||
then
|
|
||||||
export SDT_ALT_SESSION="/usr/local/lib/amiwm/Xsession2"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$SDT_ALT_HELLO" ]
|
|
||||||
then
|
|
||||||
export SDT_ALT_HELLO="/usr/dt/bin/dthello -string 'Starting the AmiWM Desktop' &"
|
|
||||||
fi
|
|
||||||
|
|
||||||
export SDT_NO_DSDM=""
|
|
||||||
|
|
||||||
|
|
||||||
/usr/dt/bin/Xsession
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/ksh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ -z "$SESSIONTYPE" ]
|
if [ -z "$SESSIONTYPE" ]
|
||||||
then
|
then
|
||||||
|
|||||||
34
Xsession2
34
Xsession2
@@ -1,34 +0,0 @@
|
|||||||
#!/bin/ksh
|
|
||||||
|
|
||||||
unset SDT_ALT_SESSION
|
|
||||||
unset SDT_ALT_HELLO
|
|
||||||
unset SDT_NO_DSDM
|
|
||||||
|
|
||||||
#
|
|
||||||
# Find "xinitrc" file by standard precedence rules and start
|
|
||||||
# the user's AmiWM Desktop.
|
|
||||||
#
|
|
||||||
|
|
||||||
DEFAULT_XINITRC="/usr/local/lib/amiwm/Xinitrc"
|
|
||||||
HOME_XINITRC="$HOME/.xinitrc"
|
|
||||||
|
|
||||||
if [ -z "$XINITRC" ]; then
|
|
||||||
if [ -f $HOME_XINITRC ]; then
|
|
||||||
XINITRC=$HOME_XINITRC
|
|
||||||
else
|
|
||||||
XINITRC=$DEFAULT_XINITRC
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "AmiWM Desktop Login"
|
|
||||||
|
|
||||||
if [ -f $XINITRC ]; then
|
|
||||||
echo "using xinitrc file: $XINITRC"
|
|
||||||
/bin/ksh $XINITRC
|
|
||||||
else
|
|
||||||
echo "xinitrc file: $XINITRC not found"
|
|
||||||
if [ -f $DEFAULT_XINITRC ]; then
|
|
||||||
echo "using xinitrc: $DEFAULT_XINITRC"
|
|
||||||
/bin/ksh $DEFAULT_XINITRC
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/ksh
|
#!/bin/sh
|
||||||
|
|
||||||
unset SDT_ALT_SESSION
|
unset SDT_ALT_SESSION
|
||||||
unset SDT_ALT_HELLO
|
unset SDT_ALT_HELLO
|
||||||
@@ -24,11 +24,11 @@ HOME_XINITRC="$HOME/.xinitrc"
|
|||||||
|
|
||||||
if [ -f $XINITRC ]; then
|
if [ -f $XINITRC ]; then
|
||||||
echo "using xinitrc file: $XINITRC"
|
echo "using xinitrc file: $XINITRC"
|
||||||
/bin/ksh $XINITRC
|
/bin/sh $XINITRC
|
||||||
else
|
else
|
||||||
echo "xinitrc file: $XINITRC not found"
|
echo "xinitrc file: $XINITRC not found"
|
||||||
if [ -f $DEFAULT_XINITRC ]; then
|
if [ -f $DEFAULT_XINITRC ]; then
|
||||||
echo "using xinitrc: $DEFAULT_XINITRC"
|
echo "using xinitrc: $DEFAULT_XINITRC"
|
||||||
/bin/ksh $DEFAULT_XINITRC
|
/bin/sh $DEFAULT_XINITRC
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
3
amiwm-init
Executable file
3
amiwm-init
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
xterm -sb -sl 1000 -C -geometry 80x16+0-0 -name Console &
|
||||||
801
amiwm.1
801
amiwm.1
@@ -1,187 +1,632 @@
|
|||||||
.\" @(#)amiwm.1
|
.Dd January 15, 2026
|
||||||
'\"macro stdmacro
|
.Dt AMIWM 1
|
||||||
.nr X
|
.Os
|
||||||
.TH amiwm 1 "26 Mar 2017"
|
.
|
||||||
.SH NAME
|
.Sh NAME
|
||||||
amiwm \- Amiga Workbench-like X Window Manager
|
.Nm amiwm
|
||||||
|
.Nd Amiga Workbench-like X Window Manager
|
||||||
.SH SYNOPSIS
|
.
|
||||||
amiwm
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
.SH DESCRIPTION
|
.
|
||||||
.I amiwm
|
.Sh DESCRIPTION
|
||||||
is an X Window manager that tries to make your workstation look like
|
.Nm
|
||||||
an Amiga\*R.
|
is an X Window manager that tries to make your workstation look like an Amiga\*R.
|
||||||
|
.
|
||||||
.SH OPTIONS
|
.Pp
|
||||||
.I Amiwm
|
Windows are controlled with the pointer as follows:
|
||||||
is configurable with a $HOME/\.amiwmrc-file containing some or all
|
.Bl -column "Maximize button" "Double-click" XXXX
|
||||||
of the following options:
|
.It Sy Target Ta Sy Operation Ta Sy Description
|
||||||
.SH FastQuit: {yes|no}
|
.It Anywhere Ta Left-click Ta If the
|
||||||
|
.Ic Focus
|
||||||
Specifies whether amiwm should quit directly when the Quit
|
police is
|
||||||
|
.Cm clicktotype ,
|
||||||
|
focus window.
|
||||||
|
If the
|
||||||
|
.Ic AutoRaise
|
||||||
|
option is on, raise it as well.
|
||||||
|
.It Anywhere Ta Hover Ta If the
|
||||||
|
.Ic Focus
|
||||||
|
police is either
|
||||||
|
.Cm followmouse
|
||||||
|
or
|
||||||
|
.Cm sloppy ,
|
||||||
|
focus window.
|
||||||
|
If the
|
||||||
|
.Ic AutoRaise
|
||||||
|
option is on, raise it as well.
|
||||||
|
.It Titlebar Ta Left-drag Ta Move window.
|
||||||
|
.It Titlebar Ta Double-click Ta Raise window.
|
||||||
|
.It Close button Ta Left-click Ta Close application.
|
||||||
|
.It Iconify button Ta Left-click Ta Iconify window.
|
||||||
|
.It Maximize button Ta Left-click Ta Maximize window.
|
||||||
|
.It Raise button Ta Left-click Ta Raise window.
|
||||||
|
.It Resize handle Ta Left-click Ta Resize window.
|
||||||
|
.El
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
.Nm
|
||||||
|
can minimize windows into icons that are gathered on a screen.
|
||||||
|
Icons controlled with the pointer as follows:
|
||||||
|
.Bl -column "Icon" "Double-click" XXXX
|
||||||
|
.It Sy Target Ta Sy Operation Ta Sy Description
|
||||||
|
.It Icon Ta Double-click Ta De-iconify window.
|
||||||
|
.It Icon Ta Left-drag Ta Move icon around the screen
|
||||||
|
or into another screen.
|
||||||
|
(The only way to move a window into another screen is by iconifying it,
|
||||||
|
moving the icon,
|
||||||
|
and then de-iconifying it.)
|
||||||
|
.El
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
.Nm
|
||||||
|
can keep several workbench screens (or just "screens" for short)
|
||||||
|
where windows are displayed.
|
||||||
|
Each screen has a titlebar above it displaying its name, and a few widgets.
|
||||||
|
Screens are controlled with the pointer as follows:
|
||||||
|
.Bl -column "Raise button" "Right-release" XXXX
|
||||||
|
.It Sy Target Ta Sy Operation Ta Sy Description
|
||||||
|
.It Titlebar Ta Left-drag Ta Move screen up/down
|
||||||
|
to reveal/hide other screens.
|
||||||
|
.It Titlebar Ta Right-press Ta Reveal the menus.
|
||||||
|
.It Menu Ta Right-drag Ta Navigate through menus.
|
||||||
|
.It Menu entry Ta Right-release Ta Activate menu entry.
|
||||||
|
.It Icon Ta Double-click Ta Launch program
|
||||||
|
(see
|
||||||
|
.Sx Launcher module
|
||||||
|
below).
|
||||||
|
.It Raise button Ta Left-click Ta Raise screen.
|
||||||
|
.El
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
Configuration utility is not yet available.
|
||||||
|
To configure amiwm, create and edit
|
||||||
|
.Pa .amiwmrc
|
||||||
|
file in your home directory.
|
||||||
|
The configuration file is described at the
|
||||||
|
.Sx CONFIGURATION
|
||||||
|
section below.
|
||||||
|
.
|
||||||
|
.Sh CONFIGURATION
|
||||||
|
.Pa "~/.amiwmrc"
|
||||||
|
is the configuration file for
|
||||||
|
.Nm .
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
Empty lines and lines beginning with
|
||||||
|
.Sq #
|
||||||
|
are ignored.
|
||||||
|
Each other line is a configuration option and its arguments.
|
||||||
|
The options are as follows:
|
||||||
|
.Bl -column highlighttextpen def_tool.info XXXXXX
|
||||||
|
.It Option Ta Default Ta Arguments
|
||||||
|
.It Ic AutoRaise Ta Cm off Ta Ar boolean
|
||||||
|
.It Ic BatteryInfo Ta Cm off Ta Ar boolean
|
||||||
|
.It Ic CustomIconsOnly Ta Cm off Ta Ar boolean
|
||||||
|
.It Ic DefaultIcon Ta Cm def_tool.info Ta Qq Ar filename
|
||||||
|
.It Ic FastQuit Ta Cm off Ta Ar boolean
|
||||||
|
.It Ic Focus Ta Cm followmouse Ta Cm followmouse Ns | Ns Cm sloppy Ns | Ns Cm clicktotype
|
||||||
|
.It Ic ForceMove Ta Cm manual Ta Cm manual Ns | Ns Cm auto Ns | Ns Cm always
|
||||||
|
.It Ic IconDir Ta "" Ta Qq Ar path
|
||||||
|
.It Ic IconFont Ta "" Ta Qq Ar fontname
|
||||||
|
.It Ic IconPalette Ta Cm system Ta Cm system Ns | Ns Cm magicwb Ns | Ns Cm schwartz Ns | Ns Ar filename
|
||||||
|
.It Ic InterScreenGap Ta 0 Ta Ar number
|
||||||
|
.It Ic Module Ta "" Ta Qo Ar name Qc Op Qq initstring
|
||||||
|
.It Ic ModulePath Ta "" Ta Qq Ar path Ns Op Cm :\& Ns Ar path ...
|
||||||
|
.It Ic OpaqueMove Ta False Ta Ar boolean
|
||||||
|
.It Ic OpaqueResize Ta False Ta Ar boolean
|
||||||
|
.It Ic Screen Ta "" Ta Oo Ar number Oc Ar screenname
|
||||||
|
.It Ic ScreenFont Ta "" Ta Qq Ar fontname
|
||||||
|
.It Ic ShortLabelIcons Ta Cm off Ta Ar boolean
|
||||||
|
.It Ic SizeBorder Ta Cm right Ta Cm right Ns | Ns Cm bottom Ns | Ns Cm both Ns | Ns Cm none
|
||||||
|
.It Ic TitleBarClock Ta Cm ... Ta Qq Ar boolean
|
||||||
|
.It Ic TitleClockFormat Ta Qq "%c" Ta Oo Ar number Oc Ar timeformat
|
||||||
|
.It Ic ToolItem Ta "" Ta Qo Ar name Qc Cm { Ar ToolItem Ns s ... Cm }
|
||||||
|
.It Ic ToolItem Ta "" Ta Qo Ar name Qc Qo Ar command Qc Qo Ar hotkey Qc
|
||||||
|
.It Ic ToolItem Ta "" Ta Ic Separator
|
||||||
|
.It Ic backgroundpen Ta Cm ... Ta Qq Ar colorname
|
||||||
|
.It Ic barblockpen Ta Cm ... Ta Qq Ar colorname
|
||||||
|
.It Ic bardetailpen Ta Cm ... Ta Qq Ar colorname
|
||||||
|
.It Ic bartrimpen Ta Cm ... Ta Qq Ar colorname
|
||||||
|
.It Ic blockpen Ta Cm ... Ta Qq Ar colorname
|
||||||
|
.It Ic detailpen Ta Cm ... Ta Qq Ar colorname
|
||||||
|
.It Ic fillpen Ta Cm ... Ta Qq Ar colorname
|
||||||
|
.It Ic filltextpen Ta Cm ... Ta Qq Ar colorname
|
||||||
|
.It Ic highlighttextpen Ta Cm ... Ta Qq Ar colorname
|
||||||
|
.It Ic shadowpen Ta Cm ... Ta Qq Ar colorname
|
||||||
|
.It Ic shinepen Ta Cm ... Ta Qq Ar colorname
|
||||||
|
.It Ic style Ta "" Ta Cm "{" Cm class Qo Ar classname Qc Cm icon Qo Ar filename Qc Cm "}"
|
||||||
|
.It Ic textpen Ta Cm ... Ta Qq Ar colorname
|
||||||
|
.El
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
Some options, like
|
||||||
|
.Ic ToolItem ,
|
||||||
|
have different syntaxes,
|
||||||
|
each with different sets of arguments.
|
||||||
|
Some options, like one of the forms of
|
||||||
|
.Ic ToolItem ,
|
||||||
|
expect as argument a block of options, one per line, around curly braces.
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
For the arguments,
|
||||||
|
.Ar boolean
|
||||||
|
can be
|
||||||
|
.Cm on Ns | Ns Cm off
|
||||||
|
or
|
||||||
|
.Cm true Ns | Ns Cm false
|
||||||
|
or
|
||||||
|
.Cm yes Ns | Ns Cm no .
|
||||||
|
.
|
||||||
|
.Ss General options
|
||||||
|
.Bl -tag -width Ds
|
||||||
|
.It Ic AutoRaise Ar bool
|
||||||
|
Selects whether windows will automatically be moved to the front when they are activated.
|
||||||
|
.
|
||||||
|
.It Ic FastQuit Ar boolean
|
||||||
|
Specifies whether amiwm should quit directly when the
|
||||||
|
.Em Quit
|
||||||
menu item is selected, rather than popping up a requester.
|
menu item is selected, rather than popping up a requester.
|
||||||
(on/off or true/false can be used instead of yes/no.)
|
.
|
||||||
|
.It Ic Focus Cm followmouse Ns | Ns Cm sloppy Ns | Ns Cm clicktotype
|
||||||
.SH SizeBorder {right|bottom|both|none}
|
Sets the policy by which windows are given focus:
|
||||||
|
.Bl -tag -width followmouse
|
||||||
Specifies which border should be enlarged when a sizegadget is present.
|
.It Cm followmouse
|
||||||
|
The window that contains the mouse pointer will have focus.
|
||||||
.SH ForceMove {manual|auto|always}
|
This is the default.
|
||||||
|
.It Cm sloppy
|
||||||
Enables you to move windows outside the perimeter of the root window
|
The window that had focus last will keep it when the pointer is not over a window.
|
||||||
when pressing shift, when trying to drag at least 25% of the window
|
.It Cm clicktotype
|
||||||
ofscreen, or always, respectively.
|
You have to explicitly give focus to windows by clicking in them.
|
||||||
|
This is the original AmigaOS policy.
|
||||||
.SH IconDir path
|
.El
|
||||||
|
.
|
||||||
Specifies a directory in which amiwm will look for icons.
|
.It Ic ForceMove Cm manual Ns | Ns Cm auto Ns | Ns Cm always
|
||||||
|
Allows you to move windows outside the perimeter of the root window when pressing shift,
|
||||||
.SH DefaultIcon name
|
when trying to drag at least 25% of the window ofscreen,
|
||||||
|
or always, respectively.
|
||||||
Gives the filename of the .info file to use as a default icon.
|
.
|
||||||
It is relative to the IconDir.
|
.It Ic OpaqueMove Ar bool
|
||||||
|
Whether moving a window by dragging its titlebar should move the window in real time;
|
||||||
.SH IconPalette {system|magicwb|schwartz|\f1\*(lq\f3filename"}
|
or just move a frame indicating where the window will be after releasing the mouse button.
|
||||||
|
.
|
||||||
Selects either the Workbench\*R default palette, or the MagicWorkbench
|
.It Ic OpaqueResize Ar bool
|
||||||
standard palette for use with icons. The third option is a 16 color
|
Whether resizing a window by dragging its resize handle should resize the window in real time;
|
||||||
palette used on the "Eric Schwartz Productions CD Archive". Alternatively,
|
or just resize a frame indicating the window's final size after releasing the mouse button.
|
||||||
the filename of a PPM file representing the palette to use can be used.
|
.El
|
||||||
|
.
|
||||||
.SH ScreenFont \f1\*(lq\f3fontname"
|
.Ss Windows decorations
|
||||||
|
.Bl -tag -width Ds
|
||||||
|
.It Ic ScreenFont Qq Ar fontname
|
||||||
Selects a font to use for windowtitles etc.
|
Selects a font to use for windowtitles etc.
|
||||||
|
.
|
||||||
.SH IconFont \f1\*(lq\f3fontname"
|
.It Ic SizeBorder Cm right Ns | Ns Cm bottom Ns | Ns Cm both Ns | Ns Cm none
|
||||||
|
Specifies which border should be enlarged when a sizegadget is present.
|
||||||
Selects a font for icontitles.
|
.
|
||||||
|
.It Ic detailpen Qq Ar colorname
|
||||||
.SH {detailpen|blockpen|textpen|shinepen|shadowpen|fillpen|filltextpen|
|
TODO.
|
||||||
backgroundpen|highlighttextpen|bardetailpen|barblockpen|
|
.
|
||||||
bartrimpen} \f1\*(lq\f3colorname"
|
.It Ic blockpen Qq Ar colorname
|
||||||
|
TODO.
|
||||||
Modifies the colour scheme for the window manager.
|
.
|
||||||
|
.It Ic textpen Qq Ar colorname
|
||||||
.SH CustomIconsOnly {yes|no}
|
TODO.
|
||||||
|
.
|
||||||
|
.It Ic shinepen Qq Ar colorname
|
||||||
|
TODO.
|
||||||
|
.
|
||||||
|
.It Ic shadowpen Qq Ar colorname
|
||||||
|
TODO.
|
||||||
|
.
|
||||||
|
.It Ic fillpen Qq Ar colorname
|
||||||
|
TODO.
|
||||||
|
.
|
||||||
|
.It Ic filltextpen Qq Ar colorname
|
||||||
|
TODO.
|
||||||
|
.
|
||||||
|
.It Ic backgroundpen Qq Ar colorname
|
||||||
|
TODO.
|
||||||
|
.
|
||||||
|
.It Ic highlighttextpen Qq Ar colorname
|
||||||
|
TODO.
|
||||||
|
.
|
||||||
|
.It Ic bardetailpen Qq Ar colorname
|
||||||
|
TODO.
|
||||||
|
.
|
||||||
|
.It Ic barblockpen Qq Ar colorname
|
||||||
|
TODO.
|
||||||
|
.
|
||||||
|
.It Ic bartrimpen Qq Ar colorname
|
||||||
|
TODO.
|
||||||
|
.El
|
||||||
|
.
|
||||||
|
.Ss Icon options
|
||||||
|
.Bl -tag -width Ds
|
||||||
|
.It Ic CustomIconsOnly Ar boolean
|
||||||
This prevent applications to display their own icons when in iconified state.
|
This prevent applications to display their own icons when in iconified state.
|
||||||
Only icons defined in amiwmrc for each apps will be used.
|
Only icons defined in amiwmrc for each apps will be used.
|
||||||
Because apps own icon are too different from one eachother.
|
.
|
||||||
They comes in various sizes and themes. Some icons will be 32x32,
|
.Pp
|
||||||
while some other will be a 128x128 or even bigger .. By using this option,
|
Because apps' own icons are too different from one eachother,
|
||||||
You have the possibility to decide which icon should be used for each app.
|
they comes in various sizes and themes.
|
||||||
If no custom icons are defined at all, the def_tool.info will be used for
|
Some icons will be 32x32, while some other will be a 128x128 or even bigger.
|
||||||
all iconified apps. Format is: style { class "myClass" icon "myIcon.info" }
|
By using this option,
|
||||||
To find out a given program's class, use "xlsclients -l" to list all opened
|
You can use the
|
||||||
applications, and then use "xprop -id <0x0000000>" to list a
|
.Ic style
|
||||||
given app's properties. Use either WM_CLASS or WM_ICON_NAME strings in amiwmrc.
|
option below to set which icon should be used for each app.
|
||||||
|
If no custom icons are defined at all, the
|
||||||
.SH ShortLabelIcons {yes|no}
|
.Pa def_tool.info will
|
||||||
|
be used for all iconified apps.
|
||||||
This limit the length of the text for iconified programs. For example, if this
|
.
|
||||||
option is activated, an iconified program text will be limited to 8 chars + ".."
|
.It Ic DefaultIcon Qq Ar filename
|
||||||
Use this option if you don't want iconified program text to be loong strings..
|
Set
|
||||||
|
.Ar filename
|
||||||
.SH TitleBarClock {yes|no}
|
of the
|
||||||
|
.Pa .info
|
||||||
Enables a clock in the titlebar. It displays the date and time.
|
file as default icon.
|
||||||
|
It is relative to the
|
||||||
.SH TitleClockFormat [<number>] "time string"
|
.Ic IconDir .
|
||||||
|
Default value
|
||||||
|
.Qq Pa def_tool.info .
|
||||||
|
.
|
||||||
|
.It Ic IconDir Qq Ar path
|
||||||
|
Directory in which amiwm will look for icons.
|
||||||
|
.
|
||||||
|
.It Ic IconFont Qq Ar fontname
|
||||||
|
Font for icontitles.
|
||||||
|
.
|
||||||
|
.It Ic IconPalette Cm system Ns | Ns Cm magicwb Ns | Ns Cm schwartz Ns | Ns Ar filename
|
||||||
|
Selects either the Workbench\*R default palette,
|
||||||
|
or the MagicWorkbench standard palette for use with icons.
|
||||||
|
The third option is a 16 color palette used on the "Eric Schwartz Productions CD Archive".
|
||||||
|
Alternatively, the
|
||||||
|
.Ar filename
|
||||||
|
of a PPM file representing the palette to use can be used.
|
||||||
|
.
|
||||||
|
.It Ic ShortLabelIcons Ar boolean
|
||||||
|
This limit the length of the text for iconified programs.
|
||||||
|
For example, if this option is activated,
|
||||||
|
an iconified program text will be limited to 8 chars + ".."
|
||||||
|
Use this option if you don't want iconified program text to be loong strings.
|
||||||
|
.
|
||||||
|
.It Ic style Cm "{" Cm class Qo Ar classname Qc Cm icon Qo Ar filename Qc Cm "}"
|
||||||
|
Set the icon
|
||||||
|
.Ar filename
|
||||||
|
for windows of the given class.
|
||||||
|
To find out a program's class, run
|
||||||
|
.Dl $ xlsclients -l
|
||||||
|
to list all opened applications,
|
||||||
|
and then run
|
||||||
|
.Dl $ xprop -id <0x0000000>
|
||||||
|
to list a given app's properties.
|
||||||
|
Use either
|
||||||
|
.Dv WM_CLASS
|
||||||
|
or
|
||||||
|
.Dv WM_ICON_NAME
|
||||||
|
strings in amiwmrc.
|
||||||
|
.El
|
||||||
|
.
|
||||||
|
.Ss TitleBar and MenuBar
|
||||||
|
.Bl -tag -width Ds
|
||||||
|
.It Ic BatteryInfo Ar boolean
|
||||||
|
This lets you display battery information on the menu bar.
|
||||||
|
It reqiures a module (such as Battery)
|
||||||
|
to gather current battery status and push it into amiwm to display.
|
||||||
|
.
|
||||||
|
.It Ic TitleBarClock Ar boolean
|
||||||
|
Enables a clock in the titlebar.
|
||||||
|
It displays the date and time.
|
||||||
|
.
|
||||||
|
.It Ic TitleClockFormat Oo Ar number Oc Ar timeformat
|
||||||
This lets you choose a new format to display the Title Bar Clock.
|
This lets you choose a new format to display the Title Bar Clock.
|
||||||
The time string is formatted with the standard strftime() parameters.
|
The time string is formatted with the standard
|
||||||
The default is "%c". It has been found that "%a %b %e %Y %l:%M %p" works
|
.Xr strftime 3
|
||||||
well too. Number is the update interval in seconds.
|
parameters.
|
||||||
|
The default is
|
||||||
.SH ToolItem \f1\*(lq\f3name" \f1\*(lq\f3command" \f1\*(lq\f3hotkey"
|
.Dq "%c" .
|
||||||
|
It has been found that
|
||||||
Adds an item in the Tools menu with the specified name, which executes
|
.Dq "%a %b %e %Y %l:%M %p"
|
||||||
the command when selected. A string containing a single uppercase letter
|
works well too.
|
||||||
may be specified as the third argument, making this letter a hotkey for the
|
Number is the update interval in seconds.
|
||||||
item.
|
.
|
||||||
|
.It Ic ToolItem Qo Ar name Qc Qo Ar command Qc Qo Ar hotkey Qc
|
||||||
.SH ToolItem Separator
|
Adds an item in the
|
||||||
|
.Em Tools
|
||||||
Inserts a separator bar in the Tools menu.
|
menu with the specified
|
||||||
|
.Ar name ,
|
||||||
.SH ToolItem \f1\*(lq\f3name" { <tool item commands>}
|
which executes the given
|
||||||
|
.Ar command
|
||||||
Create ToolItem:s in a submenu with the specified name. It is not legal
|
when selected.
|
||||||
to create a submenu inside another submenu.
|
A string containing a single uppercase letter may be specified as the third argument,
|
||||||
|
making this letter a hotkey for the item.
|
||||||
.SH Screen [<number>] \f1\*(lq\f3name"
|
.
|
||||||
|
.It Ic ToolItem Qo Ar name Qc Cm { Ar ToolItem Ns s ... Cm }
|
||||||
Create a new screen with the specified name. It will be placed below all
|
Create
|
||||||
earlier created screens. To move a window between two screens, iconify it
|
.Ar ToolItem Ns s
|
||||||
and drag the icon over to the other screen. If the second argument is given,
|
in a submenu with the specified name.
|
||||||
this screen is placed on the corresponding X screen.
|
It is not legal to create a submenu inside another submenu.
|
||||||
|
.
|
||||||
.SH ModulePath \f1\*(lq\f3path(:path...)"
|
.It Ic ToolItem Ic Separator
|
||||||
|
Inserts a separator bar in the
|
||||||
|
.Em Tools
|
||||||
|
menu.
|
||||||
|
.El
|
||||||
|
.
|
||||||
|
.Ss Screen and modules
|
||||||
|
.Bl -tag -width Ds
|
||||||
|
.It Ic InterScreenGap Ar number
|
||||||
|
Sets the size in number of pixels of the "video DMA off" area
|
||||||
|
that appears between screens when they are dragged.
|
||||||
|
.
|
||||||
|
.It Ic ModulePath Qq Ar path Ns Op Cm :\& Ns Ar path ...
|
||||||
Sets one or more directories where amiwm will look for module binaries.
|
Sets one or more directories where amiwm will look for module binaries.
|
||||||
The default is AMIWM_HOME. Note that the module binaries cannot be
|
The default is
|
||||||
shared amongst different architectures.
|
.Ev AMIWM_HOME .
|
||||||
|
Note that the module binaries cannot be shared amongst different architectures.
|
||||||
.SH Module \f1\*(lq\f3name" ["initstring"]
|
.
|
||||||
|
.It Ic Module Qo Ar name Qc Op Qq initstring
|
||||||
Start a module with the specified name. If initstring is specified, it
|
Start a module with the specified
|
||||||
is sent to the module. There are currently two modules shipped with
|
.Ar name .
|
||||||
amiwm; Background and Keyboard. These are documented in the file
|
If
|
||||||
README.modules. If a module is limited to a single screen, like the
|
.Ar initstring
|
||||||
Background module, the screen that was created last is used.
|
is specified, it is sent to the module.
|
||||||
|
For the list of modules, see the section
|
||||||
.SH InterScreenGap number
|
.Sx MODULES
|
||||||
|
below.
|
||||||
Sets the size in number of pixels of the "video DMA off" area that appears
|
If a module is limited to a single screen
|
||||||
between screens when they are dragged.
|
(like the
|
||||||
|
.Em Background
|
||||||
.SH AutoRaise {yes|no}
|
module)
|
||||||
|
the screen that was created last is used.
|
||||||
Selects whether windows will automatically be moved to the front when
|
.
|
||||||
they are activated.
|
.It Ic Screen Oo Ar number Oc Qq Ar screenname
|
||||||
|
Create a new screen with the given
|
||||||
.SH Focus {followmouse|sloppy|clicktotype}
|
.Ar screenname .
|
||||||
|
It will be placed below all earlier created screens.
|
||||||
Sets the policy by which windows are given focus. Followmouse is the
|
To move a window between two screens, iconify it and drag the icon over to the other screen.
|
||||||
default and means that the window that contains the mouse pointer will
|
If the second argument is given, this screen is placed on the corresponding X screen.
|
||||||
have focus. Sloppy means that the window that had focus last will keep
|
.El
|
||||||
it when the pointer is not over a window. ClickToType is the original AmigaOS
|
.
|
||||||
policy in which you have to explicitly give focus to windows by clicking
|
.Sh MODULES
|
||||||
in them.
|
.Nm
|
||||||
|
has the following modules.
|
||||||
|
.Ss Background module
|
||||||
.SH TROUBLESHOOTING
|
This module sets a background image (aka backdrop) on a screen.
|
||||||
|
.
|
||||||
The most likely reason for amiwm to crash is if it
|
.Pp
|
||||||
can't find its default icon, or if this is not accepted as a
|
Its
|
||||||
*.info file. If this happens, amiwm _will_ dump core. So make
|
.Ic Module
|
||||||
sure that either 'make install' runs successfully (in which case
|
command should come after the
|
||||||
amiwm will know where its icon is), or that the file .amiwmrc
|
.Ic Screen
|
||||||
contains a correct specification of the icon's location.
|
command that it sets the backdrop of.
|
||||||
|
Its
|
||||||
.SH CONFIGURATION FILES
|
.Ar initstring
|
||||||
.nf
|
should be the
|
||||||
|
.Ar filename
|
||||||
|
of the picture.
|
||||||
|
Example:
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
Screen "Workbench Screen"
|
||||||
|
Module "Background" "~/megumin.png"
|
||||||
|
.Ed
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
The
|
||||||
|
.Ic Background
|
||||||
|
module is really a shell script that requires the
|
||||||
|
program
|
||||||
|
.Xr display 1
|
||||||
|
from
|
||||||
|
.Xr ImageMagick 1
|
||||||
|
package.
|
||||||
|
Currently, it doesn't support any standard imagemagick parameters.
|
||||||
|
.
|
||||||
|
.Ss Background_stretch module
|
||||||
|
Same as the
|
||||||
|
.Ic Background
|
||||||
|
module, but stretches your backdrop to size of your screen.
|
||||||
|
Example:
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
Screen "Workbench Screen"
|
||||||
|
Module "Background_stretch" "~/megumin.png"
|
||||||
|
.Ed
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
Please note that this module will just stretch or downscale the image
|
||||||
|
(depending on the size of the image) to your display ratio.
|
||||||
|
If you don't want your image to look ugly, try the next module.
|
||||||
|
.
|
||||||
|
.Ss Background_resize module
|
||||||
|
Same as the
|
||||||
|
.Ic Background_stretch ,
|
||||||
|
but it cares about your display ratio.
|
||||||
|
For example, if you've got a 16:9 screen but your backdrop image is 4:3,
|
||||||
|
it will get stretched, but it will still be displayed as a 4:3 picture.
|
||||||
|
The remaining part of the screen will be used to show the same image, but repeated.
|
||||||
|
.
|
||||||
|
.Ss Keyboard module
|
||||||
|
This module binds window manager functions to keys on the keyboard.
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
The
|
||||||
|
.Ar initstring
|
||||||
|
consists of one or more keybindings on the form
|
||||||
|
.D1 Ar modifiers Ns < Ns Ar keysym Ns >: Ns Ar where Ns : Ns Ar func
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
Multiple keybindings are specified with spaces between them.
|
||||||
|
The keybinding string can be broken into two lines with a backslash
|
||||||
|
.Pq Sq \e
|
||||||
|
and newline.
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
The components of a keybinding string are as follows:
|
||||||
|
.Bl -tag -width "modifiers"
|
||||||
|
.It Ar modifiers
|
||||||
|
Modifiers is 0 or more of:
|
||||||
|
.Cm Shift , Control , Meta , Lock ,
|
||||||
|
.Cm Mod1 , Mod2 , Mod3 , Mod4 , Mod5 ,
|
||||||
|
.Cm Button1 , Button2 , Button3 , Button4 , Button5 .
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
Modifiers are joined together using spaces.
|
||||||
|
This can be confusing as it looks like keybindings are specified with spaces between them,
|
||||||
|
but the parser actually handles this.
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
The modifiers listed must be pressed together with the key to activate the binding.
|
||||||
|
.
|
||||||
|
.It Ar keysym
|
||||||
|
Keysym is a standard X keysym name, like F1 or Prior.
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
Keysyms are listed in the file
|
||||||
|
.Pa /usr/include/X11/keysymdef.h
|
||||||
|
(or another equivalent in your system).
|
||||||
|
Just remove the
|
||||||
|
.Ql XK_
|
||||||
|
prefix before them.
|
||||||
|
.
|
||||||
|
.It Ar where
|
||||||
|
It is either
|
||||||
|
.Cm all ,
|
||||||
|
or one or more of
|
||||||
|
.Cm window , frame , icon , root
|
||||||
|
separated with a bar
|
||||||
|
.Pq Sq "|" .
|
||||||
|
This controls in what areas of the screen that the key will be active.
|
||||||
|
.
|
||||||
|
.It Ar func
|
||||||
|
The function to perform when the key is pressed.
|
||||||
|
Currently the following are defined:
|
||||||
|
.Bl -tag -compact -width "rotatescreens"
|
||||||
|
.It Cm rotatescreens
|
||||||
|
Move the frontmost screen to the back
|
||||||
|
.It Cm raisewindow
|
||||||
|
Rotate the bottom window to the top of the screen
|
||||||
|
.It Cm lowerwindow
|
||||||
|
Rotate the top window to the bottom of the screen
|
||||||
|
.It Cm rotatewindow
|
||||||
|
Move the current window to the next screen, rotate screen
|
||||||
|
.It Cm front
|
||||||
|
Move the window in which the key is pressed to the front
|
||||||
|
.It Cm back
|
||||||
|
Move the window in which the key is pressed to the back
|
||||||
|
.It Cm iconify
|
||||||
|
Iconify the window in which the key is pressed
|
||||||
|
.El
|
||||||
|
.El
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
Example:
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
Module "Keyboard" "\e
|
||||||
|
Meta<F1>:window|frame:front\e
|
||||||
|
Meta<F2>:window|frame:iconify\e
|
||||||
|
Meta<F3>:window|frame:back"
|
||||||
|
.Ed
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
This binds the keys Meta-F1, Meta-F2 and Meta-F3 to front, back and iconify respectively.
|
||||||
|
They will only have effect inside windows and in window frames.
|
||||||
|
(These are the only places that front/iconfy/back has effect anyway.)
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
An example with multiple modifiers in a single keybinding:
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
Module "Keyboard" "Meta<M>:all:rotatescreens\e
|
||||||
|
Meta<Tab>:all:raisewindow\e
|
||||||
|
Control Meta<Tab>:all:lowerwindow"
|
||||||
|
.Ed
|
||||||
|
.
|
||||||
|
.Ss Filesystem module
|
||||||
|
This is an april fools joke module,
|
||||||
|
but at least it's a starting point for building out an icon on the desktop!
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
Module "Filesystem" "/path/to/open"
|
||||||
|
.Ed
|
||||||
|
.
|
||||||
|
.Ss Launcher module
|
||||||
|
This is a simple prototype launcher program
|
||||||
|
that places an icon on a workbench screen which can be double clicked to run.
|
||||||
|
Its
|
||||||
|
.Ic Module
|
||||||
|
command should come after the
|
||||||
|
.Ic Screen
|
||||||
|
command it places the launcher icon at.
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
The
|
||||||
|
.Ar initstring
|
||||||
|
has the following format:
|
||||||
|
.D1 Ar label icon command Op args ...
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
Where:
|
||||||
|
.Bl -tag -compact -width "command args..."
|
||||||
|
.It "label"
|
||||||
|
The launcher icon name.
|
||||||
|
.It "icon"
|
||||||
|
One of the
|
||||||
|
.Pa .icon
|
||||||
|
files in the
|
||||||
|
.Ic IconDir .
|
||||||
|
.It "command args..."
|
||||||
|
The command and its arguments to run.
|
||||||
|
.El
|
||||||
|
.
|
||||||
|
.Ss Battery module
|
||||||
|
This is a simple battery state polling module that is being used
|
||||||
|
during battery monitoring / menu toolbar development.
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
It's currently FreeBSD specific and based on what xbatt does to pull info from APM/ACPI.
|
||||||
|
Adding Linux and other OS support shouldn't be too difficult.
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
Module "Battery"
|
||||||
|
.Ed
|
||||||
|
.
|
||||||
|
.Sh FILES
|
||||||
|
.Bl -bullet -compact -width ""
|
||||||
|
.It
|
||||||
$HOME/.amiwmrc
|
$HOME/.amiwmrc
|
||||||
|
.It
|
||||||
$AMIWM_HOME/system.amiwmrc
|
$AMIWM_HOME/system.amiwmrc
|
||||||
.fi
|
.El
|
||||||
|
.
|
||||||
.SH COPYRIGHT NOTICES
|
.Sh AUTHORS
|
||||||
This program is distributed as freeware. The copyright remains with
|
.Nm
|
||||||
the author. See the file LICENSE for more information.
|
was originally written by
|
||||||
|
.An Marcus Comstedt Aq Mt marcus@mc.pp.se
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
With contributions from:
|
||||||
|
.An Scott Lawrence Aq Mt amiwm10@umlautllama.com
|
||||||
|
.An Nicolas Sipieter Aq Mt freeeaks@gmail.com
|
||||||
|
.An redsPL Aq Mt reds@sakamoto.pl
|
||||||
|
.
|
||||||
|
.Pp
|
||||||
|
.Nm
|
||||||
|
is distributed as freeware.
|
||||||
|
The copyright remains with the author.
|
||||||
|
See the file LICENSE for more information.
|
||||||
Amiga and Workbench are registered trademarks of AMIGA International Inc.
|
Amiga and Workbench are registered trademarks of AMIGA International Inc.
|
||||||
|
.
|
||||||
.SH ORIGINAL AUTHOR
|
.Sh CAVEATS
|
||||||
Marcus Comstedt,
|
The most likely reason for amiwm to crash is if it can't find its default icon,
|
||||||
.I marcus@mc.pp.se
|
or if this is not accepted as a
|
||||||
|
.Pa "*.info"
|
||||||
.SH CONTRIBUTORS
|
file.
|
||||||
|
If this happens, amiwm
|
||||||
Scott Lawrence,
|
.Sy WILL
|
||||||
.I amiwm10@umlautllama.com
|
dump core.
|
||||||
|
.
|
||||||
Nicolas Sipieter,
|
.Pp
|
||||||
.I freeeaks@gmail.com
|
So make sure when installing that either
|
||||||
|
.Ql "make install"
|
||||||
redsPL,
|
runs successfully (in which case amiwm will know where its icon is),
|
||||||
.I reds@desu.gq
|
or that the file
|
||||||
|
.Pa "~/.amiwmrc"
|
||||||
|
contains an
|
||||||
|
.Ic IconDir
|
||||||
|
option with a correct specification of the icon's location.
|
||||||
|
|||||||
84
battery_module.c
Normal file
84
battery_module.c
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <err.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <machine/apm_bios.h>
|
||||||
|
|
||||||
|
#define APM_DEV "/dev/apm"
|
||||||
|
|
||||||
|
#include "libami.h"
|
||||||
|
|
||||||
|
/* XXX should be an md method */
|
||||||
|
extern void (*md_periodic_func)(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test battery module for FreeBSD, using APM.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void docmd(XEvent *e, void *callback)
|
||||||
|
{
|
||||||
|
((void (*)(Window))callback)(e->xany.window);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *progname;
|
||||||
|
static int apm_fd = -1;
|
||||||
|
|
||||||
|
static bool
|
||||||
|
get_apm_info(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
struct apm_info info;
|
||||||
|
|
||||||
|
ret = ioctl(apm_fd, APMIO_GETINFO, &info);
|
||||||
|
if (ret < 0) {
|
||||||
|
warn("ioctl (APMIO_GETINFO)");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
printf("Battery life: %d\n", info.ai_batt_life);
|
||||||
|
printf("Battery time: %d\n", info.ai_batt_time);
|
||||||
|
printf("Battery AC: %d\n", info.ai_acline);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
md_update_battery(info.ai_batt_life, info.ai_batt_time,
|
||||||
|
info.ai_acline);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
periodic_func(void)
|
||||||
|
{
|
||||||
|
get_apm_info();
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
char *arg;
|
||||||
|
|
||||||
|
arg = md_init(argc, argv);
|
||||||
|
(void) arg;
|
||||||
|
|
||||||
|
progname=argv[0];
|
||||||
|
|
||||||
|
md_periodic_func = periodic_func;
|
||||||
|
|
||||||
|
apm_fd = open(APM_DEV, O_RDONLY);
|
||||||
|
if (apm_fd < 0) {
|
||||||
|
err(127, "open");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* initial battery info */
|
||||||
|
get_apm_info();
|
||||||
|
|
||||||
|
/* Run main loop */
|
||||||
|
md_main_loop();
|
||||||
|
|
||||||
|
close(apm_fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
178
client.c
178
client.c
@@ -129,22 +129,64 @@ void checksizehints(Client *c)
|
|||||||
{
|
{
|
||||||
long supplied;
|
long supplied;
|
||||||
|
|
||||||
XGetWMNormalHints(dpy, c->window, &c->sizehints, &supplied);
|
XGetWMNormalHints(dpy, c->window, c->sizehints, &supplied);
|
||||||
if(!(c->sizehints.flags&PMinSize))
|
if(!(c->sizehints->flags&PMinSize))
|
||||||
c->sizehints.min_width=c->sizehints.min_height=0;
|
c->sizehints->min_width=c->sizehints->min_height=0;
|
||||||
if(!(c->sizehints.flags&PMaxSize))
|
if(!(c->sizehints->flags&PMaxSize))
|
||||||
c->sizehints.max_width=c->sizehints.max_height=1<<30;
|
c->sizehints->max_width=c->sizehints->max_height=1<<30;
|
||||||
if(!(c->sizehints.flags&PResizeInc))
|
if(!(c->sizehints->flags&PResizeInc))
|
||||||
c->sizehints.width_inc=c->sizehints.height_inc=1;
|
c->sizehints->width_inc=c->sizehints->height_inc=1;
|
||||||
if(c->sizehints.flags&PBaseSize) {
|
if(c->sizehints->flags&PBaseSize) {
|
||||||
c->sizehints.min_width=c->sizehints.base_width;
|
c->sizehints->min_width=c->sizehints->base_width;
|
||||||
c->sizehints.min_height=c->sizehints.base_height;
|
c->sizehints->min_height=c->sizehints->base_height;
|
||||||
}
|
}
|
||||||
if(c->sizehints.min_width<1) c->sizehints.min_width=1;
|
if(c->sizehints->min_width<1) c->sizehints->min_width=1;
|
||||||
if(c->sizehints.min_height<1) c->sizehints.min_height=1;
|
if(c->sizehints->min_height<1) c->sizehints->min_height=1;
|
||||||
c->sizehints.base_width=c->sizehints.min_width;
|
c->sizehints->base_width=c->sizehints->min_width;
|
||||||
c->sizehints.base_height=c->sizehints.min_height;
|
c->sizehints->base_height=c->sizehints->min_height;
|
||||||
if(c->sizehints.flags&PWinGravity) c->gravity=c->sizehints.win_gravity;
|
if(c->sizehints->flags&PWinGravity) c->gravity=c->sizehints->win_gravity;
|
||||||
|
}
|
||||||
|
|
||||||
|
void open_fscrn(Client *c)
|
||||||
|
{
|
||||||
|
c->fsscr = scr = openscreen(NULL, scr->root);
|
||||||
|
c->reparenting = 1;
|
||||||
|
XReparentWindow(dpy, c->parent, c->fsscr->back, 0, 0);
|
||||||
|
XRaiseWindow(dpy, c->window);
|
||||||
|
XMoveResizeWindow(dpy, c->parent, 0, 0, c->fsscr->width, c->fsscr->height);
|
||||||
|
XMoveResizeWindow(dpy, c->window, 0, 0, c->fsscr->width, c->fsscr->height);
|
||||||
|
for (Client *dialog = clients; dialog != NULL; dialog = dialog->next)
|
||||||
|
if (dialog->leader == c)
|
||||||
|
reparent_client(c->fsscr, dialog);
|
||||||
|
XResizeWindow(dpy, c->window, scr->width, scr->height);
|
||||||
|
realizescreens();
|
||||||
|
scr = c->fsscr;
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
XStoreName(dpy, scr->back, c->title);
|
||||||
|
#else
|
||||||
|
XSetWMName(dpy, scr->back, &c->title);
|
||||||
|
#endif
|
||||||
|
screentoback();
|
||||||
|
}
|
||||||
|
|
||||||
|
void close_fscrn(Client *c, int state)
|
||||||
|
{
|
||||||
|
if (c->fsscr == NULL)
|
||||||
|
return;
|
||||||
|
XReparentWindow(dpy, c->parent, c->scr, c->x, c->y);
|
||||||
|
XMoveResizeWindow(dpy, c->parent, c->x, c->y, c->pwidth, c->pheight);
|
||||||
|
XMoveResizeWindow(dpy, c->window, 4, c->scr->bh, c->pwidth-c->framewidth, c->pheight-c->frameheight);
|
||||||
|
XResizeWindow(dpy, c->window, c->pwidth-c->framewidth, c->pheight-c->frameheight);
|
||||||
|
XLowerWindow(dpy, c->window);
|
||||||
|
scr = c->fsscr;
|
||||||
|
closescreen();
|
||||||
|
c->fsscr = NULL;
|
||||||
|
scr = c->scr;
|
||||||
|
if (state != IconicState)
|
||||||
|
XMapWindow(dpy, c->parent);
|
||||||
|
for (Client *dialog = clients; dialog != NULL; dialog = dialog->next)
|
||||||
|
if (dialog->leader == c)
|
||||||
|
reparent_client(c->scr, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setclientstate(Client *c, int state)
|
void setclientstate(Client *c, int state)
|
||||||
@@ -154,6 +196,13 @@ void setclientstate(Client *c, int state)
|
|||||||
data[0] = (long) state;
|
data[0] = (long) state;
|
||||||
data[1] = (long) None;
|
data[1] = (long) None;
|
||||||
|
|
||||||
|
if (c->fullscreen) {
|
||||||
|
if (state != NormalState && c->state == NormalState) {
|
||||||
|
close_fscrn(c, state);
|
||||||
|
} else if (state == NormalState && c->state != NormalState) {
|
||||||
|
open_fscrn(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
c->state = state;
|
c->state = state;
|
||||||
XChangeProperty(dpy, c->window, wm_state, wm_state, 32,
|
XChangeProperty(dpy, c->window, wm_state, wm_state, 32,
|
||||||
PropModeReplace, (unsigned char *)data, 2);
|
PropModeReplace, (unsigned char *)data, 2);
|
||||||
@@ -175,6 +224,7 @@ Client *createclient(Window w)
|
|||||||
|
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
int b = 0;
|
||||||
|
|
||||||
if(w==0) return 0;
|
if(w==0) return 0;
|
||||||
if(!XFindContext(dpy, w, client_context, (XPointer*)&c)) return c;
|
if(!XFindContext(dpy, w, client_context, (XPointer*)&c)) return c;
|
||||||
@@ -182,7 +232,9 @@ Client *createclient(Window w)
|
|||||||
XGetWindowAttributes(dpy, w, &attr);
|
XGetWindowAttributes(dpy, w, &attr);
|
||||||
|
|
||||||
c = (Client *)calloc(1, sizeof(Client));
|
c = (Client *)calloc(1, sizeof(Client));
|
||||||
|
c->sizehints = XAllocSizeHints();
|
||||||
c->scr = scr;
|
c->scr = scr;
|
||||||
|
c->fsscr = NULL;
|
||||||
c->window = w;
|
c->window = w;
|
||||||
c->parent = scr->root;
|
c->parent = scr->root;
|
||||||
c->old_bw = attr.border_width;
|
c->old_bw = attr.border_width;
|
||||||
@@ -190,6 +242,7 @@ Client *createclient(Window w)
|
|||||||
c->state = WithdrawnState;
|
c->state = WithdrawnState;
|
||||||
c->gravity = NorthWestGravity;
|
c->gravity = NorthWestGravity;
|
||||||
c->reparenting = 0;
|
c->reparenting = 0;
|
||||||
|
c->fullscreen = 0;
|
||||||
XSelectInput(dpy, c->window, PropertyChangeMask);
|
XSelectInput(dpy, c->window, PropertyChangeMask);
|
||||||
#ifdef USE_FONTSETS
|
#ifdef USE_FONTSETS
|
||||||
{
|
{
|
||||||
@@ -214,24 +267,37 @@ Client *createclient(Window w)
|
|||||||
checksizehints(c);
|
checksizehints(c);
|
||||||
c->zoomx=0;
|
c->zoomx=0;
|
||||||
c->zoomy=scr->bh;
|
c->zoomy=scr->bh;
|
||||||
if(c->sizehints.width_inc) {
|
if ((c->sizehints->width_inc &&
|
||||||
c->zoomw=scr->width-c->sizehints.base_width-22;
|
c->sizehints->min_width+c->sizehints->width_inc<=c->sizehints->max_width)||
|
||||||
c->zoomw-=c->zoomw%c->sizehints.width_inc;
|
(c->sizehints->height_inc &&
|
||||||
c->zoomw+=c->sizehints.base_width;
|
c->sizehints->min_height+c->sizehints->height_inc<=c->sizehints->max_height))
|
||||||
if(c->zoomw>c->sizehints.max_width)
|
b = prefs.sizeborder;
|
||||||
c->zoomw=c->sizehints.max_width;
|
if(c->sizehints->width_inc) {
|
||||||
if(c->zoomw<c->sizehints.min_width)
|
c->zoomw=scr->width-c->sizehints->base_width;
|
||||||
c->zoomw=c->sizehints.min_width;
|
if (b & Psizeright)
|
||||||
|
c->zoomw-=22;
|
||||||
|
else
|
||||||
|
c->zoomw-=8;
|
||||||
|
c->zoomw-=c->zoomw%c->sizehints->width_inc;
|
||||||
|
c->zoomw+=c->sizehints->base_width;
|
||||||
|
if(c->zoomw>c->sizehints->max_width)
|
||||||
|
c->zoomw=c->sizehints->max_width;
|
||||||
|
if(c->zoomw<c->sizehints->min_width)
|
||||||
|
c->zoomw=c->sizehints->min_width;
|
||||||
} else
|
} else
|
||||||
c->zoomw=attr.width;
|
c->zoomw=attr.width;
|
||||||
if(c->sizehints.height_inc) {
|
if(c->sizehints->height_inc) {
|
||||||
c->zoomh=scr->height-c->sizehints.base_height-scr->bh-c->zoomy-2;
|
c->zoomh=scr->height-c->sizehints->base_height-scr->bh-c->zoomy;
|
||||||
c->zoomh-=c->zoomh%c->sizehints.height_inc;
|
if (b & Psizebottom)
|
||||||
c->zoomh+=c->sizehints.base_height;
|
c->zoomh -= 10;
|
||||||
if(c->zoomh>c->sizehints.max_height)
|
else
|
||||||
c->zoomh=c->sizehints.max_height;
|
c->zoomh -= 2;
|
||||||
if(c->zoomh<c->sizehints.min_height)
|
c->zoomh-=c->zoomh%c->sizehints->height_inc;
|
||||||
c->zoomh=c->sizehints.min_height;
|
c->zoomh+=c->sizehints->base_height;
|
||||||
|
if(c->zoomh>c->sizehints->max_height)
|
||||||
|
c->zoomh=c->sizehints->max_height;
|
||||||
|
if(c->zoomh<c->sizehints->min_height)
|
||||||
|
c->zoomh=c->sizehints->min_height;
|
||||||
} else
|
} else
|
||||||
c->zoomh=attr.height;
|
c->zoomh=attr.height;
|
||||||
XSaveContext(dpy, w, client_context, (XPointer)c);
|
XSaveContext(dpy, w, client_context, (XPointer)c);
|
||||||
@@ -252,6 +318,9 @@ void rmclient(Client *c)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((scr = c->fsscr))
|
||||||
|
closescreen();
|
||||||
|
scr = c->scr;
|
||||||
if(c->active) {
|
if(c->active) {
|
||||||
if(!menuactive)
|
if(!menuactive)
|
||||||
setfocus(None);
|
setfocus(None);
|
||||||
@@ -287,6 +356,11 @@ void rmclient(Client *c)
|
|||||||
rmicon(c->icon);
|
rmicon(c->icon);
|
||||||
if(c->window)
|
if(c->window)
|
||||||
XDeleteContext(dpy, c->window, client_context);
|
XDeleteContext(dpy, c->window, client_context);
|
||||||
|
if (c->sizehints)
|
||||||
|
XFree(c->sizehints);
|
||||||
|
for (Client *dialog = clients; dialog != NULL; dialog = dialog->next)
|
||||||
|
if (dialog->leader == c)
|
||||||
|
dialog->leader = NULL;
|
||||||
free(c);
|
free(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +385,7 @@ void flushclients()
|
|||||||
Scrn *scr2;
|
Scrn *scr2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if((scr = front)) do {
|
if((scr = get_front_scr())) do {
|
||||||
scr = scr->upfront;
|
scr = scr->upfront;
|
||||||
XQueryTree(dpy, scr->back, &dw1, &dw2, &wins, &nwins);
|
XQueryTree(dpy, scr->back, &dw1, &dw2, &wins, &nwins);
|
||||||
for(i=0; i<nwins; i++)
|
for(i=0; i<nwins; i++)
|
||||||
@@ -347,7 +421,7 @@ void flushclients()
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
XFree((void *) wins);
|
XFree((void *) wins);
|
||||||
} while(scr!=front);
|
} while( scr!= get_front_scr());
|
||||||
while((c=clients)) {
|
while((c=clients)) {
|
||||||
if(c->parent != c->scr->root) {
|
if(c->parent != c->scr->root) {
|
||||||
int x,y;
|
int x,y;
|
||||||
@@ -359,3 +433,41 @@ void flushclients()
|
|||||||
rmclient(c);
|
rmclient(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reparent the given client to the given screen.
|
||||||
|
*
|
||||||
|
* This moves the given client to the given screen.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
reparent_client(Scrn *s, Client *client)
|
||||||
|
{
|
||||||
|
client->scr = s;
|
||||||
|
if(client->parent != client->scr->root)
|
||||||
|
XReparentWindow(dpy, client->parent, s->back, client->x, client->y);
|
||||||
|
if (s->deftitle != NULL)
|
||||||
|
setstringprop(client->window, amiwm_screen, s->deftitle);
|
||||||
|
sendconfig(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void fullscreen(Client *c, int fs)
|
||||||
|
{
|
||||||
|
if (fs == c->fullscreen)
|
||||||
|
return;
|
||||||
|
if (c->state != NormalState) {
|
||||||
|
c->fullscreen = fs;
|
||||||
|
setwmstate(c);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs) {
|
||||||
|
open_fscrn(c);
|
||||||
|
c->fullscreen = 1;
|
||||||
|
} else {
|
||||||
|
close_fscrn(c, c->state);
|
||||||
|
c->fullscreen = 0;
|
||||||
|
setclientstate(c, NormalState);
|
||||||
|
}
|
||||||
|
setwmstate(c);
|
||||||
|
}
|
||||||
|
|||||||
18
client.h
18
client.h
@@ -6,9 +6,18 @@
|
|||||||
|
|
||||||
struct _Icon;
|
struct _Icon;
|
||||||
struct _Scrn;
|
struct _Scrn;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* struct _Client - application client information.
|
||||||
|
*
|
||||||
|
* @next: next client in list.
|
||||||
|
* @scr: virtual desktop this client belongs to.
|
||||||
|
* @colormap: current colormap.
|
||||||
|
*/
|
||||||
typedef struct _Client {
|
typedef struct _Client {
|
||||||
|
struct _Client *leader;
|
||||||
struct _Client *next;
|
struct _Client *next;
|
||||||
struct _Scrn *scr;
|
struct _Scrn *scr, *fsscr;
|
||||||
struct _Icon *icon;
|
struct _Icon *icon;
|
||||||
struct module *module;
|
struct module *module;
|
||||||
int wflags;
|
int wflags;
|
||||||
@@ -19,13 +28,14 @@ typedef struct _Client {
|
|||||||
int x, y, pwidth, pheight, dragw, framewidth, frameheight;
|
int x, y, pwidth, pheight, dragw, framewidth, frameheight;
|
||||||
int zoomx, zoomy, zoomw, zoomh;
|
int zoomx, zoomy, zoomw, zoomh;
|
||||||
int old_bw, proto, state, gravity, reparenting;
|
int old_bw, proto, state, gravity, reparenting;
|
||||||
int active, shaped;
|
int active, shaped, fullscreen;
|
||||||
#ifdef USE_FONTSETS
|
#ifdef USE_FONTSETS
|
||||||
char *title;
|
char *title;
|
||||||
#else
|
#else
|
||||||
XTextProperty title;
|
XTextProperty title;
|
||||||
#endif
|
#endif
|
||||||
XSizeHints sizehints;
|
/* This needs to be a pointer! */
|
||||||
|
XSizeHints *sizehints;
|
||||||
struct _Style *style;
|
struct _Style *style;
|
||||||
} Client;
|
} Client;
|
||||||
|
|
||||||
@@ -42,5 +52,7 @@ extern void getstate(Client *);
|
|||||||
extern void grav_map_frame_to_win(Client *, int, int, int *, int *);
|
extern void grav_map_frame_to_win(Client *, int, int, int *, int *);
|
||||||
extern void grav_map_win_to_frame(Client *, int, int, int *, int *);
|
extern void grav_map_win_to_frame(Client *, int, int, int *, int *);
|
||||||
extern void setclientstate(Client *, int);
|
extern void setclientstate(Client *, int);
|
||||||
|
extern void reparent_client(struct _Scrn *s, Client *client);
|
||||||
|
extern void fullscreen(Client *, int);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
337
config_util.c
Normal file
337
config_util.c
Normal file
@@ -0,0 +1,337 @@
|
|||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "drawinfo.h"
|
||||||
|
#include "libami.h"
|
||||||
|
|
||||||
|
#ifdef AMIGAOS
|
||||||
|
#include <pragmas/xlib_pragmas.h>
|
||||||
|
extern struct Library *XLibBase;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BUT_BUTSPACE (2*(2+5))
|
||||||
|
#define BUT_INTSPACE 12
|
||||||
|
#define BUT_EXTSPACE 4
|
||||||
|
#define BUT_VSPACE 6
|
||||||
|
#define TXT_HSPACE 48
|
||||||
|
#define TXT_TOPSPACE 4
|
||||||
|
#define TXT_MIDSPACE 3
|
||||||
|
#define TXT_BOTSPACE 4
|
||||||
|
|
||||||
|
struct choice {
|
||||||
|
struct choice *next;
|
||||||
|
const char *text;
|
||||||
|
int l, w;
|
||||||
|
Window win;
|
||||||
|
} *firstchoice=NULL, *lastchoice=NULL;
|
||||||
|
|
||||||
|
struct line {
|
||||||
|
struct line *next;
|
||||||
|
const char *text;
|
||||||
|
int l, w, h;
|
||||||
|
} *firstline=NULL, *lastline=NULL;
|
||||||
|
|
||||||
|
Display *dpy;
|
||||||
|
Window root, mainwin, textwin;
|
||||||
|
char *progname;
|
||||||
|
GC gc;
|
||||||
|
Pixmap stipple;
|
||||||
|
|
||||||
|
int totw=0, maxw=0, toth=0, nchoices=0;
|
||||||
|
int depressed=0;
|
||||||
|
struct choice *selected=NULL;
|
||||||
|
|
||||||
|
struct DrawInfo dri;
|
||||||
|
|
||||||
|
struct RDArgs *ra=NULL;
|
||||||
|
|
||||||
|
void selection(int n)
|
||||||
|
{
|
||||||
|
printf("%d\n", n);
|
||||||
|
XDestroyWindow(dpy, mainwin);
|
||||||
|
XCloseDisplay(dpy);
|
||||||
|
FreeArgs(ra);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *myalloc(size_t s)
|
||||||
|
{
|
||||||
|
void *p=calloc(s,1);
|
||||||
|
if(p)
|
||||||
|
return p;
|
||||||
|
fprintf(stderr, "%s: out of memory!\n", progname);
|
||||||
|
FreeArgs(ra);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void addchoice(const char *txt)
|
||||||
|
{
|
||||||
|
struct choice *c=myalloc(sizeof(struct choice));
|
||||||
|
if(lastchoice)
|
||||||
|
lastchoice->next=c;
|
||||||
|
else
|
||||||
|
firstchoice=c;
|
||||||
|
lastchoice=c;
|
||||||
|
c->l=strlen(c->text=txt);
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
totw+=(c->w=XmbTextEscapement(dri.dri_FontSet, c->text, c->l))+BUT_BUTSPACE;
|
||||||
|
#else
|
||||||
|
totw+=(c->w=XTextWidth(dri.dri_Font, c->text, c->l))+BUT_BUTSPACE;
|
||||||
|
#endif
|
||||||
|
nchoices++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void addline(const char *txt)
|
||||||
|
{
|
||||||
|
struct line *l=myalloc(sizeof(struct line));
|
||||||
|
if(lastline)
|
||||||
|
lastline->next=l;
|
||||||
|
else
|
||||||
|
firstline=l;
|
||||||
|
lastline=l;
|
||||||
|
l->l=strlen(l->text=txt);
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
l->w=XmbTextEscapement(dri.dri_FontSet, l->text, l->l);
|
||||||
|
#else
|
||||||
|
l->w=XTextWidth(dri.dri_Font, l->text, l->l);
|
||||||
|
#endif
|
||||||
|
toth+=l->h=dri.dri_Ascent+dri.dri_Descent;
|
||||||
|
if(l->w>maxw)
|
||||||
|
maxw=l->w;
|
||||||
|
}
|
||||||
|
|
||||||
|
void refresh_text()
|
||||||
|
{
|
||||||
|
int w=totw-BUT_EXTSPACE-BUT_EXTSPACE;
|
||||||
|
int h=toth-TXT_TOPSPACE-TXT_MIDSPACE-TXT_BOTSPACE-BUT_VSPACE-
|
||||||
|
(dri.dri_Ascent+dri.dri_Descent);
|
||||||
|
int x=(totw-maxw+TXT_HSPACE)>>1;
|
||||||
|
int y=((dri.dri_Ascent+dri.dri_Descent)>>1)+dri.dri_Ascent;
|
||||||
|
struct line *l;
|
||||||
|
XSetForeground(dpy, gc, dri.dri_Pens[SHADOWPEN]);
|
||||||
|
XDrawLine(dpy, textwin, gc, 0, 0, w-2, 0);
|
||||||
|
XDrawLine(dpy, textwin, gc, 0, 0, 0, h-2);
|
||||||
|
XSetForeground(dpy, gc, dri.dri_Pens[SHINEPEN]);
|
||||||
|
XDrawLine(dpy, textwin, gc, 0, h-1, w-1, h-1);
|
||||||
|
XDrawLine(dpy, textwin, gc, w-1, 0, w-1, h-1);
|
||||||
|
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
|
||||||
|
for(l=firstline; l; l=l->next) {
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
XmbDrawString(dpy, textwin, dri.dri_FontSet, gc, x, y, l->text, l->l);
|
||||||
|
#else
|
||||||
|
XDrawString(dpy, textwin, gc, x, y, l->text, l->l);
|
||||||
|
#endif
|
||||||
|
y+=dri.dri_Ascent+dri.dri_Descent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void refresh_choice(struct choice *c)
|
||||||
|
{
|
||||||
|
int w=c->w+BUT_BUTSPACE;
|
||||||
|
int h=dri.dri_Ascent+dri.dri_Descent+BUT_VSPACE;
|
||||||
|
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
XmbDrawString(dpy, c->win, dri.dri_FontSet, gc, BUT_BUTSPACE/2,
|
||||||
|
dri.dri_Ascent+BUT_VSPACE/2, c->text, c->l);
|
||||||
|
#else
|
||||||
|
XDrawString(dpy, c->win, gc, BUT_BUTSPACE/2,
|
||||||
|
dri.dri_Ascent+BUT_VSPACE/2, c->text, c->l);
|
||||||
|
#endif
|
||||||
|
XSetForeground(dpy, gc, dri.dri_Pens[(c==selected && depressed)?
|
||||||
|
SHADOWPEN:SHINEPEN]);
|
||||||
|
XDrawLine(dpy, c->win, gc, 0, 0, w-2, 0);
|
||||||
|
XDrawLine(dpy, c->win, gc, 0, 0, 0, h-2);
|
||||||
|
XSetForeground(dpy, gc, dri.dri_Pens[(c==selected && depressed)?
|
||||||
|
SHINEPEN:SHADOWPEN]);
|
||||||
|
XDrawLine(dpy, c->win, gc, 1, h-1, w-1, h-1);
|
||||||
|
XDrawLine(dpy, c->win, gc, w-1, 1, w-1, h-1);
|
||||||
|
XSetForeground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
|
||||||
|
XDrawPoint(dpy, c->win, gc, w-1, 0);
|
||||||
|
XDrawPoint(dpy, c->win, gc, 0, h-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void split(char *str, const char *delim, void (*func)(const char *))
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
if((p=strtok(str, delim)))
|
||||||
|
do {
|
||||||
|
(*func)(p);
|
||||||
|
} while((p=strtok(NULL, delim)));
|
||||||
|
}
|
||||||
|
|
||||||
|
struct choice *getchoice(Window w)
|
||||||
|
{
|
||||||
|
struct choice *c;
|
||||||
|
for(c=firstchoice; c; c=c->next)
|
||||||
|
if(w == c->win)
|
||||||
|
return c;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void toggle(struct choice *c)
|
||||||
|
{
|
||||||
|
XSetWindowBackground(dpy, c->win, dri.dri_Pens[(depressed&&c==selected)?
|
||||||
|
FILLPEN:BACKGROUNDPEN]);
|
||||||
|
XClearWindow(dpy, c->win);
|
||||||
|
refresh_choice(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void abortchoice()
|
||||||
|
{
|
||||||
|
if(depressed) {
|
||||||
|
depressed=0;
|
||||||
|
toggle(selected);
|
||||||
|
}
|
||||||
|
selected=NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void endchoice()
|
||||||
|
{
|
||||||
|
struct choice *c=selected, *c2=firstchoice;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
abortchoice();
|
||||||
|
if(c==lastchoice)
|
||||||
|
selection(0);
|
||||||
|
for(n=1; c2; n++, c2=c2->next)
|
||||||
|
if(c2==c)
|
||||||
|
selection(n);
|
||||||
|
selection(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
XWindowAttributes attr;
|
||||||
|
static XSizeHints size_hints;
|
||||||
|
static XTextProperty txtprop1, txtprop2;
|
||||||
|
int x, y, extra=0, n=0;
|
||||||
|
struct choice *c;
|
||||||
|
Argtype array[3], *atp;
|
||||||
|
|
||||||
|
progname="Configuration Utility"; //argv[0];
|
||||||
|
// initargs(argc, argv);
|
||||||
|
// if(!(ra=ReadArgs((STRPTR)"TITLE/A,BODY/A,GADGETS/M", (LONG *)array, NULL))) {
|
||||||
|
// PrintFault(IoErr(), (UBYTE *)progname);
|
||||||
|
// exit(1);
|
||||||
|
// }
|
||||||
|
if(!(dpy = XOpenDisplay(NULL))) {
|
||||||
|
fprintf(stderr, "%s: cannot connect to X server %s\n", progname,
|
||||||
|
XDisplayName(NULL));
|
||||||
|
FreeArgs(ra);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
root = RootWindow(dpy, DefaultScreen(dpy));
|
||||||
|
XGetWindowAttributes(dpy, root, &attr);
|
||||||
|
init_dri(&dri, dpy, root, attr.colormap, False);
|
||||||
|
addline("Welcome to Configration Utility for AmiWM");
|
||||||
|
addline("");
|
||||||
|
addline("that's just a test");
|
||||||
|
addchoice("OK");
|
||||||
|
addchoice("cya");
|
||||||
|
|
||||||
|
totw+=BUT_EXTSPACE+BUT_EXTSPACE+BUT_INTSPACE*(nchoices-1);
|
||||||
|
toth+=2*(dri.dri_Ascent+dri.dri_Descent)+TXT_TOPSPACE+
|
||||||
|
TXT_MIDSPACE+TXT_BOTSPACE+BUT_VSPACE;
|
||||||
|
maxw+=TXT_HSPACE+BUT_EXTSPACE+BUT_EXTSPACE;
|
||||||
|
|
||||||
|
if(maxw>totw) {
|
||||||
|
extra=maxw-totw;
|
||||||
|
totw=maxw;
|
||||||
|
}
|
||||||
|
|
||||||
|
mainwin=XCreateSimpleWindow(dpy, root, 0, 0, totw, toth, 1,
|
||||||
|
dri.dri_Pens[SHADOWPEN],
|
||||||
|
dri.dri_Pens[BACKGROUNDPEN]);
|
||||||
|
gc=XCreateGC(dpy, mainwin, 0, NULL);
|
||||||
|
XSetBackground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
|
||||||
|
#ifndef USE_FONTSETS
|
||||||
|
XSetFont(dpy, gc, dri.dri_Font->fid);
|
||||||
|
#endif
|
||||||
|
stipple=XCreatePixmap(dpy, mainwin, 2, 3, attr.depth); // 2, 2
|
||||||
|
XSetForeground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
|
||||||
|
XFillRectangle(dpy, stipple, gc, 0, 0, 1, 1); // 0, 0, 2, 2
|
||||||
|
XSetForeground(dpy, gc, dri.dri_Pens[SHINEPEN]);
|
||||||
|
XDrawPoint(dpy, stipple, gc, 0, 1);
|
||||||
|
XDrawPoint(dpy, stipple, gc, 1, 0);
|
||||||
|
XSetWindowBackgroundPixmap(dpy, mainwin, stipple);
|
||||||
|
textwin=XCreateSimpleWindow(dpy, mainwin, BUT_EXTSPACE, TXT_TOPSPACE, totw-
|
||||||
|
BUT_EXTSPACE-BUT_EXTSPACE, toth-TXT_TOPSPACE-
|
||||||
|
TXT_MIDSPACE-TXT_BOTSPACE-BUT_VSPACE-
|
||||||
|
(dri.dri_Ascent+dri.dri_Descent),
|
||||||
|
0, dri.dri_Pens[SHADOWPEN],
|
||||||
|
dri.dri_Pens[BACKGROUNDPEN]);
|
||||||
|
XSelectInput(dpy, textwin, ExposureMask);
|
||||||
|
x=BUT_EXTSPACE;
|
||||||
|
y=toth-TXT_BOTSPACE-(dri.dri_Ascent+dri.dri_Descent)-BUT_VSPACE;
|
||||||
|
for(c=firstchoice; c; c=c->next) {
|
||||||
|
c->win=XCreateSimpleWindow(dpy, mainwin,
|
||||||
|
x+(nchoices==1? (extra>>1):
|
||||||
|
n++*extra/(nchoices-1)),
|
||||||
|
y, c->w+BUT_BUTSPACE,
|
||||||
|
dri.dri_Ascent+dri.dri_Descent+
|
||||||
|
BUT_VSPACE, 0,
|
||||||
|
dri.dri_Pens[SHADOWPEN],
|
||||||
|
dri.dri_Pens[BACKGROUNDPEN]);
|
||||||
|
XSelectInput(dpy, c->win, ExposureMask|ButtonPressMask|ButtonReleaseMask|
|
||||||
|
EnterWindowMask|LeaveWindowMask);
|
||||||
|
x+=c->w+BUT_BUTSPACE+BUT_INTSPACE;
|
||||||
|
}
|
||||||
|
size_hints.flags = PResizeInc;
|
||||||
|
txtprop1.value=(unsigned char *)"ConfigurationUtility";
|
||||||
|
txtprop2.value=(unsigned char *)"ConfigurationUtility";
|
||||||
|
txtprop2.encoding=txtprop1.encoding=XA_STRING;
|
||||||
|
txtprop2.format=txtprop1.format=8;
|
||||||
|
txtprop1.nitems=strlen((char *)txtprop1.value);
|
||||||
|
txtprop2.nitems=strlen((char *)txtprop2.value);
|
||||||
|
XSetWMProperties(dpy, mainwin, &txtprop1, &txtprop2, argv, argc,
|
||||||
|
&size_hints, NULL, NULL);
|
||||||
|
XMapSubwindows(dpy, mainwin);
|
||||||
|
XMapRaised(dpy, mainwin);
|
||||||
|
for(;;) {
|
||||||
|
XEvent event;
|
||||||
|
XNextEvent(dpy, &event);
|
||||||
|
switch(event.type) {
|
||||||
|
case Expose:
|
||||||
|
if(!event.xexpose.count) {
|
||||||
|
if(event.xexpose.window == textwin)
|
||||||
|
refresh_text();
|
||||||
|
else if((c=getchoice(event.xexpose.window)))
|
||||||
|
refresh_choice(c);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case LeaveNotify:
|
||||||
|
if(depressed && event.xcrossing.window==selected->win) {
|
||||||
|
depressed=0;
|
||||||
|
toggle(selected);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case EnterNotify:
|
||||||
|
if((!depressed) && selected && event.xcrossing.window==selected->win) {
|
||||||
|
depressed=1;
|
||||||
|
toggle(selected);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ButtonPress:
|
||||||
|
if(event.xbutton.button==Button1 &&
|
||||||
|
(c=getchoice(event.xbutton.window))) {
|
||||||
|
abortchoice();
|
||||||
|
depressed=1;
|
||||||
|
toggle(selected=c);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ButtonRelease:
|
||||||
|
if(event.xbutton.button==Button1 && selected) {
|
||||||
|
if(depressed)
|
||||||
|
endchoice();
|
||||||
|
else
|
||||||
|
abortchoice();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FreeArgs(ra);
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
AC_INIT(diskobject.c)
|
AC_INIT
|
||||||
|
AC_CONFIG_SRCDIR([diskobject.c])
|
||||||
|
|
||||||
AC_ENABLE(fontsets,
|
AC_ARG_ENABLE([fontsets],[ --enable-fontsets],[use_fontsets="$enableval"],[use_fontsets=auto])
|
||||||
[use_fontsets="$enableval"], [use_fontsets=auto])
|
|
||||||
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_ISC_POSIX
|
AC_SEARCH_LIBS([strerror],[cposix])
|
||||||
AC_PROG_AWK
|
AC_PROG_AWK
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
AC_PROG_LEX
|
AC_PROG_LEX
|
||||||
@@ -14,7 +14,15 @@ AC_PROG_RANLIB
|
|||||||
|
|
||||||
AC_PATH_XTRA
|
AC_PATH_XTRA
|
||||||
|
|
||||||
AC_HEADER_STDC
|
m4_warn([obsolete],
|
||||||
|
[The preprocessor macro `STDC_HEADERS' is obsolete.
|
||||||
|
Except in unusual embedded environments, you can safely include all
|
||||||
|
ISO C90 headers unconditionally.])dnl
|
||||||
|
# Autoupdate added the next two lines to ensure that your configure
|
||||||
|
# script's behavior did not change. They are probably safe to remove.
|
||||||
|
AC_CHECK_INCLUDES_DEFAULT
|
||||||
|
AC_PROG_EGREP
|
||||||
|
|
||||||
AC_HEADER_SYS_WAIT
|
AC_HEADER_SYS_WAIT
|
||||||
AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h sys/types.h unistd.h sys/select.h sys/resource.h sys/stat.h termio.h)
|
AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h sys/types.h unistd.h sys/select.h sys/resource.h sys/stat.h termio.h)
|
||||||
ac_save_CPPFLAGS="$CPPFLAGS"
|
ac_save_CPPFLAGS="$CPPFLAGS"
|
||||||
@@ -26,11 +34,22 @@ AC_C_CONST
|
|||||||
AC_C_CHAR_UNSIGNED
|
AC_C_CHAR_UNSIGNED
|
||||||
AC_TYPE_PID_T
|
AC_TYPE_PID_T
|
||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
AC_HEADER_TIME
|
|
||||||
AC_STRUCT_TM
|
AC_STRUCT_TM
|
||||||
|
|
||||||
AC_FUNC_ALLOCA
|
AC_FUNC_ALLOCA
|
||||||
AC_TYPE_SIGNAL
|
m4_warn([obsolete],
|
||||||
|
[your code may safely assume C89 semantics that RETSIGTYPE is void.
|
||||||
|
Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl
|
||||||
|
AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM([#include <sys/types.h>
|
||||||
|
#include <signal.h>
|
||||||
|
],
|
||||||
|
[return *(signal (0, 0)) (0) == 1;])],
|
||||||
|
[ac_cv_type_signal=int],
|
||||||
|
[ac_cv_type_signal=void])])
|
||||||
|
AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
|
||||||
|
(`int' or `void').])
|
||||||
|
|
||||||
AC_FUNC_WAIT3
|
AC_FUNC_WAIT3
|
||||||
AC_CHECK_FUNCS(select strdup waitpid)
|
AC_CHECK_FUNCS(select strdup waitpid)
|
||||||
|
|
||||||
@@ -42,13 +61,13 @@ dnl libXt too, so that's what we'll do.
|
|||||||
AC_MSG_CHECKING([for broken libXmu])
|
AC_MSG_CHECKING([for broken libXmu])
|
||||||
old_LIBS="$LIBS"
|
old_LIBS="$LIBS"
|
||||||
LIBS="$X_LIBS $X_PRE_LIBS -lXext -lXmu -lX11 $X_EXTRA_LIBS $LIBS"
|
LIBS="$X_LIBS $X_PRE_LIBS -lXext -lXmu -lX11 $X_EXTRA_LIBS $LIBS"
|
||||||
AC_TRY_LINK([],[
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||||
extern void XmuCopyISOLatin1Lowered(char *,char *);
|
extern void XmuCopyISOLatin1Lowered(char *,char *);
|
||||||
char foo[]="FOO";
|
char foo[]="FOO";
|
||||||
XmuCopyISOLatin1Lowered (foo, foo);
|
XmuCopyISOLatin1Lowered (foo, foo);
|
||||||
], AC_MSG_RESULT([no])
|
]])],[AC_MSG_RESULT(no)
|
||||||
XT_LIB_KLUDGE="", AC_MSG_RESULT([yes])
|
XT_LIB_KLUDGE=""],[AC_MSG_RESULT(yes)
|
||||||
XT_LIB_KLUDGE="-lXt")
|
XT_LIB_KLUDGE="-lXt"])
|
||||||
LIBS="$old_LIBS"
|
LIBS="$old_LIBS"
|
||||||
AC_SUBST(XT_LIB_KLUDGE)
|
AC_SUBST(XT_LIB_KLUDGE)
|
||||||
|
|
||||||
@@ -63,17 +82,17 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([number of arguments to gettimeofday])
|
AC_MSG_CHECKING([number of arguments to gettimeofday])
|
||||||
AC_TRY_LINK([
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef HAVE_SYS_TIME_H
|
#ifdef HAVE_SYS_TIME_H
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
],[
|
]], [[
|
||||||
struct timeval tp;
|
struct timeval tp;
|
||||||
struct timezone tz;
|
struct timezone tz;
|
||||||
gettimeofday(&tp, &tz);
|
gettimeofday(&tp, &tz);
|
||||||
], AC_DEFINE(BSD_STYLE_GETTIMEOFDAY,1,[Define this if gettimeofday() takes two arguments.])
|
]])],[AC_DEFINE(BSD_STYLE_GETTIMEOFDAY,1,Define this if gettimeofday() takes two arguments.)
|
||||||
AC_MSG_RESULT([2]), AC_MSG_RESULT([1]))
|
AC_MSG_RESULT(2)],[AC_MSG_RESULT(1)])
|
||||||
|
|
||||||
AC_CHECK_TYPE(caddr_t, char *)
|
AC_CHECK_TYPE(caddr_t, char *)
|
||||||
AC_MSG_CHECKING([for XPointer])
|
AC_MSG_CHECKING([for XPointer])
|
||||||
@@ -98,7 +117,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([byteorder])
|
AC_MSG_CHECKING([byteorder])
|
||||||
AC_TRY_RUN([
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||||
|
#include <stdlib.h>
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
union { int i; char c[sizeof(int)]; } v;
|
union { int i; char c[sizeof(int)]; } v;
|
||||||
@@ -107,9 +127,10 @@ int main()
|
|||||||
if(v.i==1) exit(0); else exit(1);
|
if(v.i==1) exit(0); else exit(1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
], AC_DEFINE([LAME_ENDIAN],1,[Define this is your achitecture stores integers backwards in memory])
|
]])],[AC_DEFINE(LAME_ENDIAN,1,Define this is your achitecture stores integers backwards in memory)
|
||||||
AC_MSG_RESULT([backward]), AC_MSG_RESULT([normal]), AC_MSG_RESULT([no idea]))
|
AC_MSG_RESULT(backward)],[AC_MSG_RESULT(normal)],[AC_MSG_RESULT(no idea)])
|
||||||
|
|
||||||
AC_SUBST(x_includes)
|
AC_SUBST(x_includes)
|
||||||
AC_SUBST(x_libraries)
|
AC_SUBST(x_libraries)
|
||||||
AC_OUTPUT(Makefile libami/Makefile)
|
AC_CONFIG_FILES([Makefile libami/Makefile])
|
||||||
|
AC_OUTPUT
|
||||||
588
executecmd.c
588
executecmd.c
@@ -21,6 +21,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "drawinfo.h"
|
#include "drawinfo.h"
|
||||||
|
#include "gadget_button.h"
|
||||||
|
#include "gadget_textinput.h"
|
||||||
|
|
||||||
#ifdef AMIGAOS
|
#ifdef AMIGAOS
|
||||||
#include <pragmas/xlib_pragmas.h>
|
#include <pragmas/xlib_pragmas.h>
|
||||||
@@ -30,27 +32,14 @@ extern struct Library *XLibBase;
|
|||||||
#define MAX_CMD_CHARS 256
|
#define MAX_CMD_CHARS 256
|
||||||
#define VISIBLE_CMD_CHARS 35
|
#define VISIBLE_CMD_CHARS 35
|
||||||
|
|
||||||
#define BOT_SPACE 4
|
|
||||||
#define TEXT_SIDE 8
|
|
||||||
#define BUT_SIDE 12
|
|
||||||
#define TOP_SPACE 4
|
|
||||||
#define INT_SPACE 7
|
|
||||||
#define BUT_VSPACE 2
|
|
||||||
#define BUT_HSPACE 8
|
|
||||||
|
|
||||||
static const char ok_txt[]="Ok", cancel_txt[]="Cancel";
|
static const char ok_txt[]="Ok", cancel_txt[]="Cancel";
|
||||||
static const char enter_txt[]="Enter Command and its Arguments:";
|
static const char enter_txt[]="Enter Command and its Arguments:";
|
||||||
static const char cmd_txt[]="Command:";
|
static const char cmd_txt[]="Command:";
|
||||||
|
|
||||||
static int selected=0, depressed=0, stractive=1;
|
static int selected=0, depressed=0, stractive=1;
|
||||||
static Window button[3];
|
|
||||||
static const char *buttxt[]={ NULL, ok_txt, cancel_txt };
|
|
||||||
|
|
||||||
char cmdline[MAX_CMD_CHARS+1];
|
struct gadget_button *buttons[3];
|
||||||
int buf_len=0;
|
struct gadget_textinput *text_input;
|
||||||
int cur_pos=0;
|
|
||||||
int left_pos=0;
|
|
||||||
int cur_x=6;
|
|
||||||
|
|
||||||
char *progname;
|
char *progname;
|
||||||
|
|
||||||
@@ -58,368 +47,121 @@ Display *dpy;
|
|||||||
|
|
||||||
struct DrawInfo dri;
|
struct DrawInfo dri;
|
||||||
|
|
||||||
Window root, mainwin, strwin;
|
Window root, mainwin;
|
||||||
GC gc;
|
GC gc;
|
||||||
|
|
||||||
int strgadw, strgadh, fh, mainw, mainh, butw;
|
int strgadw, strgadh;
|
||||||
|
|
||||||
|
int fh;
|
||||||
|
int mainw, mainh, butw;
|
||||||
|
|
||||||
#ifdef USE_FONTSETS
|
#ifdef USE_FONTSETS
|
||||||
static XIM xim = (XIM) NULL;
|
static XIM xim = (XIM) NULL;
|
||||||
static XIC xic = (XIC) NULL;
|
static XIC xic = (XIC) NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int getchoice(Window w)
|
/*
|
||||||
|
* Loop through the button list and see if we find
|
||||||
|
* a button. Return 0 if we don't find a button.
|
||||||
|
*
|
||||||
|
* Yeah, ideally we'd do this in some gadget / intuition
|
||||||
|
* UI layer thing, but we're not there yet.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
getchoice(Window w)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=1; i<3; i++)
|
for (i=1; i<3; i++) {
|
||||||
if(button[i]==w)
|
if (buttons[i]->w == w)
|
||||||
return i;
|
return i;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void refresh_button(Window w, const char *txt, int idx)
|
|
||||||
{
|
|
||||||
int h=fh+2*BUT_VSPACE, l=strlen(txt);
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
int tw=XmbTextEscapement(dri.dri_FontSet, txt, l);
|
|
||||||
#else
|
|
||||||
int tw=XTextWidth(dri.dri_Font, txt, l);
|
|
||||||
#endif
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
XmbDrawString(dpy, w, dri.dri_FontSet, gc, (butw-tw)>>1,
|
|
||||||
dri.dri_Ascent+BUT_VSPACE, txt, l);
|
|
||||||
#else
|
|
||||||
XDrawString(dpy, w, gc, (butw-tw)>>1,
|
|
||||||
dri.dri_Ascent+BUT_VSPACE, txt, l);
|
|
||||||
#endif
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[(selected==idx && depressed)?
|
|
||||||
SHADOWPEN:SHINEPEN]);
|
|
||||||
XDrawLine(dpy, w, gc, 0, 0, butw-2, 0);
|
|
||||||
XDrawLine(dpy, w, gc, 0, 0, 0, h-2);
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[(selected==idx && depressed)?
|
|
||||||
SHINEPEN:SHADOWPEN]);
|
|
||||||
XDrawLine(dpy, w, gc, 1, h-1, butw-1, h-1);
|
|
||||||
XDrawLine(dpy, w, gc, butw-1, 1, butw-1, h-1);
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
|
|
||||||
XDrawPoint(dpy, w, gc, butw-1, 0);
|
|
||||||
XDrawPoint(dpy, w, gc, 0, h-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void refresh_main(void)
|
|
||||||
{
|
|
||||||
int w;
|
|
||||||
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
XmbDrawString(dpy, mainwin, dri.dri_FontSet, gc, TEXT_SIDE,
|
|
||||||
TOP_SPACE+dri.dri_Ascent, enter_txt, strlen(enter_txt));
|
|
||||||
#else
|
|
||||||
XDrawString(dpy, mainwin, gc, TEXT_SIDE, TOP_SPACE+dri.dri_Ascent,
|
|
||||||
enter_txt, strlen(enter_txt));
|
|
||||||
#endif
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[HIGHLIGHTTEXTPEN]);
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
w=XmbTextEscapement(dri.dri_FontSet, cmd_txt, strlen(cmd_txt));
|
|
||||||
XmbDrawString(dpy, mainwin, dri.dri_FontSet, gc,
|
|
||||||
mainw-strgadw-w-TEXT_SIDE-BUT_SIDE,
|
|
||||||
TOP_SPACE+fh+INT_SPACE+dri.dri_Ascent,
|
|
||||||
cmd_txt, strlen(cmd_txt));
|
|
||||||
#else
|
|
||||||
w=XTextWidth(dri.dri_Font, cmd_txt, strlen(cmd_txt));
|
|
||||||
XDrawString(dpy, mainwin, gc, mainw-strgadw-w-TEXT_SIDE-BUT_SIDE,
|
|
||||||
TOP_SPACE+fh+INT_SPACE+dri.dri_Ascent,
|
|
||||||
cmd_txt, strlen(cmd_txt));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void refresh_str_text(void)
|
|
||||||
{
|
|
||||||
int l, mx=6;
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
|
|
||||||
if(buf_len>left_pos) {
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
int w, c;
|
|
||||||
for(l=0; l<buf_len-left_pos; ) {
|
|
||||||
c=mbrlen(cmdline+left_pos+l, buf_len-left_pos-l, NULL);
|
|
||||||
w=6+XmbTextEscapement(dri.dri_FontSet, cmdline+left_pos, l+c);
|
|
||||||
if(w>strgadw-6)
|
|
||||||
break;
|
|
||||||
mx=w;
|
|
||||||
l+=c;
|
|
||||||
}
|
|
||||||
XmbDrawImageString(dpy, strwin, dri.dri_FontSet, gc, 6, 3+dri.dri_Ascent,
|
|
||||||
cmdline+left_pos, l);
|
|
||||||
#else
|
|
||||||
mx+=XTextWidth(dri.dri_Font, cmdline+left_pos, l=buf_len-left_pos);
|
|
||||||
while(mx>strgadw-6)
|
|
||||||
mx-=XTextWidth(dri.dri_Font, cmdline+left_pos+--l, 1);
|
|
||||||
XDrawImageString(dpy, strwin, gc, 6, 3+dri.dri_Ascent,
|
|
||||||
cmdline+left_pos, l);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
|
|
||||||
XFillRectangle(dpy, strwin, gc, mx, 3, strgadw-mx-6, fh);
|
|
||||||
if(stractive) {
|
|
||||||
if(cur_pos<buf_len) {
|
|
||||||
XSetBackground(dpy, gc, ~0);
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
l=mbrlen(cmdline+cur_pos, buf_len-cur_pos, NULL);
|
|
||||||
XmbDrawImageString(dpy, strwin, dri.dri_FontSet, gc, cur_x,
|
|
||||||
3+dri.dri_Ascent, cmdline+cur_pos, l);
|
|
||||||
#else
|
|
||||||
XDrawImageString(dpy, strwin, gc, cur_x, 3+dri.dri_Ascent,
|
|
||||||
cmdline+cur_pos, 1);
|
|
||||||
#endif
|
|
||||||
XSetBackground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
|
|
||||||
} else {
|
|
||||||
XSetForeground(dpy, gc, ~0);
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
XFillRectangle(dpy, strwin, gc, cur_x, 3,
|
|
||||||
XExtentsOfFontSet(dri.dri_FontSet)->
|
|
||||||
max_logical_extent.width, fh);
|
|
||||||
#else
|
|
||||||
XFillRectangle(dpy, strwin, gc, cur_x, 3,
|
|
||||||
dri.dri_Font->max_bounds.width, fh);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void refresh_str(void)
|
|
||||||
{
|
|
||||||
refresh_str_text();
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[SHINEPEN]);
|
|
||||||
XDrawLine(dpy, strwin, gc, 0, strgadh-1, 0, 0);
|
|
||||||
XDrawLine(dpy, strwin, gc, 0, 0, strgadw-2, 0);
|
|
||||||
XDrawLine(dpy, strwin, gc, 3, strgadh-2, strgadw-4, strgadh-2);
|
|
||||||
XDrawLine(dpy, strwin, gc, strgadw-4, strgadh-2, strgadw-4, 2);
|
|
||||||
XDrawLine(dpy, strwin, gc, 1, 1, 1, strgadh-2);
|
|
||||||
XDrawLine(dpy, strwin, gc, strgadw-3, 1, strgadw-3, strgadh-2);
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[SHADOWPEN]);
|
|
||||||
XDrawLine(dpy, strwin, gc, 1, strgadh-1, strgadw-1, strgadh-1);
|
|
||||||
XDrawLine(dpy, strwin, gc, strgadw-1, strgadh-1, strgadw-1, 0);
|
|
||||||
XDrawLine(dpy, strwin, gc, 3, strgadh-3, 3, 1);
|
|
||||||
XDrawLine(dpy, strwin, gc, 3, 1, strgadw-4, 1);
|
|
||||||
XDrawLine(dpy, strwin, gc, 2, 1, 2, strgadh-2);
|
|
||||||
XDrawLine(dpy, strwin, gc, strgadw-2, 1, strgadw-2, strgadh-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void strkey(XKeyEvent *e)
|
|
||||||
{
|
|
||||||
void endchoice(void);
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
Status stat;
|
|
||||||
#else
|
|
||||||
static XComposeStatus stat;
|
|
||||||
#endif
|
|
||||||
KeySym ks;
|
|
||||||
char buf[256];
|
|
||||||
int x, i, n;
|
|
||||||
#ifndef USE_FONTSETS
|
|
||||||
n=XLookupString(e, buf, sizeof(buf), &ks, &stat);
|
|
||||||
#else
|
|
||||||
n=XmbLookupString(xic, e, buf, sizeof(buf), &ks, &stat);
|
|
||||||
if(stat == XLookupKeySym || stat == XLookupBoth)
|
|
||||||
#endif
|
|
||||||
switch(ks) {
|
|
||||||
case XK_Return:
|
|
||||||
case XK_Linefeed:
|
|
||||||
selected=1;
|
|
||||||
endchoice();
|
|
||||||
break;
|
|
||||||
case XK_Left:
|
|
||||||
if(cur_pos) {
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
int p=cur_pos;
|
|
||||||
int z;
|
|
||||||
while(p>0) {
|
|
||||||
--p;
|
|
||||||
if(((int)mbrlen(cmdline+p, cur_pos-p, NULL))>0) {
|
|
||||||
cur_pos=p;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
refresh_main(void)
|
||||||
|
{
|
||||||
|
int w;
|
||||||
|
|
||||||
|
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
XmbDrawString(dpy, mainwin, dri.dri_FontSet, gc, TEXT_SIDE,
|
||||||
|
TOP_SPACE+dri.dri_Ascent, enter_txt, strlen(enter_txt));
|
||||||
#else
|
#else
|
||||||
--cur_pos;
|
XDrawString(dpy, mainwin, gc, TEXT_SIDE, TOP_SPACE+dri.dri_Ascent,
|
||||||
|
enter_txt, strlen(enter_txt));
|
||||||
#endif
|
#endif
|
||||||
}
|
XSetForeground(dpy, gc, dri.dri_Pens[HIGHLIGHTTEXTPEN]);
|
||||||
break;
|
|
||||||
case XK_Right:
|
|
||||||
if(cur_pos<buf_len) {
|
|
||||||
#ifdef USE_FONTSETS
|
#ifdef USE_FONTSETS
|
||||||
int l=mbrlen(cmdline+cur_pos, buf_len-cur_pos, NULL);
|
w = XmbTextEscapement(dri.dri_FontSet, cmd_txt, strlen(cmd_txt));
|
||||||
if(l>0)
|
XmbDrawString(dpy, mainwin, dri.dri_FontSet, gc,
|
||||||
cur_pos+=l;
|
mainw-strgadw-w-TEXT_SIDE-BUT_SIDE,
|
||||||
|
TOP_SPACE+fh+INT_SPACE+dri.dri_Ascent,
|
||||||
|
cmd_txt, strlen(cmd_txt));
|
||||||
#else
|
#else
|
||||||
cur_pos++;
|
w = XTextWidth(dri.dri_Font, cmd_txt, strlen(cmd_txt));
|
||||||
|
XDrawString(dpy, mainwin, gc, mainw-strgadw-w-TEXT_SIDE-BUT_SIDE,
|
||||||
|
TOP_SPACE+fh+INT_SPACE+dri.dri_Ascent,
|
||||||
|
cmd_txt, strlen(cmd_txt));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case XK_Begin:
|
static void
|
||||||
cur_pos=0;
|
toggle(int c)
|
||||||
break;
|
{
|
||||||
case XK_End:
|
if (c == 0)
|
||||||
cur_pos=buf_len;
|
return;
|
||||||
break;
|
gadget_button_toggle(buttons[c]);
|
||||||
case XK_Delete:
|
}
|
||||||
if(cur_pos<buf_len) {
|
|
||||||
int l=1;
|
static void
|
||||||
#ifdef USE_FONTSETS
|
abortchoice(void)
|
||||||
l=mbrlen(cmdline+cur_pos, buf_len-cur_pos, NULL);
|
{
|
||||||
if(l<=0)
|
if(depressed) {
|
||||||
break;
|
depressed=0;
|
||||||
#endif
|
if (selected > 0) {
|
||||||
buf_len-=l;
|
gadget_button_set_depressed(buttons[selected], 0);
|
||||||
for(x=cur_pos; x<buf_len; x++)
|
}
|
||||||
cmdline[x]=cmdline[x+l];
|
toggle(selected);
|
||||||
cmdline[x] = 0;
|
|
||||||
} else XBell(dpy, 100);
|
|
||||||
break;
|
|
||||||
case XK_BackSpace:
|
|
||||||
if(cur_pos>0) {
|
|
||||||
int l=1;
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
int p=cur_pos;
|
|
||||||
while(p>0) {
|
|
||||||
--p;
|
|
||||||
if(((int)mbrlen(cmdline+p, cur_pos-p, NULL))>0) {
|
|
||||||
l=cur_pos-p;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
selected = 0;
|
||||||
#endif
|
|
||||||
buf_len-=l;
|
|
||||||
for(x=(cur_pos-=l); x<buf_len; x++)
|
|
||||||
cmdline[x]=cmdline[x+l];
|
|
||||||
cmdline[x] = 0;
|
|
||||||
} else XBell(dpy, 100);
|
|
||||||
break;
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
default:
|
|
||||||
if(stat == XLookupBoth)
|
|
||||||
stat = XLookupChars;
|
|
||||||
}
|
|
||||||
if(stat == XLookupChars) {
|
|
||||||
#else
|
|
||||||
default:
|
|
||||||
#endif
|
|
||||||
for(i=0; i<n && buf_len<MAX_CMD_CHARS; i++) {
|
|
||||||
for(x=buf_len; x>cur_pos; --x)
|
|
||||||
cmdline[x]=cmdline[x-1];
|
|
||||||
cmdline[cur_pos++]=buf[i];
|
|
||||||
buf_len++;
|
|
||||||
}
|
|
||||||
if(i<n)
|
|
||||||
XBell(dpy, 100);
|
|
||||||
}
|
|
||||||
if(cur_pos<left_pos)
|
|
||||||
left_pos=cur_pos;
|
|
||||||
cur_x=6;
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
if(cur_pos>left_pos)
|
|
||||||
cur_x+=XmbTextEscapement(dri.dri_FontSet, cmdline+left_pos, cur_pos-left_pos);
|
|
||||||
if(cur_pos<buf_len) {
|
|
||||||
int l=mbrlen(cmdline+cur_pos, buf_len-cur_pos, NULL);
|
|
||||||
x=XmbTextEscapement(dri.dri_FontSet, cmdline+cur_pos, l);
|
|
||||||
} else
|
|
||||||
x=XExtentsOfFontSet(dri.dri_FontSet)->max_logical_extent.width;
|
|
||||||
#else
|
|
||||||
if(cur_pos>left_pos)
|
|
||||||
cur_x+=XTextWidth(dri.dri_Font, cmdline+left_pos, cur_pos-left_pos);
|
|
||||||
if(cur_pos<buf_len)
|
|
||||||
x=XTextWidth(dri.dri_Font, cmdline+cur_pos, 1);
|
|
||||||
else
|
|
||||||
x=dri.dri_Font->max_bounds.width;
|
|
||||||
#endif
|
|
||||||
if((x+=cur_x-(strgadw-6))>0) {
|
|
||||||
cur_x-=x;
|
|
||||||
while(x>0) {
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
int l=mbrlen(cmdline+left_pos, buf_len-left_pos, NULL);
|
|
||||||
x-=XmbTextEscapement(dri.dri_FontSet, cmdline+left_pos, l);
|
|
||||||
left_pos += l;
|
|
||||||
#else
|
|
||||||
x-=XTextWidth(dri.dri_Font, cmdline+left_pos++, 1);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
cur_x+=x;
|
|
||||||
}
|
|
||||||
refresh_str_text();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void strbutton(XButtonEvent *e)
|
static void
|
||||||
|
endchoice(void)
|
||||||
{
|
{
|
||||||
int w, l=1;
|
int c=selected;
|
||||||
stractive=1;
|
|
||||||
cur_pos=left_pos;
|
abortchoice();
|
||||||
cur_x=6;
|
XCloseDisplay(dpy);
|
||||||
while(cur_x<e->x && cur_pos<buf_len) {
|
if(c==1) {
|
||||||
|
system(text_input->buf);
|
||||||
|
}
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
XWindowAttributes attr;
|
||||||
|
static XSizeHints size_hints;
|
||||||
|
static XTextProperty txtprop1, txtprop2;
|
||||||
|
int w2, c;
|
||||||
#ifdef USE_FONTSETS
|
#ifdef USE_FONTSETS
|
||||||
l=mbrlen(cmdline+cur_pos, buf_len-cur_pos, NULL);
|
char *p;
|
||||||
if(l<=0)
|
|
||||||
break;
|
setlocale(LC_CTYPE, "");
|
||||||
w=XmbTextEscapement(dri.dri_FontSet, cmdline+cur_pos, l);
|
|
||||||
#else
|
|
||||||
w=XTextWidth(dri.dri_Font, cmdline+cur_pos, 1);
|
|
||||||
#endif
|
#endif
|
||||||
if(cur_x+w>e->x)
|
progname=argv[0];
|
||||||
break;
|
if(!(dpy = XOpenDisplay(NULL))) {
|
||||||
cur_x+=w;
|
fprintf(stderr, "%s: cannot connect to X server %s\n",
|
||||||
cur_pos+=l;
|
progname, XDisplayName(NULL));
|
||||||
}
|
exit(1);
|
||||||
refresh_str();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void toggle(int c)
|
root = RootWindow(dpy, DefaultScreen(dpy));
|
||||||
{
|
XGetWindowAttributes(dpy, root, &attr);
|
||||||
XSetWindowBackground(dpy, button[c], dri.dri_Pens[(depressed&&c==selected)?
|
init_dri(&dri, dpy, root, attr.colormap, False);
|
||||||
FILLPEN:BACKGROUNDPEN]);
|
|
||||||
XClearWindow(dpy, button[c]);
|
|
||||||
refresh_button(button[c], buttxt[c], c);
|
|
||||||
}
|
|
||||||
|
|
||||||
void abortchoice()
|
|
||||||
{
|
|
||||||
if(depressed) {
|
|
||||||
depressed=0;
|
|
||||||
toggle(selected);
|
|
||||||
}
|
|
||||||
selected=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void endchoice()
|
|
||||||
{
|
|
||||||
int c=selected;
|
|
||||||
|
|
||||||
abortchoice();
|
|
||||||
XCloseDisplay(dpy);
|
|
||||||
if(c==1)
|
|
||||||
system(cmdline);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
XWindowAttributes attr;
|
|
||||||
static XSizeHints size_hints;
|
|
||||||
static XTextProperty txtprop1, txtprop2;
|
|
||||||
Window ok, cancel;
|
|
||||||
int w2, c;
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
setlocale(LC_CTYPE, "");
|
|
||||||
#endif
|
|
||||||
progname=argv[0];
|
|
||||||
if(!(dpy = XOpenDisplay(NULL))) {
|
|
||||||
fprintf(stderr, "%s: cannot connect to X server %s\n", progname,
|
|
||||||
XDisplayName(NULL));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
root = RootWindow(dpy, DefaultScreen(dpy));
|
|
||||||
XGetWindowAttributes(dpy, root, &attr);
|
|
||||||
init_dri(&dri, dpy, root, attr.colormap, False);
|
|
||||||
|
|
||||||
#ifdef USE_FONTSETS
|
#ifdef USE_FONTSETS
|
||||||
strgadw=VISIBLE_CMD_CHARS*XExtentsOfFontSet(dri.dri_FontSet)->
|
strgadw=VISIBLE_CMD_CHARS*XExtentsOfFontSet(dri.dri_FontSet)->
|
||||||
@@ -458,39 +200,6 @@ int main(int argc, char *argv[])
|
|||||||
mainw=w2;
|
mainw=w2;
|
||||||
|
|
||||||
mainh=3*fh+TOP_SPACE+BOT_SPACE+2*INT_SPACE+2*BUT_VSPACE;
|
mainh=3*fh+TOP_SPACE+BOT_SPACE+2*INT_SPACE+2*BUT_VSPACE;
|
||||||
|
|
||||||
mainwin=XCreateSimpleWindow(dpy, root, 20, 20, mainw, mainh, 1,
|
|
||||||
dri.dri_Pens[SHADOWPEN],
|
|
||||||
dri.dri_Pens[BACKGROUNDPEN]);
|
|
||||||
strwin=XCreateSimpleWindow(dpy, mainwin, mainw-BUT_SIDE-strgadw,
|
|
||||||
TOP_SPACE+fh+INT_SPACE-3,
|
|
||||||
strgadw, strgadh, 0,
|
|
||||||
dri.dri_Pens[SHADOWPEN],
|
|
||||||
dri.dri_Pens[BACKGROUNDPEN]);
|
|
||||||
ok=XCreateSimpleWindow(dpy, mainwin, BUT_SIDE,
|
|
||||||
mainh-BOT_SPACE-2*BUT_VSPACE-fh,
|
|
||||||
butw, fh+2*BUT_VSPACE, 0,
|
|
||||||
dri.dri_Pens[SHADOWPEN],
|
|
||||||
dri.dri_Pens[BACKGROUNDPEN]);
|
|
||||||
cancel=XCreateSimpleWindow(dpy, mainwin, mainw-butw-BUT_SIDE,
|
|
||||||
mainh-BOT_SPACE-2*BUT_VSPACE-fh,
|
|
||||||
butw, fh+2*BUT_VSPACE, 0,
|
|
||||||
dri.dri_Pens[SHADOWPEN],
|
|
||||||
dri.dri_Pens[BACKGROUNDPEN]);
|
|
||||||
button[0]=None;
|
|
||||||
button[1]=ok;
|
|
||||||
button[2]=cancel;
|
|
||||||
XSelectInput(dpy, mainwin, ExposureMask|KeyPressMask|ButtonPressMask);
|
|
||||||
XSelectInput(dpy, strwin, ExposureMask|ButtonPressMask);
|
|
||||||
XSelectInput(dpy, ok, ExposureMask|ButtonPressMask|ButtonReleaseMask|
|
|
||||||
EnterWindowMask|LeaveWindowMask);
|
|
||||||
XSelectInput(dpy, cancel, ExposureMask|ButtonPressMask|ButtonReleaseMask|
|
|
||||||
EnterWindowMask|LeaveWindowMask);
|
|
||||||
gc=XCreateGC(dpy, mainwin, 0, NULL);
|
|
||||||
XSetBackground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
|
|
||||||
#ifndef USE_FONTSETS
|
|
||||||
XSetFont(dpy, gc, dri.dri_Font->fid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_FONTSETS
|
#ifdef USE_FONTSETS
|
||||||
if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p)
|
if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p)
|
||||||
@@ -510,6 +219,40 @@ int main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Main window */
|
||||||
|
mainwin=XCreateSimpleWindow(dpy, root, 20, 20, mainw, mainh, 1,
|
||||||
|
dri.dri_Pens[SHADOWPEN],
|
||||||
|
dri.dri_Pens[BACKGROUNDPEN]);
|
||||||
|
gc=XCreateGC(dpy, mainwin, 0, NULL);
|
||||||
|
XSetBackground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
|
||||||
|
#ifndef USE_FONTSETS
|
||||||
|
XSetFont(dpy, gc, dri.dri_Font->fid);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Text input window */
|
||||||
|
text_input = gadget_textinput_create(dpy, &dri, gc, mainwin,
|
||||||
|
mainw-BUT_SIDE-strgadw,
|
||||||
|
TOP_SPACE+fh+INT_SPACE-3,
|
||||||
|
strgadw, strgadh, 256);
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
gadget_textinput_set_xic(text_input, xic);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Create OK button */
|
||||||
|
buttons[1] = gadget_button_init(dpy, &dri, gc, mainwin,
|
||||||
|
BUT_SIDE, mainh-BOT_SPACE-2*BUT_VSPACE-fh, /* x, y */
|
||||||
|
butw, fh+2*BUT_VSPACE); /* width, height */
|
||||||
|
gadget_button_set_text(buttons[1], ok_txt);
|
||||||
|
|
||||||
|
/* Create cancel button */
|
||||||
|
buttons[2] = gadget_button_init(dpy, &dri, gc, mainwin,
|
||||||
|
mainw-butw-BUT_SIDE, mainh-BOT_SPACE-2*BUT_VSPACE-fh, /* x, y */
|
||||||
|
butw, fh+2*BUT_VSPACE); /* width, height */
|
||||||
|
gadget_button_set_text(buttons[2], cancel_txt);
|
||||||
|
|
||||||
|
XSelectInput(dpy, mainwin, ExposureMask|KeyPressMask|ButtonPressMask);
|
||||||
|
|
||||||
size_hints.flags = PResizeInc;
|
size_hints.flags = PResizeInc;
|
||||||
txtprop1.value=(unsigned char *)"Execute a File";
|
txtprop1.value=(unsigned char *)"Execute a File";
|
||||||
txtprop2.value=(unsigned char *)"ExecuteCmd";
|
txtprop2.value=(unsigned char *)"ExecuteCmd";
|
||||||
@@ -529,51 +272,74 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
switch(event.type) {
|
switch(event.type) {
|
||||||
case Expose:
|
case Expose:
|
||||||
if(!event.xexpose.count)
|
if(!event.xexpose.count) {
|
||||||
if(event.xexpose.window == mainwin)
|
if(event.xexpose.window == mainwin)
|
||||||
refresh_main();
|
refresh_main();
|
||||||
else if(event.xexpose.window == strwin)
|
else if(event.xexpose.window == text_input->w)
|
||||||
refresh_str();
|
gadget_textinput_repaint(text_input);
|
||||||
else if(event.xexpose.window == ok)
|
else if(event.xexpose.window == buttons[1]->w) {
|
||||||
refresh_button(ok, ok_txt, 1);
|
gadget_button_refresh(buttons[1]);
|
||||||
else if(event.xexpose.window == cancel)
|
} else if(event.xexpose.window == buttons[2]->w) {
|
||||||
refresh_button(cancel, cancel_txt, 2);
|
gadget_button_refresh(buttons[2]);
|
||||||
case LeaveNotify:
|
}
|
||||||
if(depressed && event.xcrossing.window==button[selected]) {
|
|
||||||
depressed=0;
|
|
||||||
toggle(selected);
|
|
||||||
}
|
}
|
||||||
|
case LeaveNotify:
|
||||||
|
if (depressed) {
|
||||||
|
if ((selected > 0) && event.xcrossing.window == buttons[selected]->w) {
|
||||||
|
depressed = 0;
|
||||||
|
gadget_button_set_depressed(buttons[selected], 0);
|
||||||
|
toggle(selected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case EnterNotify:
|
case EnterNotify:
|
||||||
if((!depressed) && selected && event.xcrossing.window==button[selected]) {
|
if((!depressed) && selected && event.xcrossing.window == buttons[selected]->w) {
|
||||||
depressed=1;
|
depressed = 1;
|
||||||
toggle(selected);
|
gadget_button_set_depressed(buttons[selected], 1);
|
||||||
|
toggle(selected);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
if(event.xbutton.button==Button1) {
|
if(event.xbutton.button==Button1) {
|
||||||
if(stractive && event.xbutton.window!=strwin) {
|
if(stractive && event.xbutton.window!= text_input->w) {
|
||||||
stractive=0;
|
stractive=0;
|
||||||
refresh_str();
|
gadget_textinput_selected(text_input, 0);
|
||||||
|
gadget_textinput_repaint(text_input);
|
||||||
}
|
}
|
||||||
if((c=getchoice(event.xbutton.window))) {
|
if((c=getchoice(event.xbutton.window))) {
|
||||||
abortchoice();
|
abortchoice();
|
||||||
depressed=1;
|
depressed = 1;
|
||||||
toggle(selected=c);
|
selected = c;
|
||||||
} else if(event.xbutton.window==strwin)
|
if (selected > 0) {
|
||||||
strbutton(&event.xbutton);
|
gadget_button_set_depressed(buttons[selected], 1);
|
||||||
|
}
|
||||||
|
toggle(selected);
|
||||||
|
} else if(event.xbutton.window== text_input->w) {
|
||||||
|
gadget_textinput_selected(text_input, 1);
|
||||||
|
gadget_textinput_buttonevent(text_input, &event.xbutton);
|
||||||
|
gadget_textinput_repaint(text_input);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
if(event.xbutton.button==Button1 && selected)
|
if(event.xbutton.button==Button1 && selected) {
|
||||||
if(depressed)
|
if(depressed)
|
||||||
endchoice();
|
endchoice();
|
||||||
else
|
else
|
||||||
abortchoice();
|
abortchoice();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
if(stractive)
|
if(stractive) {
|
||||||
strkey(&event.xkey);
|
gadget_textinput_keyevent(text_input, &event.xkey);
|
||||||
|
gadget_textinput_repaint(text_input);
|
||||||
|
if (gadget_textinput_crlf(text_input)) {
|
||||||
|
selected = 1;
|
||||||
|
endchoice();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
213
frame.c
213
frame.c
@@ -28,7 +28,7 @@ extern Display *dpy;
|
|||||||
extern XContext client_context, screen_context;
|
extern XContext client_context, screen_context;
|
||||||
extern Cursor wm_curs;
|
extern Cursor wm_curs;
|
||||||
extern int shape_extn;
|
extern int shape_extn;
|
||||||
extern void redrawmenubar(Window);
|
extern void redrawmenubar(Scrn *, Window);
|
||||||
void reshape_frame(Client *c);
|
void reshape_frame(Client *c);
|
||||||
|
|
||||||
Window creategadget(Client *c, Window p, int x, int y, int w, int h)
|
Window creategadget(Client *c, Window p, int x, int y, int w, int h)
|
||||||
@@ -102,7 +102,8 @@ void resizeclientwindow(Client *c, int width, int height)
|
|||||||
spread_top_gadgets(c);
|
spread_top_gadgets(c);
|
||||||
if(c->resize)
|
if(c->resize)
|
||||||
XMoveWindow(dpy, c->resize, c->pwidth-18, c->pheight-10);
|
XMoveWindow(dpy, c->resize, c->pwidth-18, c->pheight-10);
|
||||||
XResizeWindow(dpy, c->window, c->pwidth-c->framewidth, c->pheight-c->frameheight);
|
if (!c->fullscreen)
|
||||||
|
XResizeWindow(dpy, c->window, c->pwidth-c->framewidth, c->pheight-c->frameheight);
|
||||||
if(c->shaped)
|
if(c->shaped)
|
||||||
reshape_frame(c);
|
reshape_frame(c);
|
||||||
sendconfig(c);
|
sendconfig(c);
|
||||||
@@ -178,11 +179,18 @@ void reparent(Client *c)
|
|||||||
extern struct mcmd_keygrab *keygrabs;
|
extern struct mcmd_keygrab *keygrabs;
|
||||||
char **cargv = NULL;
|
char **cargv = NULL;
|
||||||
int cargc;
|
int cargc;
|
||||||
|
int size_changed = 0;
|
||||||
|
|
||||||
|
getwmstate(c);
|
||||||
if(XGetTransientForHint(dpy, c->window, &leader) &&
|
if(XGetTransientForHint(dpy, c->window, &leader) &&
|
||||||
!XFindContext(dpy, leader, client_context, (XPointer *)&lc))
|
!XFindContext(dpy, leader, client_context, (XPointer *)&lc) &&
|
||||||
c->scr = lc->scr;
|
lc != NULL) {
|
||||||
else if(XGetTextProperty(dpy, c->window, &screen_prop, amiwm_screen)) {
|
c->leader = lc;
|
||||||
|
if (lc->fsscr != NULL)
|
||||||
|
c->scr = lc->fsscr;
|
||||||
|
else
|
||||||
|
c->scr = lc->scr;
|
||||||
|
} else if(XGetTextProperty(dpy, c->window, &screen_prop, amiwm_screen)) {
|
||||||
do {
|
do {
|
||||||
if(s->root == scr->root &&
|
if(s->root == scr->root &&
|
||||||
(!s->deftitle[screen_prop.nitems])&&!strncmp(s->deftitle,
|
(!s->deftitle[screen_prop.nitems])&&!strncmp(s->deftitle,
|
||||||
@@ -226,15 +234,58 @@ void reparent(Client *c)
|
|||||||
c->framewidth=8;
|
c->framewidth=8;
|
||||||
c->frameheight=scr->bh+2;
|
c->frameheight=scr->bh+2;
|
||||||
attr2.override_redirect=True;
|
attr2.override_redirect=True;
|
||||||
|
|
||||||
|
|
||||||
grav_map_win_to_frame(c, attr.x, attr.y, &c->x, &c->y);
|
grav_map_win_to_frame(c, attr.x, attr.y, &c->x, &c->y);
|
||||||
|
|
||||||
|
/* Note: this is half of framewidth */
|
||||||
|
if ((c->x < 0) || (c->x > scr->width)) {
|
||||||
|
c->x = 0;
|
||||||
|
}
|
||||||
|
/* Note: this is the menu size, but no window framing */
|
||||||
|
if ((c->y < scr->bh) || (c->y > scr->height)) {
|
||||||
|
c->y = scr->bh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check to make sure we're not created larger than the
|
||||||
|
* available desktop size
|
||||||
|
*/
|
||||||
|
if (attr.width > (scr->width - c->framewidth)) {
|
||||||
|
attr.width = (scr->width - c->framewidth);
|
||||||
|
size_changed = 1;
|
||||||
|
}
|
||||||
|
if (attr.height > (scr->height - c->frameheight)) {
|
||||||
|
attr.height = (scr->height - c->frameheight);
|
||||||
|
size_changed = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
c->pwidth = attr.width + c->framewidth;
|
||||||
|
c->pheight = attr.height + c->frameheight;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note: if we adjusted c->pwidth / c->pheight then
|
||||||
|
* we need to call XResizeWindow on c->window.
|
||||||
|
*
|
||||||
|
* Do it before we reparent it just to make things
|
||||||
|
* easy.
|
||||||
|
*/
|
||||||
|
if (size_changed == 1) {
|
||||||
|
XResizeWindow(dpy, c->window, c->pwidth-c->framewidth,
|
||||||
|
c->pheight-c->frameheight);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create the parent window that'll have our decoration */
|
||||||
c->parent=XCreateWindow(dpy, scr->back, c->x, c->y,
|
c->parent=XCreateWindow(dpy, scr->back, c->x, c->y,
|
||||||
c->pwidth=attr.width+8, c->pheight=attr.height+2+scr->bh,
|
c->pwidth, c->pheight,
|
||||||
0, CopyFromParent, InputOutput, CopyFromParent,
|
0, CopyFromParent, InputOutput, CopyFromParent,
|
||||||
CWOverrideRedirect, &attr2);
|
CWOverrideRedirect, &attr2);
|
||||||
XSaveContext(dpy, c->parent, client_context, (XPointer)c);
|
XSaveContext(dpy, c->parent, client_context, (XPointer)c);
|
||||||
XSaveContext(dpy, c->parent, screen_context, (XPointer)c->scr);
|
XSaveContext(dpy, c->parent, screen_context, (XPointer)c->scr);
|
||||||
XSetWindowBackground(dpy, c->parent, scr->dri.dri_Pens[BACKGROUNDPEN]);
|
XSetWindowBackground(dpy, c->parent, scr->dri.dri_Pens[BACKGROUNDPEN]);
|
||||||
XSetWindowBorderWidth(dpy, c->window, 0);
|
XSetWindowBorderWidth(dpy, c->window, 0);
|
||||||
|
|
||||||
|
/* Reparent time */
|
||||||
XReparentWindow(dpy, c->window, c->parent, 4, scr->bh);
|
XReparentWindow(dpy, c->window, c->parent, 4, scr->bh);
|
||||||
XSelectInput(dpy, c->window, EnterWindowMask | LeaveWindowMask |
|
XSelectInput(dpy, c->window, EnterWindowMask | LeaveWindowMask |
|
||||||
ColormapChangeMask | PropertyChangeMask |
|
ColormapChangeMask | PropertyChangeMask |
|
||||||
@@ -249,11 +300,12 @@ void reparent(Client *c)
|
|||||||
for(kg=keygrabs; kg; kg=kg->next)
|
for(kg=keygrabs; kg; kg=kg->next)
|
||||||
XGrabKey(dpy, kg->keycode, kg->modifiers, c->window, False, GrabModeAsync,
|
XGrabKey(dpy, kg->keycode, kg->modifiers, c->window, False, GrabModeAsync,
|
||||||
GrabModeAsync);
|
GrabModeAsync);
|
||||||
cb=(resizable(&c->sizehints)? prefs.sizeborder:0);
|
cb=(resizable(c->sizehints)? prefs.sizeborder:0);
|
||||||
c->close=creategadget(c, c->parent, 0, 0, 19, scr->bh);
|
c->close=creategadget(c, c->parent, 0, 0, 19, scr->bh);
|
||||||
c->drag=creategadget(c, c->parent, 19, 0, 1, 1);
|
c->drag=creategadget(c, c->parent, 19, 0, 1, 1);
|
||||||
if(c->wflags&WF_NOICONIFY)
|
if(c->wflags&WF_NOICONIFY || c->leader != NULL) {
|
||||||
c->iconify=None;
|
c->iconify=None;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
c->iconify=creategadget(c, c->parent, 0, 0, 23, scr->bh);
|
c->iconify=creategadget(c, c->parent, 0, 0, 23, scr->bh);
|
||||||
if(cb)
|
if(cb)
|
||||||
@@ -276,7 +328,8 @@ void reparent(Client *c)
|
|||||||
#endif
|
#endif
|
||||||
XMapSubwindows(dpy, c->parent);
|
XMapSubwindows(dpy, c->parent);
|
||||||
sendconfig(c);
|
sendconfig(c);
|
||||||
setstringprop(c->window, amiwm_screen, scr->deftitle);
|
if (scr->deftitle != NULL)
|
||||||
|
setstringprop(c->window, amiwm_screen, scr->deftitle);
|
||||||
if(prefs.focus == FOC_CLICKTOTYPE)
|
if(prefs.focus == FOC_CLICKTOTYPE)
|
||||||
XGrabButton(dpy, Button1, AnyModifier, c->parent, True,
|
XGrabButton(dpy, Button1, AnyModifier, c->parent, True,
|
||||||
ButtonPressMask, GrabModeSync, GrabModeAsync, None, wm_curs);
|
ButtonPressMask, GrabModeSync, GrabModeAsync, None, wm_curs);
|
||||||
@@ -466,7 +519,7 @@ void clickenter()
|
|||||||
{
|
{
|
||||||
if((scr=mbdscr)&& clickwindow == scr->menubardepth) {
|
if((scr=mbdscr)&& clickwindow == scr->menubardepth) {
|
||||||
mbdclick = scr;
|
mbdclick = scr;
|
||||||
redrawmenubar(scr->menubardepth);
|
redrawmenubar(scr, scr->menubardepth);
|
||||||
} else {
|
} else {
|
||||||
scr = clickclient->scr;
|
scr = clickclient->scr;
|
||||||
redraw(clickclient, clickclient->clicked=clickwindow);
|
redraw(clickclient, clickclient->clicked=clickwindow);
|
||||||
@@ -477,7 +530,7 @@ void clickleave()
|
|||||||
{
|
{
|
||||||
if((scr=mbdscr)&& clickwindow == scr->menubardepth) {
|
if((scr=mbdscr)&& clickwindow == scr->menubardepth) {
|
||||||
mbdclick = NULL;
|
mbdclick = NULL;
|
||||||
redrawmenubar(scr->menubardepth);
|
redrawmenubar(scr, scr->menubardepth);
|
||||||
} else {
|
} else {
|
||||||
scr = clickclient->scr;
|
scr = clickclient->scr;
|
||||||
clickclient->clicked=None;
|
clickclient->clicked=None;
|
||||||
@@ -547,6 +600,133 @@ void raiselowerclient(Client *c, int place)
|
|||||||
} else XRaiseWindow(dpy, c->parent);
|
} else XRaiseWindow(dpy, c->parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void setfocus(Window);
|
||||||
|
extern Client *activeclient;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Lower the top most client.
|
||||||
|
*
|
||||||
|
* Update focus if required.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
lowertopmostclient(Scrn *scr)
|
||||||
|
{
|
||||||
|
Window r, p, *children;
|
||||||
|
unsigned int nchildren;
|
||||||
|
Client *c_top, *c_bot;
|
||||||
|
Window ws[2];
|
||||||
|
|
||||||
|
/* Query the list of windows under the active screen */
|
||||||
|
if (XQueryTree(dpy, scr->back, &r, &p, &children, &nchildren) == 0) {
|
||||||
|
fprintf(stderr, "%s: couldn't fetch the window list\n", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Grab the top most client
|
||||||
|
*/
|
||||||
|
c_top = topmostmappedclient(children, nchildren);
|
||||||
|
if (c_top == NULL) {
|
||||||
|
fprintf(stderr, "%s: couldn't get the top most mapped client\n", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* And the bottom most client.
|
||||||
|
*/
|
||||||
|
c_bot = bottommostmappedclient(children, nchildren);
|
||||||
|
if (c_bot == NULL) {
|
||||||
|
fprintf(stderr, "%s: couldn't get the bottom most mapped client\n", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we're doing click-to-focus, mark the old top-most window
|
||||||
|
* as inactive; mark the new top-most window as active and has focus.
|
||||||
|
*/
|
||||||
|
if (prefs.focus == FOC_CLICKTOTYPE) {
|
||||||
|
c_top->active = False;
|
||||||
|
c_bot->active = True;
|
||||||
|
activeclient = c_bot;
|
||||||
|
redrawclient(c_bot);
|
||||||
|
redrawclient(c_top);
|
||||||
|
setfocus(c_bot->window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Push this to the bottom of the stack.
|
||||||
|
*/
|
||||||
|
ws[0]=c_bot->parent;
|
||||||
|
ws[1]=c_top->parent;
|
||||||
|
XRestackWindows(dpy, ws, 2);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Free the children list.
|
||||||
|
*/
|
||||||
|
if (children)
|
||||||
|
XFree(children);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Raise the bottom most client.
|
||||||
|
*
|
||||||
|
* Update focus if required.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
raisebottommostclient(Scrn *scr)
|
||||||
|
{
|
||||||
|
Window r, p, *children;
|
||||||
|
unsigned int nchildren;
|
||||||
|
Client *c_top, *c_bot;
|
||||||
|
|
||||||
|
/* Query the list of windows under the active screen */
|
||||||
|
if (XQueryTree(dpy, scr->back, &r, &p, &children, &nchildren) == 0) {
|
||||||
|
fprintf(stderr, "%s: couldn't fetch the window list\n", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Grab the top most client
|
||||||
|
*/
|
||||||
|
c_top = topmostmappedclient(children, nchildren);
|
||||||
|
if (c_top == NULL) {
|
||||||
|
fprintf(stderr, "%s: couldn't get the top most mapped client\n", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* And the bottom most client.
|
||||||
|
*/
|
||||||
|
c_bot = bottommostmappedclient(children, nchildren);
|
||||||
|
if (c_bot == NULL) {
|
||||||
|
fprintf(stderr, "%s: couldn't get the bottom most mapped client\n", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we're doing click-to-focus, mark the old top-most window
|
||||||
|
* as inactive; mark the new top-most window as active and has focus.
|
||||||
|
*/
|
||||||
|
if (prefs.focus == FOC_CLICKTOTYPE) {
|
||||||
|
c_top->active = False;
|
||||||
|
c_bot->active = True;
|
||||||
|
activeclient = c_bot;
|
||||||
|
redrawclient(c_bot);
|
||||||
|
redrawclient(c_top);
|
||||||
|
setfocus(c_bot->window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Raise the selected window to the top */
|
||||||
|
XRaiseWindow(dpy, c_bot->parent);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Free the children list.
|
||||||
|
*/
|
||||||
|
if (children)
|
||||||
|
XFree(children);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void gadgetunclicked(Client *c, XEvent *e)
|
void gadgetunclicked(Client *c, XEvent *e)
|
||||||
{
|
{
|
||||||
extern void adjusticon(Icon *);
|
extern void adjusticon(Icon *);
|
||||||
@@ -574,16 +754,7 @@ void gadgetunclicked(Client *c, XEvent *e)
|
|||||||
/* XWarpPointer(dpy, None, c->zoom, 0, 0, 0, 0, 23/2, scr->h5); */
|
/* XWarpPointer(dpy, None, c->zoom, 0, 0, 0, 0, 23/2, scr->h5); */
|
||||||
sendconfig(c);
|
sendconfig(c);
|
||||||
} else if(w==c->iconify) {
|
} else if(w==c->iconify) {
|
||||||
if(!(c->icon))
|
iconify(c);
|
||||||
createicon(c);
|
|
||||||
XUnmapWindow(dpy, c->parent);
|
|
||||||
/* XUnmapWindow(dpy, c->window); */
|
|
||||||
adjusticon(c->icon);
|
|
||||||
XMapWindow(dpy, c->icon->window);
|
|
||||||
if(c->icon->labelwidth)
|
|
||||||
XMapWindow(dpy, c->icon->labelwin);
|
|
||||||
c->icon->mapped=1;
|
|
||||||
setclientstate(c, IconicState);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clickwindow=None;
|
clickwindow=None;
|
||||||
|
|||||||
195
gram.h
195
gram.h
@@ -1,195 +0,0 @@
|
|||||||
/* A Bison parser, made by GNU Bison 3.0.4. */
|
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
|
||||||
|
|
||||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
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 3 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, see <http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* As a special exception, you may create a larger work that contains
|
|
||||||
part or all of the Bison parser skeleton and distribute that work
|
|
||||||
under terms of your choice, so long as that work isn't itself a
|
|
||||||
parser generator using the skeleton or a modified version thereof
|
|
||||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
|
||||||
the parser skeleton itself, you may (at your option) remove this
|
|
||||||
special exception, which will cause the skeleton and the resulting
|
|
||||||
Bison output files to be licensed under the GNU General Public
|
|
||||||
License without this special exception.
|
|
||||||
|
|
||||||
This special exception was added by the Free Software Foundation in
|
|
||||||
version 2.2 of Bison. */
|
|
||||||
|
|
||||||
#ifndef YY_YY_Y_TAB_H_INCLUDED
|
|
||||||
# define YY_YY_Y_TAB_H_INCLUDED
|
|
||||||
/* Debug traces. */
|
|
||||||
#ifndef YYDEBUG
|
|
||||||
# define YYDEBUG 0
|
|
||||||
#endif
|
|
||||||
#if YYDEBUG
|
|
||||||
extern int yydebug;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Token type. */
|
|
||||||
#ifndef YYTOKENTYPE
|
|
||||||
# define YYTOKENTYPE
|
|
||||||
enum yytokentype
|
|
||||||
{
|
|
||||||
ERRORTOKEN = 258,
|
|
||||||
LEFTBRACE = 259,
|
|
||||||
RIGHTBRACE = 260,
|
|
||||||
YES = 261,
|
|
||||||
NO = 262,
|
|
||||||
RIGHT = 263,
|
|
||||||
BOTTOM = 264,
|
|
||||||
BOTH = 265,
|
|
||||||
NONE = 266,
|
|
||||||
MAGICWB = 267,
|
|
||||||
SYSTEM = 268,
|
|
||||||
SCHWARTZ = 269,
|
|
||||||
ALWAYS = 270,
|
|
||||||
AUTO = 271,
|
|
||||||
MANUAL = 272,
|
|
||||||
SEPARATOR = 273,
|
|
||||||
T_DETAILPEN = 274,
|
|
||||||
T_BLOCKPEN = 275,
|
|
||||||
T_TEXTPEN = 276,
|
|
||||||
T_SHINEPEN = 277,
|
|
||||||
T_SHADOWPEN = 278,
|
|
||||||
T_FILLPEN = 279,
|
|
||||||
T_FILLTEXTPEN = 280,
|
|
||||||
T_BACKGROUNDPEN = 281,
|
|
||||||
T_HIGHLIGHTTEXTPEN = 282,
|
|
||||||
T_BARDETAILPEN = 283,
|
|
||||||
T_BARBLOCKPEN = 284,
|
|
||||||
T_BARTRIMPEN = 285,
|
|
||||||
FASTQUIT = 286,
|
|
||||||
SIZEBORDER = 287,
|
|
||||||
DEFAULTICON = 288,
|
|
||||||
ICONDIR = 289,
|
|
||||||
ICONPALETTE = 290,
|
|
||||||
SCREENFONT = 291,
|
|
||||||
ICONFONT = 292,
|
|
||||||
TOOLITEM = 293,
|
|
||||||
FORCEMOVE = 294,
|
|
||||||
SCREEN = 295,
|
|
||||||
MODULE = 296,
|
|
||||||
MODULEPATH = 297,
|
|
||||||
INTERSCREENGAP = 298,
|
|
||||||
AUTORAISE = 299,
|
|
||||||
FOCUS = 300,
|
|
||||||
FOLLOWMOUSE = 301,
|
|
||||||
CLICKTOTYPE = 302,
|
|
||||||
SLOPPY = 303,
|
|
||||||
CUSTOMICONSONLY = 304,
|
|
||||||
TITLEBARCLOCK = 305,
|
|
||||||
TITLECLOCKFORMAT = 306,
|
|
||||||
OPAQUEMOVE = 307,
|
|
||||||
OPAQUERESIZE = 308,
|
|
||||||
SCREENMENU = 309,
|
|
||||||
STYLE = 310,
|
|
||||||
CLASS = 311,
|
|
||||||
TITLE = 312,
|
|
||||||
ICONTITLE = 313,
|
|
||||||
ICON = 314,
|
|
||||||
SHORTLABELICONS = 315,
|
|
||||||
STRING = 316,
|
|
||||||
NUMBER = 317
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
/* Tokens. */
|
|
||||||
#define ERRORTOKEN 258
|
|
||||||
#define LEFTBRACE 259
|
|
||||||
#define RIGHTBRACE 260
|
|
||||||
#define YES 261
|
|
||||||
#define NO 262
|
|
||||||
#define RIGHT 263
|
|
||||||
#define BOTTOM 264
|
|
||||||
#define BOTH 265
|
|
||||||
#define NONE 266
|
|
||||||
#define MAGICWB 267
|
|
||||||
#define SYSTEM 268
|
|
||||||
#define SCHWARTZ 269
|
|
||||||
#define ALWAYS 270
|
|
||||||
#define AUTO 271
|
|
||||||
#define MANUAL 272
|
|
||||||
#define SEPARATOR 273
|
|
||||||
#define T_DETAILPEN 274
|
|
||||||
#define T_BLOCKPEN 275
|
|
||||||
#define T_TEXTPEN 276
|
|
||||||
#define T_SHINEPEN 277
|
|
||||||
#define T_SHADOWPEN 278
|
|
||||||
#define T_FILLPEN 279
|
|
||||||
#define T_FILLTEXTPEN 280
|
|
||||||
#define T_BACKGROUNDPEN 281
|
|
||||||
#define T_HIGHLIGHTTEXTPEN 282
|
|
||||||
#define T_BARDETAILPEN 283
|
|
||||||
#define T_BARBLOCKPEN 284
|
|
||||||
#define T_BARTRIMPEN 285
|
|
||||||
#define FASTQUIT 286
|
|
||||||
#define SIZEBORDER 287
|
|
||||||
#define DEFAULTICON 288
|
|
||||||
#define ICONDIR 289
|
|
||||||
#define ICONPALETTE 290
|
|
||||||
#define SCREENFONT 291
|
|
||||||
#define ICONFONT 292
|
|
||||||
#define TOOLITEM 293
|
|
||||||
#define FORCEMOVE 294
|
|
||||||
#define SCREEN 295
|
|
||||||
#define MODULE 296
|
|
||||||
#define MODULEPATH 297
|
|
||||||
#define INTERSCREENGAP 298
|
|
||||||
#define AUTORAISE 299
|
|
||||||
#define FOCUS 300
|
|
||||||
#define FOLLOWMOUSE 301
|
|
||||||
#define CLICKTOTYPE 302
|
|
||||||
#define SLOPPY 303
|
|
||||||
#define CUSTOMICONSONLY 304
|
|
||||||
#define TITLEBARCLOCK 305
|
|
||||||
#define TITLECLOCKFORMAT 306
|
|
||||||
#define OPAQUEMOVE 307
|
|
||||||
#define OPAQUERESIZE 308
|
|
||||||
#define SCREENMENU 309
|
|
||||||
#define STYLE 310
|
|
||||||
#define CLASS 311
|
|
||||||
#define TITLE 312
|
|
||||||
#define ICONTITLE 313
|
|
||||||
#define ICON 314
|
|
||||||
#define SHORTLABELICONS 315
|
|
||||||
#define STRING 316
|
|
||||||
#define NUMBER 317
|
|
||||||
|
|
||||||
/* Value type. */
|
|
||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
|
||||||
|
|
||||||
union YYSTYPE
|
|
||||||
{
|
|
||||||
#line 50 "gram.y" /* yacc.c:1909 */
|
|
||||||
|
|
||||||
int num;
|
|
||||||
char *ptr;
|
|
||||||
|
|
||||||
#line 183 "y.tab.h" /* yacc.c:1909 */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef union YYSTYPE YYSTYPE;
|
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
extern YYSTYPE yylval;
|
|
||||||
|
|
||||||
int yyparse (void);
|
|
||||||
|
|
||||||
#endif /* !YY_YY_Y_TAB_H_INCLUDED */
|
|
||||||
26
gram.y
26
gram.y
@@ -13,7 +13,6 @@ extern void set_mwb_palette(void);
|
|||||||
extern void set_schwartz_palette(void);
|
extern void set_schwartz_palette(void);
|
||||||
extern void set_custom_palette(char *fn);
|
extern void set_custom_palette(char *fn);
|
||||||
extern void add_toolitem(char *, char *, char *, int);
|
extern void add_toolitem(char *, char *, char *, int);
|
||||||
extern Scrn *openscreen(char *, Window);
|
|
||||||
extern void create_module(Scrn *, char *, char *);
|
extern void create_module(Scrn *, char *, char *);
|
||||||
extern char *default_colors[NUMDRIPENS];
|
extern char *default_colors[NUMDRIPENS];
|
||||||
extern char *default_screenfont, *label_font_name;
|
extern char *default_screenfont, *label_font_name;
|
||||||
@@ -44,6 +43,17 @@ static void append_to(char **x, char *y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int ti_level=0;
|
static int ti_level=0;
|
||||||
|
|
||||||
|
int yylex();
|
||||||
|
|
||||||
|
extern char *progname;
|
||||||
|
extern int ParseError;
|
||||||
|
int yyerror(s) char *s;
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: error in input file: %s\n", progname, s ? s : "");
|
||||||
|
ParseError = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%union
|
%union
|
||||||
@@ -66,6 +76,7 @@ static int ti_level=0;
|
|||||||
%token <num> INTERSCREENGAP AUTORAISE FOCUS FOLLOWMOUSE CLICKTOTYPE SLOPPY
|
%token <num> INTERSCREENGAP AUTORAISE FOCUS FOLLOWMOUSE CLICKTOTYPE SLOPPY
|
||||||
%token <num> CUSTOMICONSONLY
|
%token <num> CUSTOMICONSONLY
|
||||||
%token <num> TITLEBARCLOCK TITLECLOCKFORMAT
|
%token <num> TITLEBARCLOCK TITLECLOCKFORMAT
|
||||||
|
%token <num> BATTERYINFO
|
||||||
%token <num> OPAQUEMOVE OPAQUERESIZE SCREENMENU STYLE CLASS TITLE ICONTITLE ICON
|
%token <num> OPAQUEMOVE OPAQUERESIZE SCREENMENU STYLE CLASS TITLE ICONTITLE ICON
|
||||||
%token <num> SHORTLABELICONS
|
%token <num> SHORTLABELICONS
|
||||||
%token <ptr> STRING
|
%token <ptr> STRING
|
||||||
@@ -103,8 +114,8 @@ stmt : error
|
|||||||
| SCREEN string { openscreen($2,DefaultRootWindow(dpy)); }
|
| SCREEN string { openscreen($2,DefaultRootWindow(dpy)); }
|
||||||
| SCREEN NUMBER string { if(($2==DefaultScreen(dpy)||prefs.manage_all) && $2<ScreenCount(dpy)) openscreen($3,RootWindow(dpy,$2)); }
|
| SCREEN NUMBER string { if(($2==DefaultScreen(dpy)||prefs.manage_all) && $2<ScreenCount(dpy)) openscreen($3,RootWindow(dpy,$2)); }
|
||||||
| MODULEPATH string { prefs.module_path = $2; }
|
| MODULEPATH string { prefs.module_path = $2; }
|
||||||
| MODULE string STRING { create_module((front? front->upfront:NULL), $2, $3); }
|
| MODULE string STRING { create_module((get_front_scr() ? get_front_scr()->upfront:NULL), $2, $3); }
|
||||||
| MODULE string { create_module((front? front->upfront:NULL), $2, NULL); }
|
| MODULE string { create_module((get_front_scr() ? get_front_scr()->upfront:NULL), $2, NULL); }
|
||||||
| INTERSCREENGAP NUMBER { prefs.borderwidth=$2; }
|
| INTERSCREENGAP NUMBER { prefs.borderwidth=$2; }
|
||||||
| AUTORAISE truth { prefs.autoraise=$2; }
|
| AUTORAISE truth { prefs.autoraise=$2; }
|
||||||
| OPAQUEMOVE truth { prefs.opaquemove=$2; }
|
| OPAQUEMOVE truth { prefs.opaquemove=$2; }
|
||||||
@@ -118,6 +129,7 @@ stmt : error
|
|||||||
prefs.titleclockinterval=$2;
|
prefs.titleclockinterval=$2;
|
||||||
prefs.titleclockformat=$3; }
|
prefs.titleclockformat=$3; }
|
||||||
| SCREENMENU truth { prefs.screenmenu=$2; }
|
| SCREENMENU truth { prefs.screenmenu=$2; }
|
||||||
|
| BATTERYINFO truth { prefs.battery_info = $2; }
|
||||||
| stylespec styleitems RIGHTBRACE
|
| stylespec styleitems RIGHTBRACE
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -195,11 +207,3 @@ forcemove_policy : ALWAYS { $$ = FM_ALWAYS; }
|
|||||||
;
|
;
|
||||||
|
|
||||||
%%
|
%%
|
||||||
extern char *progname;
|
|
||||||
extern int ParseError;
|
|
||||||
int yyerror(s) char *s;
|
|
||||||
{
|
|
||||||
fprintf (stderr, "%s: error in input file: %s\n", progname, s ? s : "");
|
|
||||||
ParseError = 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|||||||
86
icc.c
86
icc.c
@@ -5,7 +5,9 @@
|
|||||||
#include "style.h"
|
#include "style.h"
|
||||||
#include "prefs.h"
|
#include "prefs.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef AMIGAOS
|
#ifdef AMIGAOS
|
||||||
#include <pragmas/xlib_pragmas.h>
|
#include <pragmas/xlib_pragmas.h>
|
||||||
@@ -14,14 +16,17 @@ extern struct Library *XLibBase;
|
|||||||
|
|
||||||
extern void redraw(Client *, Window);
|
extern void redraw(Client *, Window);
|
||||||
|
|
||||||
|
Atom utf8_string, net_wm_name;
|
||||||
Atom wm_state, wm_change_state, wm_protocols, wm_delete, wm_take_focus;
|
Atom wm_state, wm_change_state, wm_protocols, wm_delete, wm_take_focus;
|
||||||
Atom wm_colormaps, wm_name, wm_normal_hints, wm_hints, wm_icon_name, wm_class;
|
Atom wm_colormaps, wm_name, wm_normal_hints, wm_hints, wm_icon_name, wm_class;
|
||||||
|
Atom net_supporting_wm_check, net_supported, net_wm_state, net_wm_state_fullscreen;
|
||||||
Atom amiwm_screen, swm_vroot, amiwm_wflags, amiwm_appiconmsg, amiwm_appwindowmsg;
|
Atom amiwm_screen, swm_vroot, amiwm_wflags, amiwm_appiconmsg, amiwm_appwindowmsg;
|
||||||
|
|
||||||
extern Display *dpy;
|
extern Display *dpy;
|
||||||
|
|
||||||
void init_atoms()
|
void init_atoms()
|
||||||
{
|
{
|
||||||
|
utf8_string = XInternAtom(dpy, "UTF8_STRING", False);
|
||||||
wm_state = XInternAtom(dpy, "WM_STATE", False);
|
wm_state = XInternAtom(dpy, "WM_STATE", False);
|
||||||
wm_change_state = XInternAtom(dpy, "WM_CHANGE_STATE", False);
|
wm_change_state = XInternAtom(dpy, "WM_CHANGE_STATE", False);
|
||||||
wm_protocols = XInternAtom(dpy, "WM_PROTOCOLS", False);
|
wm_protocols = XInternAtom(dpy, "WM_PROTOCOLS", False);
|
||||||
@@ -33,6 +38,11 @@ void init_atoms()
|
|||||||
wm_hints = XInternAtom(dpy, "WM_HINTS", False);
|
wm_hints = XInternAtom(dpy, "WM_HINTS", False);
|
||||||
wm_icon_name = XInternAtom(dpy, "WM_ICON_NAME", False);
|
wm_icon_name = XInternAtom(dpy, "WM_ICON_NAME", False);
|
||||||
wm_class = XInternAtom(dpy, "WM_CLASS", False);
|
wm_class = XInternAtom(dpy, "WM_CLASS", False);
|
||||||
|
net_supported = XInternAtom(dpy, "_NET_SUPPORTED", False);
|
||||||
|
net_supporting_wm_check = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
|
||||||
|
net_wm_name = XInternAtom(dpy, "_NET_WM_NAME", False);
|
||||||
|
net_wm_state = XInternAtom(dpy, "_NET_WM_STATE", False);
|
||||||
|
net_wm_state_fullscreen = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
|
||||||
amiwm_screen = XInternAtom(dpy, "AMIWM_SCREEN", False);
|
amiwm_screen = XInternAtom(dpy, "AMIWM_SCREEN", False);
|
||||||
swm_vroot = XInternAtom(dpy, "__SWM_VROOT", False);
|
swm_vroot = XInternAtom(dpy, "__SWM_VROOT", False);
|
||||||
amiwm_wflags = XInternAtom(dpy, "AMIWM_WFLAGS", False);
|
amiwm_wflags = XInternAtom(dpy, "AMIWM_WFLAGS", False);
|
||||||
@@ -40,6 +50,23 @@ void init_atoms()
|
|||||||
amiwm_appwindowmsg = XInternAtom(dpy, "AMIWM_APPWINDOWMSG", False);
|
amiwm_appwindowmsg = XInternAtom(dpy, "AMIWM_APPWINDOWMSG", False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setsupports(Window root, Window checkwin)
|
||||||
|
{
|
||||||
|
Atom atoms[] = {
|
||||||
|
net_wm_state,
|
||||||
|
net_wm_state_fullscreen,
|
||||||
|
};
|
||||||
|
XChangeProperty(dpy, root, net_supported, XA_ATOM, 32,
|
||||||
|
PropModeReplace, (unsigned char *)atoms,
|
||||||
|
sizeof(atoms)/sizeof(atoms[0]));
|
||||||
|
XChangeProperty(dpy, root, net_supporting_wm_check, XA_WINDOW, 32,
|
||||||
|
PropModeReplace, (void *)(Window[]){checkwin}, 1);
|
||||||
|
XChangeProperty(dpy, checkwin, net_supporting_wm_check, XA_WINDOW, 32,
|
||||||
|
PropModeReplace, (void *)(Window[]){checkwin}, 1);
|
||||||
|
XChangeProperty(dpy, checkwin, net_wm_name, utf8_string, 8,
|
||||||
|
PropModeReplace, (void *)"AmiWM", 5);
|
||||||
|
}
|
||||||
|
|
||||||
void setstringprop(Window w, Atom a, char *str)
|
void setstringprop(Window w, Atom a, char *str)
|
||||||
{
|
{
|
||||||
XTextProperty txtp;
|
XTextProperty txtp;
|
||||||
@@ -51,20 +78,39 @@ void setstringprop(Window w, Atom a, char *str)
|
|||||||
XSetTextProperty(dpy, w, &txtp, a);
|
XSetTextProperty(dpy, w, &txtp, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
XEvent *mkcmessage(Window w, Atom a, long x)
|
void getwmstate(Client *c)
|
||||||
{
|
{
|
||||||
static XEvent ev;
|
Atom *p;
|
||||||
|
int i;
|
||||||
|
long n;
|
||||||
|
Window w;
|
||||||
|
|
||||||
memset(&ev, 0, sizeof(ev));
|
w = c->window;
|
||||||
ev.xclient.type = ClientMessage;
|
if ((n = _getprop(w, net_wm_state, XA_ATOM, 20L, (char**)&p)) < 0)
|
||||||
ev.xclient.window = w;
|
return;
|
||||||
ev.xclient.message_type = a;
|
c->fullscreen = 0;
|
||||||
ev.xclient.format = 32;
|
if (!n)
|
||||||
ev.xclient.data.l[0] = x;
|
return;
|
||||||
ev.xclient.data.l[1] = CurrentTime;
|
for (i = 0; i < n; i++)
|
||||||
return &ev;
|
if (p[i] == net_wm_state_fullscreen)
|
||||||
|
c->fullscreen = 1;
|
||||||
|
XFree((char *) p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setwmstate(Client *c)
|
||||||
|
{
|
||||||
|
if (c->fullscreen) {
|
||||||
|
Atom data[] = {
|
||||||
|
net_wm_state_fullscreen
|
||||||
|
};
|
||||||
|
XChangeProperty(dpy, c->window, net_wm_state, XA_ATOM, 32, PropModeReplace,
|
||||||
|
(unsigned char *)data, 1);
|
||||||
|
} else
|
||||||
|
XDeleteProperty(dpy, c->window, net_wm_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void sendcmessage(Window w, Atom a, long x)
|
void sendcmessage(Window w, Atom a, long x)
|
||||||
{
|
{
|
||||||
if(!(XSendEvent(dpy, w, False, 0L, mkcmessage(w, a, x))))
|
if(!(XSendEvent(dpy, w, False, 0L, mkcmessage(w, a, x))))
|
||||||
@@ -278,9 +324,27 @@ void handle_client_message(Client *c, XClientMessageEvent *xcme)
|
|||||||
i->mapped=0;
|
i->mapped=0;
|
||||||
deselecticon(i);
|
deselecticon(i);
|
||||||
XMapWindow(dpy, c->window);
|
XMapWindow(dpy, c->window);
|
||||||
if(c->parent!=c->scr->root)
|
if(c->parent!=c->scr->root && !c->fullscreen)
|
||||||
XMapRaised(dpy, c->parent);
|
XMapRaised(dpy, c->parent);
|
||||||
setclientstate(c, NormalState);
|
setclientstate(c, NormalState);
|
||||||
}
|
}
|
||||||
|
} else if (xcme->message_type == net_wm_state) {
|
||||||
|
int action=xcme->data.l[0];
|
||||||
|
Atom prop=xcme->data.l[1];
|
||||||
|
if (prop == net_wm_state_fullscreen)
|
||||||
|
switch (action) {
|
||||||
|
case 0: fullscreen(c, 0); break; /* _NET_WM_STATE_REMOVE */
|
||||||
|
case 1: fullscreen(c, 1); break; /* _NET_WM_STATE_ADD */
|
||||||
|
case 2: fullscreen(c, !c->fullscreen); break; /* _NET_WM_STATE_TOGGLE */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Window get_transient_for(Window w)
|
||||||
|
{
|
||||||
|
Window transient_for = None;
|
||||||
|
|
||||||
|
if (!XGetTransientForHint(dpy, w, &transient_for))
|
||||||
|
return None;
|
||||||
|
return transient_for;
|
||||||
|
}
|
||||||
|
|||||||
13
icc.h
13
icc.h
@@ -6,12 +6,16 @@
|
|||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
extern void init_atoms(void);
|
extern void init_atoms(void);
|
||||||
|
extern void setsupports(Window, Window);
|
||||||
extern void sendcmessage(Window, Atom, long);
|
extern void sendcmessage(Window, Atom, long);
|
||||||
extern void getproto(Client *c);
|
extern void getproto(Client *c);
|
||||||
|
extern void getwmstate(Client *c);
|
||||||
|
extern void setwmstate(Client *c);
|
||||||
extern void setstringprop(Window, Atom, char *);
|
extern void setstringprop(Window, Atom, char *);
|
||||||
extern void propertychange(Client *, Atom);
|
extern void propertychange(Client *, Atom);
|
||||||
extern long _getprop(Window, Atom, Atom, long, char **);
|
extern long _getprop(Window, Atom, Atom, long, char **);
|
||||||
extern void getwflags(Client *);
|
extern void getwflags(Client *);
|
||||||
|
extern Window get_transient_for(Window);
|
||||||
|
|
||||||
extern Atom wm_state, wm_change_state, wm_protocols, wm_delete, wm_take_focus, wm_colormaps, wm_hints, amiwm_screen, swm_vroot;
|
extern Atom wm_state, wm_change_state, wm_protocols, wm_delete, wm_take_focus, wm_colormaps, wm_hints, amiwm_screen, swm_vroot;
|
||||||
|
|
||||||
@@ -21,4 +25,13 @@ extern Atom wm_state, wm_change_state, wm_protocols, wm_delete, wm_take_focus, w
|
|||||||
#define Psizeright 8
|
#define Psizeright 8
|
||||||
#define Psizetrans 16
|
#define Psizetrans 16
|
||||||
|
|
||||||
|
|
||||||
|
#define mkcmessage(w, a, x, ...) (&(XEvent){.xclient = { \
|
||||||
|
.type = ClientMessage, \
|
||||||
|
.window = (w), \
|
||||||
|
.message_type = (a), \
|
||||||
|
.format = 32, \
|
||||||
|
.data.l = {(long)(x), CurrentTime, __VA_ARGS__}, \
|
||||||
|
}})
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
57
icon.c
57
icon.c
@@ -156,12 +156,12 @@ void reparenticon(Icon *i, Scrn *s, int x, int y)
|
|||||||
i->next=s->icons;
|
i->next=s->icons;
|
||||||
s->icons=i;
|
s->icons=i;
|
||||||
if(i->client) {
|
if(i->client) {
|
||||||
i->client->scr=s;
|
reparent_client(s, i->client);
|
||||||
if(i->client->parent != i->client->scr->root)
|
for (Client *dialog = clients; dialog != NULL; dialog = dialog->next) {
|
||||||
XReparentWindow(dpy, i->client->parent, s->back,
|
if (dialog->leader == i->client) {
|
||||||
i->client->x, i->client->y);
|
reparent_client(s, dialog);
|
||||||
setstringprop(i->client->window, amiwm_screen, s->deftitle);
|
}
|
||||||
sendconfig(i->client);
|
}
|
||||||
}
|
}
|
||||||
if(os)
|
if(os)
|
||||||
selecticon(i);
|
selecticon(i);
|
||||||
@@ -398,7 +398,7 @@ Icon *createappicon(struct module *m, Window p, char *name,
|
|||||||
scr=c->scr;
|
scr=c->scr;
|
||||||
} else
|
} else
|
||||||
if(XFindContext(dpy, p, screen_context, (XPointer*)&scr))
|
if(XFindContext(dpy, p, screen_context, (XPointer*)&scr))
|
||||||
scr=front;
|
scr = get_front_scr();
|
||||||
if(p==scr->root) p=scr->back;
|
if(p==scr->root) p=scr->back;
|
||||||
|
|
||||||
i->scr=scr;
|
i->scr=scr;
|
||||||
@@ -635,3 +635,46 @@ void free_icon_pms(struct IconPixmaps *pms)
|
|||||||
free_color_store(dpy, &pms->cs);
|
free_color_store(dpy, &pms->cs);
|
||||||
free_color_store(dpy, &pms->cs2);
|
free_color_store(dpy, &pms->cs2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void iconify(Client *c)
|
||||||
|
{
|
||||||
|
if(!(c->icon))
|
||||||
|
createicon(c);
|
||||||
|
XUnmapWindow(dpy, c->parent);
|
||||||
|
adjusticon(c->icon);
|
||||||
|
XMapWindow(dpy, c->icon->window);
|
||||||
|
if(c->icon->labelwidth)
|
||||||
|
XMapWindow(dpy, c->icon->labelwin);
|
||||||
|
c->icon->mapped=1;
|
||||||
|
setclientstate(c, IconicState);
|
||||||
|
for (Client *dialog = clients; dialog != NULL; dialog = dialog->next) {
|
||||||
|
if (dialog->leader == c) {
|
||||||
|
XUnmapWindow(dpy, dialog->parent);
|
||||||
|
setclientstate(dialog, IconicState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void deiconify(Icon *i)
|
||||||
|
{
|
||||||
|
Client *c = i->client;
|
||||||
|
|
||||||
|
if(i->labelwin)
|
||||||
|
XUnmapWindow(dpy, i->labelwin);
|
||||||
|
if(i->window)
|
||||||
|
XUnmapWindow(dpy, i->window);
|
||||||
|
i->mapped=0;
|
||||||
|
deselecticon(i);
|
||||||
|
if (c != NULL) {
|
||||||
|
XMapWindow(dpy, c->window);
|
||||||
|
if(c->parent!=c->scr->root && !c->fullscreen)
|
||||||
|
XMapRaised(dpy, c->parent);
|
||||||
|
setclientstate(c, NormalState);
|
||||||
|
for (Client *dialog = clients; dialog != NULL; dialog = dialog->next) {
|
||||||
|
if (dialog->leader == c) {
|
||||||
|
XMapRaised(dpy, dialog->parent);
|
||||||
|
setclientstate(dialog, NormalState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
2
icon.h
2
icon.h
@@ -39,5 +39,7 @@ extern void adjusticon(Icon *);
|
|||||||
extern void selecticon(Icon *);
|
extern void selecticon(Icon *);
|
||||||
extern void deselecticon(Icon *);
|
extern void deselecticon(Icon *);
|
||||||
extern void free_icon_pms(struct IconPixmaps *pms);
|
extern void free_icon_pms(struct IconPixmaps *pms);
|
||||||
|
extern void iconify(Client *);
|
||||||
|
extern void deiconify(Icon *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/local/bin/perl
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
sub chompstring {
|
sub chompstring {
|
||||||
my ($len, $rest)=unpack("Na*", $_[0]);
|
my ($len, $rest)=unpack("Na*", $_[0]);
|
||||||
|
|||||||
695
install-sh
695
install-sh
@@ -1,238 +1,529 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
|
||||||
# install - install a program, script, or datafile
|
# install - install a program, script, or datafile
|
||||||
# This comes from X11R5.
|
|
||||||
|
scriptversion=2018-03-11.20; # UTC
|
||||||
|
|
||||||
|
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||||
|
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||||
|
# following copyright and license.
|
||||||
|
#
|
||||||
|
# Copyright (C) 1994 X Consortium
|
||||||
|
#
|
||||||
|
# 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 or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||||
|
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||||
|
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
#
|
||||||
|
# Except as contained in this notice, the name of the X Consortium shall not
|
||||||
|
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||||
|
# ings in this Software without prior written authorization from the X Consor-
|
||||||
|
# tium.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# FSF changes to this file are in the public domain.
|
||||||
#
|
#
|
||||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||||
# `make' implicit rules from creating a file called install from it
|
# 'make' implicit rules from creating a file called install from it
|
||||||
# when there is no Makefile.
|
# when there is no Makefile.
|
||||||
#
|
#
|
||||||
# This script is compatible with the BSD install script, but was written
|
# This script is compatible with the BSD install script, but was written
|
||||||
# from scratch.
|
# from scratch.
|
||||||
#
|
|
||||||
|
|
||||||
|
tab=' '
|
||||||
# set DOITPROG to echo to test this script
|
nl='
|
||||||
|
|
||||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
|
||||||
doit="${DOITPROG-}"
|
|
||||||
|
|
||||||
|
|
||||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
|
||||||
|
|
||||||
mvprog="${MVPROG-mv}"
|
|
||||||
cpprog="${CPPROG-cp}"
|
|
||||||
chmodprog="${CHMODPROG-chmod}"
|
|
||||||
chownprog="${CHOWNPROG-chown}"
|
|
||||||
chgrpprog="${CHGRPPROG-chgrp}"
|
|
||||||
stripprog="${STRIPPROG-strip}"
|
|
||||||
rmprog="${RMPROG-rm}"
|
|
||||||
mkdirprog="${MKDIRPROG-mkdir}"
|
|
||||||
|
|
||||||
tranformbasename=""
|
|
||||||
transform_arg=""
|
|
||||||
instcmd="$mvprog"
|
|
||||||
chmodcmd="$chmodprog 0755"
|
|
||||||
chowncmd=""
|
|
||||||
chgrpcmd=""
|
|
||||||
stripcmd=""
|
|
||||||
rmcmd="$rmprog -f"
|
|
||||||
mvcmd="$mvprog"
|
|
||||||
src=""
|
|
||||||
dst=""
|
|
||||||
dir_arg=""
|
|
||||||
|
|
||||||
while [ x"$1" != x ]; do
|
|
||||||
case $1 in
|
|
||||||
-c) instcmd="$cpprog"
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-d) dir_arg=true
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-m) chmodcmd="$chmodprog $2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-o) chowncmd="$chownprog $2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-g) chgrpcmd="$chgrpprog $2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-s) stripcmd="$stripprog"
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
*) if [ x"$src" = x ]
|
|
||||||
then
|
|
||||||
src=$1
|
|
||||||
else
|
|
||||||
# this colon is to work around a 386BSD /bin/sh bug
|
|
||||||
:
|
|
||||||
dst=$1
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ x"$src" = x ]
|
|
||||||
then
|
|
||||||
echo "install: no input file specified"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
true
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ x"$dir_arg" != x ]; then
|
|
||||||
dst=$src
|
|
||||||
src=""
|
|
||||||
|
|
||||||
if [ -d $dst ]; then
|
|
||||||
instcmd=:
|
|
||||||
else
|
|
||||||
instcmd=mkdir
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
|
|
||||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
|
||||||
# might cause directories to be created, which would be especially bad
|
|
||||||
# if $src (and thus $dsttmp) contains '*'.
|
|
||||||
|
|
||||||
if [ -f $src -o -d $src ]
|
|
||||||
then
|
|
||||||
true
|
|
||||||
else
|
|
||||||
echo "install: $src does not exist"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ x"$dst" = x ]
|
|
||||||
then
|
|
||||||
echo "install: no destination specified"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If destination is a directory, append the input filename; if your system
|
|
||||||
# does not like double slashes in filenames, you may need to add some logic
|
|
||||||
|
|
||||||
if [ -d $dst ]
|
|
||||||
then
|
|
||||||
dst="$dst"/`basename $src`
|
|
||||||
else
|
|
||||||
true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
## this sed command emulates the dirname command
|
|
||||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
|
||||||
|
|
||||||
# Make sure that the destination directory exists.
|
|
||||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
|
||||||
|
|
||||||
# Skip lots of stat calls in the usual case.
|
|
||||||
if [ ! -d "$dstdir" ]; then
|
|
||||||
defaultIFS='
|
|
||||||
'
|
'
|
||||||
IFS="${IFS-${defaultIFS}}"
|
IFS=" $tab$nl"
|
||||||
|
|
||||||
oIFS="${IFS}"
|
# Set DOITPROG to "echo" to test this script.
|
||||||
# Some sh's can't handle IFS=/ for some reason.
|
|
||||||
IFS='%'
|
|
||||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
|
||||||
IFS="${oIFS}"
|
|
||||||
|
|
||||||
pathcomp=''
|
doit=${DOITPROG-}
|
||||||
|
doit_exec=${doit:-exec}
|
||||||
|
|
||||||
while [ $# -ne 0 ] ; do
|
# Put in absolute file names if you don't have them in your path;
|
||||||
pathcomp="${pathcomp}${1}"
|
# or use environment vars.
|
||||||
shift
|
|
||||||
|
|
||||||
if [ ! -d "${pathcomp}" ] ;
|
chgrpprog=${CHGRPPROG-chgrp}
|
||||||
then
|
chmodprog=${CHMODPROG-chmod}
|
||||||
$mkdirprog "${pathcomp}"
|
chownprog=${CHOWNPROG-chown}
|
||||||
else
|
cmpprog=${CMPPROG-cmp}
|
||||||
true
|
cpprog=${CPPROG-cp}
|
||||||
fi
|
mkdirprog=${MKDIRPROG-mkdir}
|
||||||
|
mvprog=${MVPROG-mv}
|
||||||
|
rmprog=${RMPROG-rm}
|
||||||
|
stripprog=${STRIPPROG-strip}
|
||||||
|
|
||||||
pathcomp="${pathcomp}/"
|
posix_mkdir=
|
||||||
|
|
||||||
|
# Desired mode of installed file.
|
||||||
|
mode=0755
|
||||||
|
|
||||||
|
chgrpcmd=
|
||||||
|
chmodcmd=$chmodprog
|
||||||
|
chowncmd=
|
||||||
|
mvcmd=$mvprog
|
||||||
|
rmcmd="$rmprog -f"
|
||||||
|
stripcmd=
|
||||||
|
|
||||||
|
src=
|
||||||
|
dst=
|
||||||
|
dir_arg=
|
||||||
|
dst_arg=
|
||||||
|
|
||||||
|
copy_on_change=false
|
||||||
|
is_target_a_directory=possibly
|
||||||
|
|
||||||
|
usage="\
|
||||||
|
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||||
|
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||||
|
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||||
|
or: $0 [OPTION]... -d DIRECTORIES...
|
||||||
|
|
||||||
|
In the 1st form, copy SRCFILE to DSTFILE.
|
||||||
|
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||||
|
In the 4th, create DIRECTORIES.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
--help display this help and exit.
|
||||||
|
--version display version info and exit.
|
||||||
|
|
||||||
|
-c (ignored)
|
||||||
|
-C install only if different (preserve the last data modification time)
|
||||||
|
-d create directories instead of installing files.
|
||||||
|
-g GROUP $chgrpprog installed files to GROUP.
|
||||||
|
-m MODE $chmodprog installed files to MODE.
|
||||||
|
-o USER $chownprog installed files to USER.
|
||||||
|
-s $stripprog installed files.
|
||||||
|
-t DIRECTORY install into DIRECTORY.
|
||||||
|
-T report an error if DSTFILE is a directory.
|
||||||
|
|
||||||
|
Environment variables override the default commands:
|
||||||
|
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||||
|
RMPROG STRIPPROG
|
||||||
|
"
|
||||||
|
|
||||||
|
while test $# -ne 0; do
|
||||||
|
case $1 in
|
||||||
|
-c) ;;
|
||||||
|
|
||||||
|
-C) copy_on_change=true;;
|
||||||
|
|
||||||
|
-d) dir_arg=true;;
|
||||||
|
|
||||||
|
-g) chgrpcmd="$chgrpprog $2"
|
||||||
|
shift;;
|
||||||
|
|
||||||
|
--help) echo "$usage"; exit $?;;
|
||||||
|
|
||||||
|
-m) mode=$2
|
||||||
|
case $mode in
|
||||||
|
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||||
|
echo "$0: invalid mode: $mode" >&2
|
||||||
|
exit 1;;
|
||||||
|
esac
|
||||||
|
shift;;
|
||||||
|
|
||||||
|
-o) chowncmd="$chownprog $2"
|
||||||
|
shift;;
|
||||||
|
|
||||||
|
-s) stripcmd=$stripprog;;
|
||||||
|
|
||||||
|
-t)
|
||||||
|
is_target_a_directory=always
|
||||||
|
dst_arg=$2
|
||||||
|
# Protect names problematic for 'test' and other utilities.
|
||||||
|
case $dst_arg in
|
||||||
|
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||||
|
esac
|
||||||
|
shift;;
|
||||||
|
|
||||||
|
-T) is_target_a_directory=never;;
|
||||||
|
|
||||||
|
--version) echo "$0 $scriptversion"; exit $?;;
|
||||||
|
|
||||||
|
--) shift
|
||||||
|
break;;
|
||||||
|
|
||||||
|
-*) echo "$0: invalid option: $1" >&2
|
||||||
|
exit 1;;
|
||||||
|
|
||||||
|
*) break;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# We allow the use of options -d and -T together, by making -d
|
||||||
|
# take the precedence; this is for compatibility with GNU install.
|
||||||
|
|
||||||
|
if test -n "$dir_arg"; then
|
||||||
|
if test -n "$dst_arg"; then
|
||||||
|
echo "$0: target directory not allowed when installing a directory." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ x"$dir_arg" != x ]
|
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||||
then
|
# When -d is used, all remaining arguments are directories to create.
|
||||||
$doit $instcmd $dst &&
|
# When -t is used, the destination is already specified.
|
||||||
|
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||||
|
for arg
|
||||||
|
do
|
||||||
|
if test -n "$dst_arg"; then
|
||||||
|
# $@ is not empty: it contains at least $arg.
|
||||||
|
set fnord "$@" "$dst_arg"
|
||||||
|
shift # fnord
|
||||||
|
fi
|
||||||
|
shift # arg
|
||||||
|
dst_arg=$arg
|
||||||
|
# Protect names problematic for 'test' and other utilities.
|
||||||
|
case $dst_arg in
|
||||||
|
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
if test $# -eq 0; then
|
||||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
if test -z "$dir_arg"; then
|
||||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
echo "$0: no input file specified." >&2
|
||||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
exit 1
|
||||||
else
|
fi
|
||||||
|
# It's OK to call 'install-sh -d' without argument.
|
||||||
|
# This can happen when creating conditional directories.
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# If we're going to rename the final executable, determine the name now.
|
if test -z "$dir_arg"; then
|
||||||
|
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||||
|
if test ! -d "$dst_arg"; then
|
||||||
|
echo "$0: $dst_arg: Is not a directory." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ x"$transformarg" = x ]
|
if test -z "$dir_arg"; then
|
||||||
then
|
do_exit='(exit $ret); exit $ret'
|
||||||
dstfile=`basename $dst`
|
trap "ret=129; $do_exit" 1
|
||||||
else
|
trap "ret=130; $do_exit" 2
|
||||||
dstfile=`basename $dst $transformbasename |
|
trap "ret=141; $do_exit" 13
|
||||||
sed $transformarg`$transformbasename
|
trap "ret=143; $do_exit" 15
|
||||||
fi
|
|
||||||
|
|
||||||
# don't allow the sed command to completely eliminate the filename
|
# Set umask so as not to create temps with too-generous modes.
|
||||||
|
# However, 'strip' requires both read and write access to temps.
|
||||||
|
case $mode in
|
||||||
|
# Optimize common cases.
|
||||||
|
*644) cp_umask=133;;
|
||||||
|
*755) cp_umask=22;;
|
||||||
|
|
||||||
if [ x"$dstfile" = x ]
|
*[0-7])
|
||||||
then
|
if test -z "$stripcmd"; then
|
||||||
dstfile=`basename $dst`
|
u_plus_rw=
|
||||||
else
|
else
|
||||||
true
|
u_plus_rw='% 200'
|
||||||
fi
|
fi
|
||||||
|
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||||
|
*)
|
||||||
|
if test -z "$stripcmd"; then
|
||||||
|
u_plus_rw=
|
||||||
|
else
|
||||||
|
u_plus_rw=,u+rw
|
||||||
|
fi
|
||||||
|
cp_umask=$mode$u_plus_rw;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
# Make a temp file name in the proper directory.
|
for src
|
||||||
|
do
|
||||||
|
# Protect names problematic for 'test' and other utilities.
|
||||||
|
case $src in
|
||||||
|
-* | [=\(\)!]) src=./$src;;
|
||||||
|
esac
|
||||||
|
|
||||||
dsttmp=$dstdir/#inst.$$#
|
if test -n "$dir_arg"; then
|
||||||
|
dst=$src
|
||||||
|
dstdir=$dst
|
||||||
|
test -d "$dstdir"
|
||||||
|
dstdir_status=$?
|
||||||
|
else
|
||||||
|
|
||||||
# Move or copy the file name to the temp name
|
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||||
|
# might cause directories to be created, which would be especially bad
|
||||||
|
# if $src (and thus $dsttmp) contains '*'.
|
||||||
|
if test ! -f "$src" && test ! -d "$src"; then
|
||||||
|
echo "$0: $src does not exist." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
$doit $instcmd $src $dsttmp &&
|
if test -z "$dst_arg"; then
|
||||||
|
echo "$0: no destination specified." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
dst=$dst_arg
|
||||||
|
|
||||||
trap "rm -f ${dsttmp}" 0 &&
|
# If destination is a directory, append the input filename.
|
||||||
|
if test -d "$dst"; then
|
||||||
|
if test "$is_target_a_directory" = never; then
|
||||||
|
echo "$0: $dst_arg: Is a directory" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
dstdir=$dst
|
||||||
|
dstbase=`basename "$src"`
|
||||||
|
case $dst in
|
||||||
|
*/) dst=$dst$dstbase;;
|
||||||
|
*) dst=$dst/$dstbase;;
|
||||||
|
esac
|
||||||
|
dstdir_status=0
|
||||||
|
else
|
||||||
|
dstdir=`dirname "$dst"`
|
||||||
|
test -d "$dstdir"
|
||||||
|
dstdir_status=$?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# and set any options; do chmod last to preserve setuid bits
|
case $dstdir in
|
||||||
|
*/) dstdirslash=$dstdir;;
|
||||||
|
*) dstdirslash=$dstdir/;;
|
||||||
|
esac
|
||||||
|
|
||||||
# If any of these fail, we abort the whole thing. If we want to
|
obsolete_mkdir_used=false
|
||||||
# ignore errors from any of these, just make sure not to ignore
|
|
||||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
|
||||||
|
|
||||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
if test $dstdir_status != 0; then
|
||||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
case $posix_mkdir in
|
||||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
'')
|
||||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||||
|
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||||
|
umask=`umask`
|
||||||
|
case $stripcmd.$umask in
|
||||||
|
# Optimize common cases.
|
||||||
|
*[2367][2367]) mkdir_umask=$umask;;
|
||||||
|
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
*[0-7])
|
||||||
|
mkdir_umask=`expr $umask + 22 \
|
||||||
|
- $umask % 100 % 40 + $umask % 20 \
|
||||||
|
- $umask % 10 % 4 + $umask % 2
|
||||||
|
`;;
|
||||||
|
*) mkdir_umask=$umask,go-w;;
|
||||||
|
esac
|
||||||
|
|
||||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
# With -d, create the new directory with the user-specified mode.
|
||||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
# Otherwise, rely on $mkdir_umask.
|
||||||
|
if test -n "$dir_arg"; then
|
||||||
|
mkdir_mode=-m$mode
|
||||||
|
else
|
||||||
|
mkdir_mode=
|
||||||
|
fi
|
||||||
|
|
||||||
fi &&
|
posix_mkdir=false
|
||||||
|
case $umask in
|
||||||
|
*[123567][0-7][0-7])
|
||||||
|
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||||
|
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Note that $RANDOM variable is not portable (e.g. dash); Use it
|
||||||
|
# here however when possible just to lower collision chance.
|
||||||
|
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||||
|
|
||||||
|
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||||
|
|
||||||
exit 0
|
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||||
|
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||||
|
# directory is successfully created first before we actually test
|
||||||
|
# 'mkdir -p' feature.
|
||||||
|
if (umask $mkdir_umask &&
|
||||||
|
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||||
|
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
if test -z "$dir_arg" || {
|
||||||
|
# Check for POSIX incompatibilities with -m.
|
||||||
|
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||||
|
# other-writable bit of parent directory when it shouldn't.
|
||||||
|
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||||
|
test_tmpdir="$tmpdir/a"
|
||||||
|
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||||
|
case $ls_ld_tmpdir in
|
||||||
|
d????-?r-*) different_mode=700;;
|
||||||
|
d????-?--*) different_mode=755;;
|
||||||
|
*) false;;
|
||||||
|
esac &&
|
||||||
|
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||||
|
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||||
|
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
then posix_mkdir=:
|
||||||
|
fi
|
||||||
|
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||||
|
else
|
||||||
|
# Remove any dirs left behind by ancient mkdir implementations.
|
||||||
|
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||||
|
fi
|
||||||
|
trap '' 0;;
|
||||||
|
esac;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if
|
||||||
|
$posix_mkdir && (
|
||||||
|
umask $mkdir_umask &&
|
||||||
|
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||||
|
)
|
||||||
|
then :
|
||||||
|
else
|
||||||
|
|
||||||
|
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||||
|
# or it failed possibly due to a race condition. Create the
|
||||||
|
# directory the slow way, step by step, checking for races as we go.
|
||||||
|
|
||||||
|
case $dstdir in
|
||||||
|
/*) prefix='/';;
|
||||||
|
[-=\(\)!]*) prefix='./';;
|
||||||
|
*) prefix='';;
|
||||||
|
esac
|
||||||
|
|
||||||
|
oIFS=$IFS
|
||||||
|
IFS=/
|
||||||
|
set -f
|
||||||
|
set fnord $dstdir
|
||||||
|
shift
|
||||||
|
set +f
|
||||||
|
IFS=$oIFS
|
||||||
|
|
||||||
|
prefixes=
|
||||||
|
|
||||||
|
for d
|
||||||
|
do
|
||||||
|
test X"$d" = X && continue
|
||||||
|
|
||||||
|
prefix=$prefix$d
|
||||||
|
if test -d "$prefix"; then
|
||||||
|
prefixes=
|
||||||
|
else
|
||||||
|
if $posix_mkdir; then
|
||||||
|
(umask=$mkdir_umask &&
|
||||||
|
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||||
|
# Don't fail if two instances are running concurrently.
|
||||||
|
test -d "$prefix" || exit 1
|
||||||
|
else
|
||||||
|
case $prefix in
|
||||||
|
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||||
|
*) qprefix=$prefix;;
|
||||||
|
esac
|
||||||
|
prefixes="$prefixes '$qprefix'"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
prefix=$prefix/
|
||||||
|
done
|
||||||
|
|
||||||
|
if test -n "$prefixes"; then
|
||||||
|
# Don't fail if two instances are running concurrently.
|
||||||
|
(umask $mkdir_umask &&
|
||||||
|
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||||
|
test -d "$dstdir" || exit 1
|
||||||
|
obsolete_mkdir_used=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -n "$dir_arg"; then
|
||||||
|
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||||
|
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||||
|
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||||
|
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||||
|
else
|
||||||
|
|
||||||
|
# Make a couple of temp file names in the proper directory.
|
||||||
|
dsttmp=${dstdirslash}_inst.$$_
|
||||||
|
rmtmp=${dstdirslash}_rm.$$_
|
||||||
|
|
||||||
|
# Trap to clean up those temp files at exit.
|
||||||
|
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||||
|
|
||||||
|
# Copy the file name to the temp name.
|
||||||
|
(umask $cp_umask &&
|
||||||
|
{ test -z "$stripcmd" || {
|
||||||
|
# Create $dsttmp read-write so that cp doesn't create it read-only,
|
||||||
|
# which would cause strip to fail.
|
||||||
|
if test -z "$doit"; then
|
||||||
|
: >"$dsttmp" # No need to fork-exec 'touch'.
|
||||||
|
else
|
||||||
|
$doit touch "$dsttmp"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
} &&
|
||||||
|
$doit_exec $cpprog "$src" "$dsttmp") &&
|
||||||
|
|
||||||
|
# and set any options; do chmod last to preserve setuid bits.
|
||||||
|
#
|
||||||
|
# If any of these fail, we abort the whole thing. If we want to
|
||||||
|
# ignore errors from any of these, just make sure not to ignore
|
||||||
|
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||||
|
#
|
||||||
|
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||||
|
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||||
|
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||||
|
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||||
|
|
||||||
|
# If -C, don't bother to copy if it wouldn't change the file.
|
||||||
|
if $copy_on_change &&
|
||||||
|
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||||
|
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||||
|
set -f &&
|
||||||
|
set X $old && old=:$2:$4:$5:$6 &&
|
||||||
|
set X $new && new=:$2:$4:$5:$6 &&
|
||||||
|
set +f &&
|
||||||
|
test "$old" = "$new" &&
|
||||||
|
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
rm -f "$dsttmp"
|
||||||
|
else
|
||||||
|
# Rename the file to the real destination.
|
||||||
|
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||||
|
|
||||||
|
# The rename failed, perhaps because mv can't rename something else
|
||||||
|
# to itself, or perhaps because mv is so ancient that it does not
|
||||||
|
# support -f.
|
||||||
|
{
|
||||||
|
# Now remove or move aside any old file at destination location.
|
||||||
|
# We try this two ways since rm can't unlink itself on some
|
||||||
|
# systems and the destination file might be busy for other
|
||||||
|
# reasons. In this case, the final cleanup might fail but the new
|
||||||
|
# file should still install successfully.
|
||||||
|
{
|
||||||
|
test ! -f "$dst" ||
|
||||||
|
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||||
|
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||||
|
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||||
|
} ||
|
||||||
|
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||||
|
(exit 1); exit 1
|
||||||
|
}
|
||||||
|
} &&
|
||||||
|
|
||||||
|
# Now rename the file to the real destination.
|
||||||
|
$doit $mvcmd "$dsttmp" "$dst"
|
||||||
|
}
|
||||||
|
fi || exit 1
|
||||||
|
|
||||||
|
trap '' 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||||
|
# time-stamp-start: "scriptversion="
|
||||||
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
|
# time-stamp-time-zone: "UTC0"
|
||||||
|
# time-stamp-end: "; # UTC"
|
||||||
|
# End:
|
||||||
|
|||||||
1971
kbdlexer.c
1971
kbdlexer.c
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,10 @@
|
|||||||
|
%option noyywrap
|
||||||
%{
|
%{
|
||||||
#include <X11/Xmu/CharSet.h>
|
#include <X11/Xmu/CharSet.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "libami.h"
|
#include "libami.h"
|
||||||
#include "kbdmodule.h"
|
#include "kbdmodule.tab.h"
|
||||||
|
|
||||||
unsigned char *inptr;
|
unsigned char *inptr;
|
||||||
extern char *progname;
|
extern char *progname;
|
||||||
@@ -41,7 +42,10 @@ int parse_keyword(char *str, YYSTYPE *val)
|
|||||||
{ "back", (mdfuncp)md_back },
|
{ "back", (mdfuncp)md_back },
|
||||||
{ "front", (mdfuncp)md_front },
|
{ "front", (mdfuncp)md_front },
|
||||||
{ "iconify", (mdfuncp)md_iconify },
|
{ "iconify", (mdfuncp)md_iconify },
|
||||||
|
{ "lowerwindow", (mdfuncp)md_rotate_window_lower },
|
||||||
|
{ "raisewindow", (mdfuncp)md_rotate_window_raise },
|
||||||
{ "rotatescreens", (mdfuncp)k_rotscreens },
|
{ "rotatescreens", (mdfuncp)k_rotscreens },
|
||||||
|
{ "rotatewindow", (mdfuncp)md_rotate_window_desktop },
|
||||||
};
|
};
|
||||||
#define N_FUNC (sizeof(functab)/sizeof(functab[0]))
|
#define N_FUNC (sizeof(functab)/sizeof(functab[0]))
|
||||||
struct { char *name; int token, num; } kwtab[] = {
|
struct { char *name; int token, num; } kwtab[] = {
|
||||||
@@ -136,9 +140,6 @@ int parse_keyword(char *str, YYSTYPE *val)
|
|||||||
progname, yytext); }
|
progname, yytext); }
|
||||||
%%
|
%%
|
||||||
|
|
||||||
#ifndef yywrap
|
|
||||||
int yywrap() { return 1; }
|
|
||||||
#endif
|
|
||||||
#undef input
|
#undef input
|
||||||
#define input() ((*inptr)?(*inptr++):0)
|
#define input() ((*inptr)?(*inptr++):0)
|
||||||
#undef unput
|
#undef unput
|
||||||
|
|||||||
1526
kbdmodule.c
1526
kbdmodule.c
File diff suppressed because it is too large
Load Diff
94
kbdmodule.h
94
kbdmodule.h
@@ -1,94 +0,0 @@
|
|||||||
/* A Bison parser, made by GNU Bison 3.0.4. */
|
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
|
||||||
|
|
||||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
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 3 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, see <http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* As a special exception, you may create a larger work that contains
|
|
||||||
part or all of the Bison parser skeleton and distribute that work
|
|
||||||
under terms of your choice, so long as that work isn't itself a
|
|
||||||
parser generator using the skeleton or a modified version thereof
|
|
||||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
|
||||||
the parser skeleton itself, you may (at your option) remove this
|
|
||||||
special exception, which will cause the skeleton and the resulting
|
|
||||||
Bison output files to be licensed under the GNU General Public
|
|
||||||
License without this special exception.
|
|
||||||
|
|
||||||
This special exception was added by the Free Software Foundation in
|
|
||||||
version 2.2 of Bison. */
|
|
||||||
|
|
||||||
#ifndef YY_YY_Y_TAB_H_INCLUDED
|
|
||||||
# define YY_YY_Y_TAB_H_INCLUDED
|
|
||||||
/* Debug traces. */
|
|
||||||
#ifndef YYDEBUG
|
|
||||||
# define YYDEBUG 0
|
|
||||||
#endif
|
|
||||||
#if YYDEBUG
|
|
||||||
extern int yydebug;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Token type. */
|
|
||||||
#ifndef YYTOKENTYPE
|
|
||||||
# define YYTOKENTYPE
|
|
||||||
enum yytokentype
|
|
||||||
{
|
|
||||||
ERRORTOKEN = 258,
|
|
||||||
META = 259,
|
|
||||||
MODIFIER = 260,
|
|
||||||
WHEREABOUTS = 261,
|
|
||||||
COLON = 262,
|
|
||||||
BAR = 263,
|
|
||||||
KEYSYM = 264,
|
|
||||||
FUNCTION = 265
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
/* Tokens. */
|
|
||||||
#define ERRORTOKEN 258
|
|
||||||
#define META 259
|
|
||||||
#define MODIFIER 260
|
|
||||||
#define WHEREABOUTS 261
|
|
||||||
#define COLON 262
|
|
||||||
#define BAR 263
|
|
||||||
#define KEYSYM 264
|
|
||||||
#define FUNCTION 265
|
|
||||||
|
|
||||||
/* Value type. */
|
|
||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
|
||||||
|
|
||||||
union YYSTYPE
|
|
||||||
{
|
|
||||||
#line 14 "kbdmodule.y" /* yacc.c:1909 */
|
|
||||||
|
|
||||||
int num;
|
|
||||||
char *ptr;
|
|
||||||
KeySym keysym;
|
|
||||||
struct { unsigned int mods; int meta; } modifiers;
|
|
||||||
void (*function)(Window);
|
|
||||||
|
|
||||||
#line 82 "y.tab.h" /* yacc.c:1909 */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef union YYSTYPE YYSTYPE;
|
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
extern YYSTYPE yylval;
|
|
||||||
|
|
||||||
int yyparse (void);
|
|
||||||
|
|
||||||
#endif /* !YY_YY_Y_TAB_H_INCLUDED */
|
|
||||||
16
kbdmodule.y
16
kbdmodule.y
@@ -8,6 +8,14 @@ void docmd(XEvent *e, void *callback)
|
|||||||
((void (*)(Window))callback)(e->xany.window);
|
((void (*)(Window))callback)(e->xany.window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int yylex();
|
||||||
|
|
||||||
|
char *progname;
|
||||||
|
int yyerror(s) char *s;
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: error in input file: %s\n", progname, s ? s : "");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%union
|
%union
|
||||||
@@ -55,14 +63,6 @@ command : FUNCTION { $$=$1; }
|
|||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
char *progname;
|
|
||||||
|
|
||||||
int yyerror(s) char *s;
|
|
||||||
{
|
|
||||||
fprintf (stderr, "%s: error in input file: %s\n", progname, s ? s : "");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *arg=md_init(argc, argv);
|
char *arg=md_init(argc, argv);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include "libami.h"
|
#include "libami.h"
|
||||||
|
|||||||
4
lex.l
4
lex.l
@@ -1,12 +1,12 @@
|
|||||||
|
%option noyywrap
|
||||||
%{
|
%{
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "gram.h"
|
#include "gram.tab.h"
|
||||||
extern char *progname;
|
extern char *progname;
|
||||||
extern int ParseError;
|
extern int ParseError;
|
||||||
extern FILE *rcfile;
|
extern FILE *rcfile;
|
||||||
#undef yyin
|
#undef yyin
|
||||||
#define yyin rcfile
|
#define yyin rcfile
|
||||||
#define yywrap() 1
|
|
||||||
extern int parse_keyword(char *);
|
extern int parse_keyword(char *);
|
||||||
void fixup_string(char *, char *);
|
void fixup_string(char *, char *);
|
||||||
#define YY_SKIP_YYWRAP
|
#define YY_SKIP_YYWRAP
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
srcdir = .
|
|
||||||
|
|
||||||
SHELL = /bin/sh
|
|
||||||
CC = gcc
|
|
||||||
LEX = flex
|
|
||||||
YACC = bison -y
|
|
||||||
RANLIB = ranlib
|
|
||||||
CFLAGS = -g -O2
|
|
||||||
YFLAGS = -d
|
|
||||||
DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_RESOURCE_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_TERMIO_H=1 -DHAVE_X11_EXTENSIONS_SHAPE_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DRETSIGTYPE=void -DHAVE_WAIT3=1 -DHAVE_SELECT=1 -DHAVE_STRDUP=1 -DHAVE_WAITPID=1 -DHAVE_XSHAPE=1 -DBSD_STYLE_GETTIMEOFDAY=1 -DHAVE_XCREATEFONTSET=1 -DHAVE_XMBTEXTESCAPEMENT=1 -DHAVE_XUTF8DRAWIMAGESTRING=1 -DUSE_FONTSETS=1 -DLAME_ENDIAN=1
|
|
||||||
ALL_CFLAGS = -I. -I.. $(DEFS) $(CFLAGS)
|
|
||||||
LIBS = -lSM -lICE -lXext -lXmu -lX11
|
|
||||||
prefix = /usr/local
|
|
||||||
exec_prefix = ${prefix}
|
|
||||||
bindir = $(exec_prefix)/bin
|
|
||||||
libdir = $(exec_prefix)/lib
|
|
||||||
INSTALL = /usr/bin/install -c
|
|
||||||
LN_S = ln -s
|
|
||||||
|
|
||||||
OBJS = drawinfo.o module.o broker.o eventdispatcher.o mdscreen.o \
|
|
||||||
mdicon.o mdwindow.o kbdsupport.o hotkey.o \
|
|
||||||
lists.o readargs.o iconlib.o iconutil.o error.o strutil.o \
|
|
||||||
iffparse.o
|
|
||||||
|
|
||||||
SRCS = drawinfo.c module.c broker.c eventdispatcher.c mdscreen.c \
|
|
||||||
mdicon.c mdwindow.c kbdsupport.c hotkey.c \
|
|
||||||
lists.c readargs.c iconlib.c iconutil.c error.c strutil.c \
|
|
||||||
iffparse.c
|
|
||||||
|
|
||||||
all : libami.a
|
|
||||||
|
|
||||||
libami.a : $(OBJS)
|
|
||||||
ar rc libami.a $(OBJS)
|
|
||||||
$(RANLIB) libami.a
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
|
|
||||||
|
|
||||||
depend: $(SRCS)
|
|
||||||
-@rm Makefile.bak
|
|
||||||
mv Makefile Makefile.bak
|
|
||||||
( sed '/^#--DO NOT REMOVE THIS LINE--$$/q' < Makefile.bak ; \
|
|
||||||
$(CC) -MM $(ALL_CFLAGS) $(SRCS) ) > Makefile
|
|
||||||
|
|
||||||
#--DO NOT REMOVE THIS LINE--
|
|
||||||
@@ -6,9 +6,9 @@ LEX = @LEX@
|
|||||||
YACC = @YACC@
|
YACC = @YACC@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
YFLAGS = -d
|
LDFLAGS = @LDFLAGS@
|
||||||
DEFS = @DEFS@
|
DEFS = @DEFS@
|
||||||
ALL_CFLAGS = -I@srcdir@ -I@top_srcdir@ $(DEFS) $(CFLAGS) @X_CFLAGS@
|
ALL_CFLAGS = -Wall -I@srcdir@ -I@top_srcdir@ $(DEFS) $(CFLAGS) @X_CFLAGS@
|
||||||
LIBS = @X_LIBS@ @X_PRE_LIBS@ -lXext -lXmu -lX11 @X_EXTRA_LIBS@ @LIBS@
|
LIBS = @X_LIBS@ @X_PRE_LIBS@ -lXext -lXmu -lX11 @X_EXTRA_LIBS@ @LIBS@
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
exec_prefix = @exec_prefix@
|
exec_prefix = @exec_prefix@
|
||||||
@@ -16,21 +16,25 @@ bindir = $(exec_prefix)/bin
|
|||||||
libdir = $(exec_prefix)/lib
|
libdir = $(exec_prefix)/lib
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
LN_S = @LN_S@
|
LN_S = @LN_S@
|
||||||
|
RM = -rm -f
|
||||||
|
|
||||||
OBJS = drawinfo.o module.o broker.o eventdispatcher.o mdscreen.o \
|
OBJS = drawinfo.o module.o broker.o eventdispatcher.o mdscreen.o \
|
||||||
mdicon.o mdwindow.o kbdsupport.o hotkey.o \
|
mdicon.o mdwindow.o kbdsupport.o hotkey.o mdbattery.o \
|
||||||
lists.o readargs.o iconlib.o iconutil.o error.o strutil.o \
|
lists.o readargs.o iconlib.o iconutil.o error.o strutil.o \
|
||||||
iffparse.o
|
iffparse.o gadget_button.o gadget_textbox.o gadget_textinput.o
|
||||||
|
|
||||||
SRCS = drawinfo.c module.c broker.c eventdispatcher.c mdscreen.c \
|
SRCS = drawinfo.c module.c broker.c eventdispatcher.c mdscreen.c \
|
||||||
mdicon.c mdwindow.c kbdsupport.c hotkey.c \
|
mdicon.c mdwindow.c kbdsupport.c hotkey.c mdbattery.c \
|
||||||
lists.c readargs.c iconlib.c iconutil.c error.c strutil.c \
|
lists.c readargs.c iconlib.c iconutil.c error.c strutil.c \
|
||||||
iffparse.c
|
iffparse.c gadget_button.c gadget_textbox.c gadget_textinput.c
|
||||||
|
|
||||||
all : libami.a
|
all : libami.a
|
||||||
|
|
||||||
|
clean :
|
||||||
|
$(RM) *.o libami.a
|
||||||
|
|
||||||
libami.a : $(OBJS)
|
libami.a : $(OBJS)
|
||||||
ar rc libami.a $(OBJS)
|
$(AR) rc libami.a $(OBJS)
|
||||||
$(RANLIB) libami.a
|
$(RANLIB) libami.a
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ BOOL Fault(LONG code, UBYTE *header, UBYTE *buffer, LONG len)
|
|||||||
strcpy((char *)buffer, syserrmsg[code-MIN_ERRNO]);
|
strcpy((char *)buffer, syserrmsg[code-MIN_ERRNO]);
|
||||||
} else {
|
} else {
|
||||||
char number[6+4*sizeof(LONG)];
|
char number[6+4*sizeof(LONG)];
|
||||||
sprintf(number, "Error %ld", code);
|
sprintf(number, "Error %ld", (long int) code);
|
||||||
if(len<strlen(number)+1)
|
if(len<strlen(number)+1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
strcpy((char *)buffer, number);
|
strcpy((char *)buffer, number);
|
||||||
|
|||||||
136
libami/gadget_button.c
Normal file
136
libami/gadget_button.c
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <X11/keysym.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#ifdef HAVE_FCNTL_H
|
||||||
|
#include <fcntl.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_STAT_H
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
#include <errno.h>
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
#include <locale.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "drawinfo.h"
|
||||||
|
|
||||||
|
#include "gadget_button.h"
|
||||||
|
|
||||||
|
#ifdef AMIGAOS
|
||||||
|
#include <pragmas/xlib_pragmas.h>
|
||||||
|
extern struct Library *XLibBase;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the button code from the executecmd.c tool.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct gadget_button *
|
||||||
|
gadget_button_init(Display *dpy, struct DrawInfo *dri, GC gc, Window mainwin,
|
||||||
|
int x, int y, int butw, int buth)
|
||||||
|
{
|
||||||
|
struct gadget_button *b;
|
||||||
|
|
||||||
|
b = calloc(1, sizeof(*b));
|
||||||
|
if (b == NULL) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
b->dpy = dpy;
|
||||||
|
b->dri = dri;
|
||||||
|
b->x = x;
|
||||||
|
b->y = y;
|
||||||
|
b->butw = butw;
|
||||||
|
b->buth = buth;
|
||||||
|
b->txt = strdup("");
|
||||||
|
b->gc = gc;
|
||||||
|
|
||||||
|
b->w = XCreateSimpleWindow(dpy, mainwin,
|
||||||
|
x, y,
|
||||||
|
butw, /* width */
|
||||||
|
buth, /* height */
|
||||||
|
0, /* depth */
|
||||||
|
dri->dri_Pens[SHADOWPEN],
|
||||||
|
dri->dri_Pens[BACKGROUNDPEN]);
|
||||||
|
|
||||||
|
XSelectInput(dpy, b->w, ExposureMask | ButtonPressMask
|
||||||
|
| ButtonReleaseMask | EnterWindowMask | LeaveWindowMask);
|
||||||
|
|
||||||
|
return (b);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gadget_button_set_text(struct gadget_button *b, const char *txt)
|
||||||
|
{
|
||||||
|
if (b->txt != NULL)
|
||||||
|
free(b->txt);
|
||||||
|
b->txt = strdup(txt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gadget_button_refresh(struct gadget_button *b)
|
||||||
|
{
|
||||||
|
int fh = b->dri->dri_Ascent + b->dri->dri_Descent;
|
||||||
|
int h = fh + (2 * BUT_VSPACE);
|
||||||
|
int l=strlen(b->txt);
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
int tw = XmbTextEscapement(b->dri->dri_FontSet, b->txt, l);
|
||||||
|
#else
|
||||||
|
int tw = XTextWidth(b->dri->dri_Font, b->txt, l);
|
||||||
|
#endif
|
||||||
|
XSetForeground(b->dpy, b->gc, b->dri->dri_Pens[TEXTPEN]);
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
XmbDrawString(b->dpy, b->w, b->dri->dri_FontSet, b->gc,
|
||||||
|
(b->butw-tw)>>1, b->dri->dri_Ascent+BUT_VSPACE, b->txt, l);
|
||||||
|
#else
|
||||||
|
XDrawString(b->dpy, b->w, b->gc, (b->butw-tw)>>1,
|
||||||
|
b->dri->dri_Ascent+BUT_VSPACE, b->txt, l);
|
||||||
|
#endif
|
||||||
|
XSetForeground(b->dpy, b->gc,
|
||||||
|
b->dri->dri_Pens[b->depressed ? SHADOWPEN:SHINEPEN]);
|
||||||
|
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, 0, 0, b->butw-2, 0);
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, 0, 0, 0, h-2);
|
||||||
|
XSetForeground(b->dpy, b->gc,
|
||||||
|
b->dri->dri_Pens[b->depressed ? SHINEPEN:SHADOWPEN]);
|
||||||
|
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, 1, h-1, b->butw-1, h-1);
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, b->butw-1, 1, b->butw-1, h-1);
|
||||||
|
XSetForeground(b->dpy, b->gc, b->dri->dri_Pens[BACKGROUNDPEN]);
|
||||||
|
XDrawPoint(b->dpy, b->w, b->gc, b->butw-1, 0);
|
||||||
|
XDrawPoint(b->dpy, b->w, b->gc, 0, h-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gadget_button_set_depressed(struct gadget_button *b, int depressed)
|
||||||
|
{
|
||||||
|
b->depressed = depressed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gadget_button_toggle(struct gadget_button *b)
|
||||||
|
{
|
||||||
|
int pen;
|
||||||
|
|
||||||
|
pen = (b->depressed) ? FILLPEN : BACKGROUNDPEN;
|
||||||
|
|
||||||
|
|
||||||
|
XSetWindowBackground(b->dpy, b->w, b->dri->dri_Pens[pen]);
|
||||||
|
XClearWindow(b->dpy, b->w);
|
||||||
|
gadget_button_refresh(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gadget_button_free(struct gadget_button *b)
|
||||||
|
{
|
||||||
|
XDestroyWindow(b->dpy, b->w);
|
||||||
|
free(b->txt);
|
||||||
|
free(b);
|
||||||
|
}
|
||||||
35
libami/gadget_button.h
Normal file
35
libami/gadget_button.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#ifndef __LIBAMI__GADGET_BUTTON_H__
|
||||||
|
#define __LIBAMI__GADGET_BUTTON_H__
|
||||||
|
|
||||||
|
#define BOT_SPACE 4
|
||||||
|
#define TEXT_SIDE 8
|
||||||
|
#define BUT_SIDE 12
|
||||||
|
#define TOP_SPACE 4
|
||||||
|
#define INT_SPACE 7
|
||||||
|
#define BUT_VSPACE 2
|
||||||
|
#define BUT_HSPACE 8
|
||||||
|
|
||||||
|
struct gadget_button {
|
||||||
|
Display *dpy;
|
||||||
|
struct DrawInfo *dri;
|
||||||
|
Window w;
|
||||||
|
GC gc;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int buth;
|
||||||
|
int butw;
|
||||||
|
char *txt;
|
||||||
|
int depressed;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct gadget_button * gadget_button_init(Display *dpy,
|
||||||
|
struct DrawInfo *dri, GC gc, Window mainwin,
|
||||||
|
int x, int y, int butw, int buth);
|
||||||
|
extern void gadget_button_set_text(struct gadget_button *b, const char *txt);
|
||||||
|
extern void gadget_button_refresh(struct gadget_button *b);
|
||||||
|
extern void gadget_button_set_depressed(struct gadget_button *b,
|
||||||
|
int depressed);
|
||||||
|
extern void gadget_button_toggle(struct gadget_button *b);
|
||||||
|
extern void gadget_button_free(struct gadget_button *b);
|
||||||
|
|
||||||
|
#endif /* __LIBAMI__GADGET_BUTTON_H__ */
|
||||||
123
libami/gadget_textbox.c
Normal file
123
libami/gadget_textbox.c
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "drawinfo.h"
|
||||||
|
#include "libami.h"
|
||||||
|
|
||||||
|
#ifdef AMIGAOS
|
||||||
|
#include <pragmas/xlib_pragmas.h>
|
||||||
|
extern struct Library *XLibBase;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gadget_textbox.h"
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
struct gadget_textbox_line {
|
||||||
|
struct line *next;
|
||||||
|
const char *text;
|
||||||
|
int l, w, h;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
struct gadget_textbox {
|
||||||
|
struct gadget_textbox_line *firstline, *lastline;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
struct gadget_textbox *
|
||||||
|
gadget_textbox_create(Display *dpy, struct DrawInfo *dri, GC gc,
|
||||||
|
Window mainwin, int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
struct gadget_textbox *g;
|
||||||
|
|
||||||
|
g = calloc(1, sizeof(*g));
|
||||||
|
if (g == NULL) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
g->dpy = dpy;
|
||||||
|
g->dri = dri;
|
||||||
|
g->gc = gc;
|
||||||
|
g->x = x;
|
||||||
|
g->y = y;
|
||||||
|
g->width = width;
|
||||||
|
g->height = height;
|
||||||
|
|
||||||
|
g->w = XCreateSimpleWindow(g->dpy, mainwin,
|
||||||
|
g->x, g->y,
|
||||||
|
g->width, g->height,
|
||||||
|
0,
|
||||||
|
g->dri->dri_Pens[SHADOWPEN],
|
||||||
|
g->dri->dri_Pens[BACKGROUNDPEN]);
|
||||||
|
XSelectInput(g->dpy, g->w, ExposureMask);
|
||||||
|
|
||||||
|
return (g);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gadget_textbox_free(struct gadget_textbox *g)
|
||||||
|
{
|
||||||
|
/* XXX TODO */
|
||||||
|
}
|
||||||
|
|
||||||
|
struct gadget_textbox_line *
|
||||||
|
gadget_textbox_addline(struct gadget_textbox *g, const char *text)
|
||||||
|
{
|
||||||
|
struct gadget_textbox_line *l;
|
||||||
|
|
||||||
|
l = calloc(1, sizeof(*l));
|
||||||
|
if (l == NULL) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
if(g->lastline)
|
||||||
|
g->lastline->next = l;
|
||||||
|
else
|
||||||
|
g->firstline = l;
|
||||||
|
g->lastline = l;
|
||||||
|
l->text = strdup(text);
|
||||||
|
l->l = strlen(text);
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
l->w = XmbTextEscapement(g->dri->dri_FontSet, l->text, l->l);
|
||||||
|
#else
|
||||||
|
l->w = XTextWidth(g->dri->dri_Font, l->text, l->l);
|
||||||
|
#endif
|
||||||
|
l->h = g->dri->dri_Ascent + g->dri->dri_Descent;
|
||||||
|
|
||||||
|
return (l);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gadget_textbox_refresh(struct gadget_textbox *g)
|
||||||
|
{
|
||||||
|
// This is OBVIOUSLY the wrong value for x here, but let's get it going
|
||||||
|
int x = TXT_HSPACE / 2;
|
||||||
|
int y = ((g->dri->dri_Ascent+g->dri->dri_Descent)>>1)+g->dri->dri_Ascent;
|
||||||
|
|
||||||
|
struct gadget_textbox_line *l;
|
||||||
|
|
||||||
|
/* Draw the bounding box */
|
||||||
|
XSetForeground(g->dpy, g->gc, g->dri->dri_Pens[SHADOWPEN]);
|
||||||
|
XDrawLine(g->dpy, g->w, g->gc, 0, 0, g->width-2, 0);
|
||||||
|
XDrawLine(g->dpy, g->w, g->gc, 0, 0, 0, g->height-2);
|
||||||
|
|
||||||
|
XSetForeground(g->dpy, g->gc, g->dri->dri_Pens[SHINEPEN]);
|
||||||
|
XDrawLine(g->dpy, g->w, g->gc, 0, g->height-1, g->width-1, g->height-1);
|
||||||
|
XDrawLine(g->dpy, g->w, g->gc, g->width-1, 0, g->width-1, g->height-1);
|
||||||
|
|
||||||
|
/* Draw text lines */
|
||||||
|
XSetForeground(g->dpy, g->gc, g->dri->dri_Pens[TEXTPEN]);
|
||||||
|
for(l = g->firstline; l; l=l->next) {
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
XmbDrawString(g->dpy, g->w, g->dri->dri_FontSet, g->gc,
|
||||||
|
x, y, l->text, l->l);
|
||||||
|
#else
|
||||||
|
XDrawString(g->dpy, g->w, g->gc, x, y, l->text, l->l);
|
||||||
|
#endif
|
||||||
|
y+=g->dri->dri_Ascent + g->dri->dri_Descent;
|
||||||
|
}
|
||||||
|
}
|
||||||
35
libami/gadget_textbox.h
Normal file
35
libami/gadget_textbox.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#ifndef __LIBAMI_GADGET_TEXTBOX_H__
|
||||||
|
#define __LIBAMI_GADGET_TEXTBOX_H__
|
||||||
|
|
||||||
|
// These are for the text box widget
|
||||||
|
#define TXT_HSPACE 48
|
||||||
|
#define TXT_TOPSPACE 4
|
||||||
|
#define TXT_MIDSPACE 3
|
||||||
|
#define TXT_BOTSPACE 4
|
||||||
|
|
||||||
|
struct gadget_textbox_line {
|
||||||
|
struct gadget_textbox_line *next;
|
||||||
|
const char *text;
|
||||||
|
int l, w, h;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct gadget_textbox {
|
||||||
|
Display *dpy;
|
||||||
|
struct DrawInfo *dri;
|
||||||
|
GC gc;
|
||||||
|
Window w;
|
||||||
|
int x, y;
|
||||||
|
int width, height;
|
||||||
|
|
||||||
|
struct gadget_textbox_line *firstline, *lastline;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct gadget_textbox *gadget_textbox_create(Display *dpy,
|
||||||
|
struct DrawInfo *dri, GC gc, Window mainwin, int x, int y,
|
||||||
|
int width, int height);
|
||||||
|
extern void gadget_textbox_free(struct gadget_textbox *g);
|
||||||
|
extern struct gadget_textbox_line * gadget_textbox_addline(
|
||||||
|
struct gadget_textbox *g, const char *text);
|
||||||
|
extern void gadget_textbox_refresh(struct gadget_textbox *g);
|
||||||
|
|
||||||
|
#endif /* __LIBAMI_GADGET_TEXTBOX_H__ */
|
||||||
349
libami/gadget_textinput.c
Normal file
349
libami/gadget_textinput.c
Normal file
@@ -0,0 +1,349 @@
|
|||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <X11/keysym.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#ifdef HAVE_FCNTL_H
|
||||||
|
#include <fcntl.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_STAT_H
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
#include <errno.h>
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
#include <locale.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "drawinfo.h"
|
||||||
|
|
||||||
|
#include "gadget_textinput.h"
|
||||||
|
|
||||||
|
#ifdef AMIGAOS
|
||||||
|
#include <pragmas/xlib_pragmas.h>
|
||||||
|
extern struct Library *XLibBase;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct gadget_textinput *
|
||||||
|
gadget_textinput_create(Display *dpy, struct DrawInfo *dri,
|
||||||
|
GC gc, Window mainwin, int x, int y, int width, int height,
|
||||||
|
int textsize)
|
||||||
|
{
|
||||||
|
struct gadget_textinput *b;
|
||||||
|
|
||||||
|
b = calloc(1, sizeof(*b));
|
||||||
|
if (b == NULL)
|
||||||
|
return (NULL);
|
||||||
|
b->dpy = dpy;
|
||||||
|
b->dri = dri;
|
||||||
|
b->gc = gc;
|
||||||
|
b->x = x;
|
||||||
|
b->y = y;
|
||||||
|
b->width = width;
|
||||||
|
b->height = height;
|
||||||
|
b->buf = calloc(textsize + 1, sizeof(char));
|
||||||
|
if (b->buf == NULL) {
|
||||||
|
free(b);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
b->cur_x = 6;
|
||||||
|
b->size = textsize;
|
||||||
|
b->w = XCreateSimpleWindow(dpy, mainwin, x, y,
|
||||||
|
width, height, 0,
|
||||||
|
b->dri->dri_Pens[SHADOWPEN],
|
||||||
|
b->dri->dri_Pens[BACKGROUNDPEN]);
|
||||||
|
|
||||||
|
XSelectInput(dpy, b->w, ExposureMask|ButtonPressMask);
|
||||||
|
|
||||||
|
return (b);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
void
|
||||||
|
gadget_textinput_set_xic(struct gadget_textinput *g, XIC xic)
|
||||||
|
{
|
||||||
|
g->xic = xic;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void
|
||||||
|
gadget_textinput_repaint_str(struct gadget_textinput *b)
|
||||||
|
{
|
||||||
|
int l, mx=6;
|
||||||
|
|
||||||
|
XSetForeground(b->dpy, b->gc, b->dri->dri_Pens[TEXTPEN]);
|
||||||
|
if(b->len > b->left_pos) {
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
int w, c;
|
||||||
|
|
||||||
|
for (l=0; l<b->len - b->left_pos; ) {
|
||||||
|
c=mbrlen(b->buf+b->left_pos+l, b->len-b->left_pos-l, NULL);
|
||||||
|
w=6+XmbTextEscapement(b->dri->dri_FontSet, b->buf+b->left_pos, l+c);
|
||||||
|
if(w>b->width-6)
|
||||||
|
break;
|
||||||
|
mx=w;
|
||||||
|
l+=c;
|
||||||
|
}
|
||||||
|
|
||||||
|
XmbDrawImageString(b->dpy, b->w, b->dri->dri_FontSet, b->gc,
|
||||||
|
6, 3+b->dri->dri_Ascent,
|
||||||
|
b->buf+b->left_pos, l);
|
||||||
|
#else
|
||||||
|
mx+=XTextWidth(b->dri->dri_Font, b->buf+b->left_pos, l=b->len-b->left_pos);
|
||||||
|
while(mx>b->width-6)
|
||||||
|
mx-=XTextWidth(b->dri->dri_Font, b->buf+b->left_pos + --l, 1);
|
||||||
|
XDrawImageString(b->dpy, b->w, b->gc, 6, 3+b->dri->dri_Ascent,
|
||||||
|
b->buf+b->left_pos, l);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
XSetForeground(b->dpy, b->gc, b->dri->dri_Pens[BACKGROUNDPEN]);
|
||||||
|
XFillRectangle(b->dpy, b->w, b->gc, mx, 3, b->width-mx-6, b->width - 6);
|
||||||
|
if(b->selected) {
|
||||||
|
if(b->cur_pos<b->len) {
|
||||||
|
XSetBackground(b->dpy, b->gc, ~0);
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
l=mbrlen(b->buf+b->cur_pos, b->len-b->cur_pos, NULL);
|
||||||
|
XmbDrawImageString(b->dpy, b->w, b->dri->dri_FontSet, b->gc, b->cur_x,
|
||||||
|
3+b->dri->dri_Ascent, b->buf+b->cur_pos, l);
|
||||||
|
#else
|
||||||
|
XDrawImageString(b->dpy, b->w, b->gc, cur_x, 3+b->dri->dri_Ascent,
|
||||||
|
b->buf+b->cur_pos, 1);
|
||||||
|
#endif
|
||||||
|
XSetBackground(b->dpy, b->gc, b->dri->dri_Pens[BACKGROUNDPEN]);
|
||||||
|
} else {
|
||||||
|
XSetForeground(b->dpy, b->gc, ~0);
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
XFillRectangle(b->dpy, b->w, b->gc, b->cur_x, 3,
|
||||||
|
XExtentsOfFontSet(b->dri->dri_FontSet)->
|
||||||
|
max_logical_extent.width, b->height - 6);
|
||||||
|
#else
|
||||||
|
XFillRectangle(b->dpy, b->w, b->gc, cur_x, 3,
|
||||||
|
b->dri->dri_Font->max_bounds.width, b->height - 6);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gadget_textinput_repaint(struct gadget_textinput *b)
|
||||||
|
{
|
||||||
|
|
||||||
|
gadget_textinput_repaint_str(b);
|
||||||
|
|
||||||
|
XSetForeground(b->dpy, b->gc, b->dri->dri_Pens[SHINEPEN]);
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, 0, b->height-1, 0, 0);
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, 0, 0, b->width-2, 0);
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, 3, b->height-2, b->width-4,
|
||||||
|
b->height-2);
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, b->width-4, b->height-2, b->width-4, 2);
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, 1, 1, 1, b->height-2);
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, b->width-3, 1, b->width-3, b->height-2);
|
||||||
|
XSetForeground(b->dpy, b->gc, b->dri->dri_Pens[SHADOWPEN]);
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, 1, b->height-1, b->width-1,
|
||||||
|
b->height-1);
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, b->width-1, b->height-1, b->width-1, 0);
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, 3, b->height-3, 3, 1);
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, 3, 1, b->width-4, 1);
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, 2, 1, 2, b->height-2);
|
||||||
|
XDrawLine(b->dpy, b->w, b->gc, b->width-2, 1, b->width-2, b->height-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gadget_textinput_free(struct gadget_textinput *b)
|
||||||
|
{
|
||||||
|
if (b->buf)
|
||||||
|
free(b->buf);
|
||||||
|
XDestroyWindow(b->dpy, b->w);
|
||||||
|
free(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gadget_textinput_keyevent(struct gadget_textinput *b, XKeyEvent *e)
|
||||||
|
{
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
Status stat;
|
||||||
|
#else
|
||||||
|
static XComposeStatus stat;
|
||||||
|
#endif
|
||||||
|
KeySym ks;
|
||||||
|
char buf[256];
|
||||||
|
int x, i, n;
|
||||||
|
#ifndef USE_FONTSETS
|
||||||
|
n=XLookupString(e, buf, sizeof(buf), &ks, &stat);
|
||||||
|
#else
|
||||||
|
n=XmbLookupString(b->xic, e, buf, sizeof(buf), &ks, &stat);
|
||||||
|
if(stat == XLookupKeySym || stat == XLookupBoth)
|
||||||
|
#endif
|
||||||
|
switch(ks) {
|
||||||
|
case XK_Return:
|
||||||
|
case XK_Linefeed:
|
||||||
|
b->crlf = 1;
|
||||||
|
break;
|
||||||
|
case XK_Left:
|
||||||
|
if(b->cur_pos) {
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
int p=b->cur_pos;
|
||||||
|
// int z;
|
||||||
|
while(p>0) {
|
||||||
|
--p;
|
||||||
|
if(((int)mbrlen(b->buf+p, b->cur_pos-p, NULL))>0) {
|
||||||
|
b->cur_pos=p;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
--cur_pos;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case XK_Right:
|
||||||
|
if(b->cur_pos<b->len) {
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
int l=mbrlen(b->buf+b->cur_pos, b->len-b->cur_pos, NULL);
|
||||||
|
if(l>0)
|
||||||
|
b->cur_pos+=l;
|
||||||
|
#else
|
||||||
|
b->cur_pos++;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case XK_Begin:
|
||||||
|
b->cur_pos=0;
|
||||||
|
break;
|
||||||
|
case XK_End:
|
||||||
|
b->cur_pos=b->len;
|
||||||
|
break;
|
||||||
|
case XK_Delete:
|
||||||
|
if(b->cur_pos<b->len) {
|
||||||
|
int l=1;
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
l=mbrlen(b->buf+b->cur_pos, b->len-b->cur_pos, NULL);
|
||||||
|
if(l<=0)
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
b->len-=l;
|
||||||
|
for(x=b->cur_pos; x<b->len; x++)
|
||||||
|
b->buf[x]=b->buf[x+l];
|
||||||
|
b->buf[x] = 0;
|
||||||
|
} else XBell(b->dpy, 100);
|
||||||
|
break;
|
||||||
|
case XK_BackSpace:
|
||||||
|
if(b->cur_pos>0) {
|
||||||
|
int l=1;
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
int p=b->cur_pos;
|
||||||
|
while(p>0) {
|
||||||
|
--p;
|
||||||
|
if(((int)mbrlen(b->buf+p, b->len-p, NULL))>0) {
|
||||||
|
l= b->cur_pos - p;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
b->len -= l;
|
||||||
|
for(x=(b->cur_pos-=l); x<b->len; x++)
|
||||||
|
b->buf[x]=b->buf[x+l];
|
||||||
|
b->buf[x] = 0;
|
||||||
|
} else XBell(b->dpy, 100);
|
||||||
|
break;
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
default:
|
||||||
|
if(stat == XLookupBoth)
|
||||||
|
stat = XLookupChars;
|
||||||
|
}
|
||||||
|
if(stat == XLookupChars) {
|
||||||
|
#else
|
||||||
|
default:
|
||||||
|
#endif
|
||||||
|
for(i=0; i<n && b->len<b->size-1; i++) {
|
||||||
|
for(x=b->len; x>b->cur_pos; --x)
|
||||||
|
b->buf[x]=b->buf[x-1];
|
||||||
|
b->buf[b->cur_pos++]=buf[i];
|
||||||
|
b->len++;
|
||||||
|
}
|
||||||
|
if(i<n)
|
||||||
|
XBell(b->dpy, 100);
|
||||||
|
}
|
||||||
|
if(b->cur_pos<b->left_pos)
|
||||||
|
b->left_pos=b->cur_pos;
|
||||||
|
b->cur_x=6;
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
if(b->cur_pos>b->left_pos)
|
||||||
|
b->cur_x+=XmbTextEscapement(b->dri->dri_FontSet, b->buf+b->left_pos,
|
||||||
|
b->cur_pos-b->left_pos);
|
||||||
|
if(b->cur_pos < b->len) {
|
||||||
|
int l=mbrlen(b->buf+b->cur_pos, b->len-b->cur_pos, NULL);
|
||||||
|
x=XmbTextEscapement(b->dri->dri_FontSet, b->buf+b->cur_pos, l);
|
||||||
|
} else
|
||||||
|
x=XExtentsOfFontSet(b->dri->dri_FontSet)->max_logical_extent.width;
|
||||||
|
#else
|
||||||
|
if(b->cur_pos > b->left_pos)
|
||||||
|
b->cur_x+=XTextWidth(b->dri->dri_Font, b->buf+b->left_pos, b->cur_pos-b->left_pos);
|
||||||
|
if(b->cur_pos<b->buf_len)
|
||||||
|
x=XTextWidth(b->dri->dri_Font, b->buf+b->cur_pos, 1);
|
||||||
|
else
|
||||||
|
x=b->dri->dri_Font->max_bounds.width;
|
||||||
|
#endif
|
||||||
|
if((x+=b->cur_x-(b->width-6))>0) {
|
||||||
|
b->cur_x-=x;
|
||||||
|
while(x>0) {
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
int l=mbrlen(b->buf+b->left_pos, b->len-b->left_pos, NULL);
|
||||||
|
x-=XmbTextEscapement(b->dri->dri_FontSet, b->buf+b->left_pos, l);
|
||||||
|
b->left_pos += l;
|
||||||
|
#else
|
||||||
|
x-=XTextWidth(b->dri->dri_Font, b->buf+b->left_pos++, 1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
b->cur_x+=x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
gadget_textinput_buttonevent(struct gadget_textinput *b, XButtonEvent *e)
|
||||||
|
{
|
||||||
|
int w, l=1;
|
||||||
|
b->cur_pos=b->left_pos;
|
||||||
|
b->cur_x=6;
|
||||||
|
while(b->cur_x<e->x && b->cur_pos<b->len) {
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
l=mbrlen(b->buf+b->cur_pos, b->len-b->cur_pos, NULL);
|
||||||
|
if(l<=0)
|
||||||
|
break;
|
||||||
|
w=XmbTextEscapement(b->dri->dri_FontSet, b->buf+b->cur_pos, l);
|
||||||
|
#else
|
||||||
|
w=XTextWidth(b->dri->dri_Font, b->buf+b->cur_pos, 1);
|
||||||
|
#endif
|
||||||
|
if(b->cur_x+w>e->x)
|
||||||
|
break;
|
||||||
|
b->cur_x+=w;
|
||||||
|
b->cur_pos+=l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
void strbutton(XButtonEvent *e)
|
||||||
|
{
|
||||||
|
refresh_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void
|
||||||
|
gadget_textinput_selected(struct gadget_textinput *b, int selected)
|
||||||
|
{
|
||||||
|
b->selected = selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
gadget_textinput_crlf(struct gadget_textinput *b)
|
||||||
|
{
|
||||||
|
return (b->crlf);
|
||||||
|
}
|
||||||
46
libami/gadget_textinput.h
Normal file
46
libami/gadget_textinput.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#ifndef __LIBAMI__GADGET_TEXTINPUT_H__
|
||||||
|
#define __LIBAMI__GADGET_TEXTINPUT_H__
|
||||||
|
|
||||||
|
struct gadget_textinput {
|
||||||
|
Display *dpy;
|
||||||
|
struct DrawInfo *dri;
|
||||||
|
Window w;
|
||||||
|
GC gc;
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
XIC xic;
|
||||||
|
#endif
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
|
||||||
|
/* XXX TODO: create a string representation here already */
|
||||||
|
char *buf;
|
||||||
|
int len;
|
||||||
|
int size;
|
||||||
|
|
||||||
|
/* Position of textbox cursor and rendering start */
|
||||||
|
int cur_pos;
|
||||||
|
int left_pos;
|
||||||
|
int cur_x;
|
||||||
|
|
||||||
|
int selected;
|
||||||
|
int crlf;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct gadget_textinput * gadget_textinput_create(Display *dpy,
|
||||||
|
struct DrawInfo *dri, GC gc, Window mainwin,
|
||||||
|
int x, int y, int width, int height, int text_size);
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
extern void gadget_textinput_set_xic(struct gadget_textinput *g, XIC xic);
|
||||||
|
#endif
|
||||||
|
extern void gadget_textinput_repaint(struct gadget_textinput *b);
|
||||||
|
extern void gadget_textinput_free(struct gadget_textinput *b);
|
||||||
|
extern void gadget_textinput_keyevent(struct gadget_textinput *b,
|
||||||
|
XKeyEvent *e);
|
||||||
|
extern void gadget_textinput_buttonevent(struct gadget_textinput *b,
|
||||||
|
XButtonEvent *e);
|
||||||
|
extern void gadget_textinput_selected(struct gadget_textinput *b, int selected);
|
||||||
|
extern int gadget_textinput_crlf(struct gadget_textinput *b);
|
||||||
|
|
||||||
|
#endif /* __LIBAMI__GADGET_TEXTINPUT_H__ */
|
||||||
@@ -67,7 +67,7 @@ static void lookup_hotkey(struct hotkey *hk)
|
|||||||
if((hk->keysym&~0x20)>=XK_A && (hk->keysym&~0x20)<=XK_Z)
|
if((hk->keysym&~0x20)>=XK_A && (hk->keysym&~0x20)<=XK_Z)
|
||||||
hk->keycode=XKeysymToKeycode(dpy, hk->keysym^0x20);
|
hk->keycode=XKeysymToKeycode(dpy, hk->keysym^0x20);
|
||||||
|
|
||||||
if(hk->keycode && keymap)
|
if(hk->keycode && keymap) {
|
||||||
if(keymap[(hk->keycode-kbd_mincode)*kbd_maxsym])
|
if(keymap[(hk->keycode-kbd_mincode)*kbd_maxsym])
|
||||||
;
|
;
|
||||||
else if(kbd_maxsym>1 && keymap[(hk->keycode-kbd_mincode)*kbd_maxsym+1])
|
else if(kbd_maxsym>1 && keymap[(hk->keycode-kbd_mincode)*kbd_maxsym+1])
|
||||||
@@ -76,6 +76,7 @@ static void lookup_hotkey(struct hotkey *hk)
|
|||||||
hk->modifiers|=switch_mask;
|
hk->modifiers|=switch_mask;
|
||||||
else if(kbd_maxsym>3 && keymap[(hk->keycode-kbd_mincode)*kbd_maxsym+3])
|
else if(kbd_maxsym>3 && keymap[(hk->keycode-kbd_mincode)*kbd_maxsym+3])
|
||||||
hk->modifiers|=ShiftMask|switch_mask;
|
hk->modifiers|=ShiftMask|switch_mask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rethink_keymap()
|
static void rethink_keymap()
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ static LONG unpack_rle(unsigned char *src, LONG srclen, char *dst, LONG dstlen,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(src != srcn)
|
if(src != srcn)
|
||||||
fprintf(stderr, "Warning: Left %d bytes unused.\n", srcn-src);
|
fprintf(stderr, "Warning: Left %d bytes unused.\n", (int) (srcn-src));
|
||||||
return dst-dst0;
|
return dst-dst0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,12 +505,13 @@ struct DiskObject *GetDefDiskObject(LONG def_type)
|
|||||||
|
|
||||||
if(def_type<WBDISK || def_type>WBAPPICON)
|
if(def_type<WBDISK || def_type>WBAPPICON)
|
||||||
return NULL;
|
return NULL;
|
||||||
if(!icondir)
|
if(!icondir) {
|
||||||
if(!(icondir = get_current_icondir()))
|
if(!(icondir = get_current_icondir())) {
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
} else {
|
||||||
l = strlen(icondir);
|
l = strlen(icondir);
|
||||||
|
}
|
||||||
|
}
|
||||||
#ifdef HAVE_ALLOCA
|
#ifdef HAVE_ALLOCA
|
||||||
buf = alloca(l+18);
|
buf = alloca(l+18);
|
||||||
#else
|
#else
|
||||||
|
|||||||
BIN
libami/libami.a
BIN
libami/libami.a
Binary file not shown.
@@ -368,6 +368,9 @@ extern int md_front(Window);
|
|||||||
extern int md_back(Window);
|
extern int md_back(Window);
|
||||||
extern int md_iconify(Window);
|
extern int md_iconify(Window);
|
||||||
extern int md_errormsg(Window, char *);
|
extern int md_errormsg(Window, char *);
|
||||||
|
extern int md_rotate_window_raise(Window);
|
||||||
|
extern int md_rotate_window_lower(Window);
|
||||||
|
extern int md_rotate_window_desktop(Window);
|
||||||
|
|
||||||
/* eventdispatcher.c */
|
/* eventdispatcher.c */
|
||||||
extern void cx_event_broker(int, unsigned long, int (*)(XEvent*));
|
extern void cx_event_broker(int, unsigned long, int (*)(XEvent*));
|
||||||
@@ -387,6 +390,9 @@ extern Pixmap md_image_to_pixmap(Window, unsigned long, struct Image *,
|
|||||||
int, int, struct ColorStore *);
|
int, int, struct ColorStore *);
|
||||||
extern char *get_current_icondir(void);
|
extern char *get_current_icondir(void);
|
||||||
|
|
||||||
|
/* mdbattery.c */
|
||||||
|
extern void md_update_battery(int pct, int time, int ac);
|
||||||
|
|
||||||
/* mdwindow.c */
|
/* mdwindow.c */
|
||||||
extern int md_set_appwindow(Window);
|
extern int md_set_appwindow(Window);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#ifndef AMIGAOS
|
#ifndef AMIGAOS
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
void NewList(struct List *list)
|
void NewList(struct List *list)
|
||||||
{
|
{
|
||||||
list->lh_TailPred = (struct Node *)&list->lh_Head;
|
list->lh_TailPred = (struct Node *)&list->lh_Head;
|
||||||
|
|||||||
85
libami/mdbattery.c
Normal file
85
libami/mdbattery.c
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "libami.h"
|
||||||
|
#include "module.h"
|
||||||
|
#include "alloc.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
md_update_battery(int pct, int time, int ac)
|
||||||
|
{
|
||||||
|
struct mcmd_update_battery batt = { 0 };
|
||||||
|
int res;
|
||||||
|
|
||||||
|
batt.battery_time = time;
|
||||||
|
batt.battery_pct = pct;
|
||||||
|
batt.battery_ac = ac;
|
||||||
|
|
||||||
|
res = md_command0(None, MCMD_UPDATE_BATTERY, &batt, sizeof(batt));
|
||||||
|
(void) res;
|
||||||
|
}
|
||||||
|
|
||||||
|
Window md_create_appicon(Window p, int x, int y, char *name,
|
||||||
|
Pixmap pm1, Pixmap pm2, Pixmap pmm)
|
||||||
|
{
|
||||||
|
char *data;
|
||||||
|
Window w;
|
||||||
|
int res, l=strlen(name);
|
||||||
|
#ifdef HAVE_ALLOCA
|
||||||
|
struct NewAppIcon *nai=alloca(sizeof(struct NewAppIcon)+l);
|
||||||
|
#else
|
||||||
|
struct NewAppIcon *nai=malloc(sizeof(struct NewAppIcon)+l);
|
||||||
|
if(nai==NULL) return None;
|
||||||
|
#endif
|
||||||
|
nai->x=x; nai->y=y;
|
||||||
|
nai->pm1=pm1; nai->pm2=pm2; nai->pmm=pmm;
|
||||||
|
strcpy(nai->name, name);
|
||||||
|
res=md_command(p, MCMD_CREATEAPPICON, nai, sizeof(struct NewAppIcon)+l,
|
||||||
|
&data);
|
||||||
|
if(res<sizeof(w)) {
|
||||||
|
if(data) free(data);
|
||||||
|
#ifndef HAVE_ALLOCA
|
||||||
|
free(nai);
|
||||||
|
#endif
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
memcpy(&w, data, sizeof(w));
|
||||||
|
free(data);
|
||||||
|
#ifndef HAVE_ALLOCA
|
||||||
|
free(nai);
|
||||||
|
#endif
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pixmap md_image_to_pixmap(Window w, unsigned long bgcolor, struct Image *i,
|
||||||
|
int width, int height, struct ColorStore *cs)
|
||||||
|
{
|
||||||
|
Display *dpy = md_display();
|
||||||
|
static GC gc = None;
|
||||||
|
Pixmap pm;
|
||||||
|
static int iconcolormask;
|
||||||
|
static unsigned long *iconcolor = NULL;
|
||||||
|
if(gc == None && w != None)
|
||||||
|
gc = XCreateGC(dpy, w, 0, NULL);
|
||||||
|
if(iconcolor == NULL) {
|
||||||
|
char *p;
|
||||||
|
int res = md_command(w, MCMD_GETICONPALETTE, NULL, 0, &p);
|
||||||
|
if(res<0)
|
||||||
|
return None;
|
||||||
|
iconcolor = (unsigned long *)(void *)p;
|
||||||
|
iconcolormask = (res/sizeof(unsigned long))-1;
|
||||||
|
}
|
||||||
|
pm = image_to_pixmap(md_display(), w, gc, bgcolor, iconcolor, iconcolormask,
|
||||||
|
i, width, height, cs);
|
||||||
|
return pm;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *get_current_icondir()
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
if(md_command(None, MCMD_GETICONDIR, NULL, 0, &p)>=0 && p)
|
||||||
|
return p;
|
||||||
|
if(p) free(p);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -22,6 +22,21 @@ int md_iconify(XID id)
|
|||||||
return md_command00(id, MCMD_ICONIFY);
|
return md_command00(id, MCMD_ICONIFY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int md_rotate_window_raise(XID id)
|
||||||
|
{
|
||||||
|
return md_command00(id, MCMD_ROTATE_WINDOW_RAISE);
|
||||||
|
}
|
||||||
|
|
||||||
|
int md_rotate_window_lower(XID id)
|
||||||
|
{
|
||||||
|
return md_command00(id, MCMD_ROTATE_WINDOW_LOWER);
|
||||||
|
}
|
||||||
|
|
||||||
|
int md_rotate_window_desktop(XID id)
|
||||||
|
{
|
||||||
|
return md_command00(id, MCMD_WINDOW_MOVE_NEXT_DESKTOP);
|
||||||
|
}
|
||||||
|
|
||||||
int md_errormsg(Window id, char *str)
|
int md_errormsg(Window id, char *str)
|
||||||
{
|
{
|
||||||
return md_command0(id, MCMD_ERRORMSG, str, strlen(str));
|
return md_command0(id, MCMD_ERRORMSG, str, strlen(str));
|
||||||
|
|||||||
263
libami/module.c
263
libami/module.c
@@ -8,6 +8,7 @@
|
|||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <sys/select.h>
|
||||||
|
|
||||||
#include "libami.h"
|
#include "libami.h"
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
@@ -24,6 +25,7 @@ Window md_root = None;
|
|||||||
static int md_int_len=0;
|
static int md_int_len=0;
|
||||||
static char *md_int_buf=NULL;
|
static char *md_int_buf=NULL;
|
||||||
void (*md_broker_func)(XEvent *, unsigned long);
|
void (*md_broker_func)(XEvent *, unsigned long);
|
||||||
|
void (*md_periodic_func)(void);
|
||||||
|
|
||||||
void md_exit(int signal)
|
void md_exit(int signal)
|
||||||
{
|
{
|
||||||
@@ -39,11 +41,12 @@ static int md_write(void *ptr, int len)
|
|||||||
char *p=ptr;
|
char *p=ptr;
|
||||||
int r, tot=0;
|
int r, tot=0;
|
||||||
while(len>0) {
|
while(len>0) {
|
||||||
if((r=write(md_out_fd, p, len))<0)
|
if((r=write(md_out_fd, p, len))<0) {
|
||||||
if(errno==EINTR)
|
if(errno==EINTR)
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
return r;
|
return r;
|
||||||
|
}
|
||||||
if(!r)
|
if(!r)
|
||||||
return tot;
|
return tot;
|
||||||
tot+=r;
|
tot+=r;
|
||||||
@@ -53,37 +56,138 @@ static int md_write(void *ptr, int len)
|
|||||||
return tot;
|
return tot;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int md_read(void *ptr, int len)
|
/*
|
||||||
|
* Wait until the read FD is ready, or timeout (5 seconds.)
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* + 1 if OK
|
||||||
|
* + 0 if timeout
|
||||||
|
* < 0 if error
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
md_wait_read_fd(void)
|
||||||
|
{
|
||||||
|
fd_set readfds;
|
||||||
|
struct timeval tv;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
FD_ZERO(&readfds);
|
||||||
|
FD_SET(md_in_fd, &readfds);
|
||||||
|
tv.tv_sec = 5;
|
||||||
|
tv.tv_usec = 0;
|
||||||
|
|
||||||
|
ret = select(md_in_fd + 1, &readfds, NULL, NULL, &tv);
|
||||||
|
if (ret == 0) {
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
if (ret < 0) {
|
||||||
|
/*
|
||||||
|
* Note: this happens during things like system suspend/resume
|
||||||
|
* on FreeBSD.
|
||||||
|
*/
|
||||||
|
if (errno == EINTR) {
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if (FD_ISSET(md_in_fd, &readfds)) {
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FD wasn't set; just return 0 */
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read from the input file descriptor until len; ,populate
|
||||||
|
* our buffer.
|
||||||
|
*
|
||||||
|
* Return total read, 0 on timeout, else -1 on error.
|
||||||
|
*/
|
||||||
|
static int md_read(void *ptr, int len, int block)
|
||||||
{
|
{
|
||||||
char *p=ptr;
|
char *p=ptr;
|
||||||
int r, tot=0;
|
int r, tot=0;
|
||||||
while(len>0) {
|
|
||||||
if((r=read(md_in_fd, p, len))<0)
|
while (len > 0) {
|
||||||
if(errno==EINTR)
|
|
||||||
continue;
|
/* Wait until the socket is ready, or timeout */
|
||||||
else
|
r = md_wait_read_fd();
|
||||||
return r;
|
if (r < 0) {
|
||||||
if(!r)
|
return (-1);
|
||||||
if(tot)
|
}
|
||||||
return tot;
|
|
||||||
else
|
/*
|
||||||
md_exit(0);
|
* Note: If we've read /anything/, then we just keep
|
||||||
|
* going until we're done. Otherwise we'll exit
|
||||||
|
* out here with a partial read and things will
|
||||||
|
* go sideways.
|
||||||
|
*
|
||||||
|
* If we're not blocking and select timed out,
|
||||||
|
* return timeout.
|
||||||
|
*/
|
||||||
|
if ((tot == 0) && (block == 0) && (r == 0)) {
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to read some data. Go back around again
|
||||||
|
* if we hit EINTR/EWOULDBLOCK.
|
||||||
|
*
|
||||||
|
* If we hit EOF then that's an error.
|
||||||
|
*/
|
||||||
|
r = read(md_in_fd, p, len);
|
||||||
|
|
||||||
|
/* Error */
|
||||||
|
if (r < 0) {
|
||||||
|
if ((errno == EINTR) || (errno == EWOULDBLOCK)) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* EOF and didn't read anything? md_exit() like
|
||||||
|
* the old code did.
|
||||||
|
*/
|
||||||
|
if ((r == 0) && (tot == 0)) {
|
||||||
|
md_exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* EOF, but we read data, so at least return what
|
||||||
|
* we did read.
|
||||||
|
*/
|
||||||
|
if (r == 0) {
|
||||||
|
return (tot);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* r > 0 here */
|
||||||
|
|
||||||
tot+=r;
|
tot+=r;
|
||||||
p+=r;
|
p+=r;
|
||||||
len-=r;
|
len-=r;
|
||||||
}
|
}
|
||||||
return tot;
|
|
||||||
|
return (tot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read in "len" bytes from the window manager command path
|
||||||
|
* into md_int_buf.
|
||||||
|
*/
|
||||||
static int md_int_load(int len)
|
static int md_int_load(int len)
|
||||||
{
|
{
|
||||||
if(len>=md_int_len)
|
if(len>=md_int_len) {
|
||||||
if(md_int_buf!=NULL)
|
if(md_int_buf!=NULL)
|
||||||
md_int_buf=realloc(md_int_buf, md_int_len=len+1);
|
md_int_buf=realloc(md_int_buf, md_int_len=len+1);
|
||||||
else
|
else
|
||||||
md_int_buf=malloc(md_int_len=len+1);
|
md_int_buf=malloc(md_int_len=len+1);
|
||||||
|
}
|
||||||
|
|
||||||
md_int_buf[len]='\0';
|
md_int_buf[len]='\0';
|
||||||
return md_read(md_int_buf, len);
|
return md_read(md_int_buf, len, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct md_queued_event {
|
static struct md_queued_event {
|
||||||
@@ -91,6 +195,13 @@ static struct md_queued_event {
|
|||||||
struct mcmd_event e;
|
struct mcmd_event e;
|
||||||
} *event_head=NULL, *event_tail=NULL;
|
} *event_head=NULL, *event_tail=NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Process queued XEvents from the window manager.
|
||||||
|
*
|
||||||
|
* The window manager pushes subscribed XEvents down to
|
||||||
|
* modules and this pulls them out of the queue and
|
||||||
|
* calls md_broker_func() on each of them.
|
||||||
|
*/
|
||||||
void md_process_queued_events()
|
void md_process_queued_events()
|
||||||
{
|
{
|
||||||
struct md_queued_event *e;
|
struct md_queued_event *e;
|
||||||
@@ -102,6 +213,12 @@ void md_process_queued_events()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enqueue an mcmd event into the event queue.
|
||||||
|
*
|
||||||
|
* This is called when there's an XEvent being queued
|
||||||
|
* from the window manager to the module.
|
||||||
|
*/
|
||||||
static void md_enqueue(struct mcmd_event *e)
|
static void md_enqueue(struct mcmd_event *e)
|
||||||
{
|
{
|
||||||
struct md_queued_event *qe=malloc(sizeof(struct md_queued_event));
|
struct md_queued_event *qe=malloc(sizeof(struct md_queued_event));
|
||||||
@@ -117,6 +234,13 @@ static void md_enqueue(struct mcmd_event *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read an async XEvent from the window manager.
|
||||||
|
*
|
||||||
|
* This is called by md_handle_input() to read an XEvent.
|
||||||
|
* The "I'm an Xevent" marker is ~len, so it's de-inverted
|
||||||
|
* and then a subsequent len field match must match it.
|
||||||
|
*/
|
||||||
static int md_get_async(int len)
|
static int md_get_async(int len)
|
||||||
{
|
{
|
||||||
if(md_int_load(len)!=len)
|
if(md_int_load(len)!=len)
|
||||||
@@ -126,18 +250,47 @@ static int md_get_async(int len)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int md_handle_input()
|
/*
|
||||||
|
* Read input from the window manager.
|
||||||
|
*
|
||||||
|
* This reads two chunks - the size of the request,
|
||||||
|
* and then the request itself.
|
||||||
|
*
|
||||||
|
* Negative request lengths are treated special - they're
|
||||||
|
* treated as XEvents thrown into the input stream.
|
||||||
|
*
|
||||||
|
* Returns >1 if got input, 0 if timed out, < 0 if error.
|
||||||
|
*/
|
||||||
|
int md_handle_input(void)
|
||||||
{
|
{
|
||||||
int res;
|
int res, ret;
|
||||||
|
|
||||||
|
/* Read the length of the request, don't block. */
|
||||||
|
ret = md_read(&res, sizeof(res), 0);
|
||||||
|
|
||||||
|
/* Timeout? */
|
||||||
|
if (ret == 0) {
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Error? */
|
||||||
|
if (ret < 0) {
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read size doesn't match request size? */
|
||||||
|
if (ret != sizeof(res)) {
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
if(md_read(&res, sizeof(res))!=sizeof(res))
|
|
||||||
return -1;
|
|
||||||
if(res>=0) {
|
if(res>=0) {
|
||||||
if(!res)
|
if(!res)
|
||||||
return 0;
|
return 0;
|
||||||
|
/* Read the command */
|
||||||
md_int_load(res);
|
md_int_load(res);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
/* Negative length; treat as an XEvent */
|
||||||
res=~res;
|
res=~res;
|
||||||
if(!res)
|
if(!res)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -145,6 +298,16 @@ int md_handle_input()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Send a command from the module back to the window manager.
|
||||||
|
*
|
||||||
|
* This sends a request up to the window manager and then reads the
|
||||||
|
* response to return. If asynchronous XEvents occur in the reply
|
||||||
|
* stream then those are enqueued via md_get_async().
|
||||||
|
*
|
||||||
|
* If there is a response, buffer is set to a memory buffer containing it.
|
||||||
|
* It is thus up to the caller to free it.
|
||||||
|
*/
|
||||||
int md_command(XID id, int cmd, void *data, int data_len, char **buffer)
|
int md_command(XID id, int cmd, void *data, int data_len, char **buffer)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
@@ -156,21 +319,38 @@ int md_command(XID id, int cmd, void *data, int data_len, char **buffer)
|
|||||||
mcmd.cmd = cmd;
|
mcmd.cmd = cmd;
|
||||||
mcmd.len = data_len;
|
mcmd.len = data_len;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Send header, read response code.
|
||||||
|
*/
|
||||||
if(md_write(&mcmd, sizeof(mcmd))!=sizeof(mcmd) ||
|
if(md_write(&mcmd, sizeof(mcmd))!=sizeof(mcmd) ||
|
||||||
md_write(data, data_len)!=data_len ||
|
md_write(data, data_len)!=data_len ||
|
||||||
md_read(&res, sizeof(res))!=sizeof(res))
|
md_read(&res, sizeof(res), 1)!=sizeof(res))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the response code is negative (well, less than -1)
|
||||||
|
* then its treated as an async XEvent. So, queue that
|
||||||
|
* and keep reading for the response code.
|
||||||
|
*/
|
||||||
while(res<-1) {
|
while(res<-1) {
|
||||||
md_get_async(~res);
|
md_get_async(~res);
|
||||||
if(md_read(&res, sizeof(res))!=sizeof(res))
|
if(md_read(&res, sizeof(res), 1)!=sizeof(res))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the response code is >0, then allocate a buffer
|
||||||
|
* of a suitable size and read the response into the buffer.
|
||||||
|
*/
|
||||||
if(res>0) {
|
if(res>0) {
|
||||||
*buffer=malloc(res);
|
*buffer=malloc(res);
|
||||||
if(md_read(*buffer, res)!=res)
|
if(md_read(*buffer, res, 1)!=res)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the response size.
|
||||||
|
*/
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,6 +381,23 @@ Display *md_display()
|
|||||||
return dpy;
|
return dpy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* make the fd blocking or non-blocking.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
md_fd_nonblocking(int fd, int nb)
|
||||||
|
{
|
||||||
|
int ret, val;
|
||||||
|
|
||||||
|
val = fcntl(fd, F_GETFD);
|
||||||
|
if (nb) {
|
||||||
|
ret = fcntl(fd, F_SETFD, val | O_NONBLOCK);
|
||||||
|
} else {
|
||||||
|
ret = fcntl(fd, F_SETFD, val & ~O_NONBLOCK);
|
||||||
|
}
|
||||||
|
return (ret == 0);
|
||||||
|
}
|
||||||
|
|
||||||
char *md_init(int argc, char *argv[])
|
char *md_init(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if(argc>0)
|
if(argc>0)
|
||||||
@@ -222,12 +419,24 @@ char *md_init(int argc, char *argv[])
|
|||||||
if(md_command(None, MCMD_GET_VERSION, NULL, 0, &amiwm_version)<=0)
|
if(md_command(None, MCMD_GET_VERSION, NULL, 0, &amiwm_version)<=0)
|
||||||
md_fail();
|
md_fail();
|
||||||
|
|
||||||
|
md_fd_nonblocking(md_in_fd, 1);
|
||||||
|
|
||||||
return (argc>4? argv[4]:NULL);
|
return (argc>4? argv[4]:NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void md_main_loop()
|
void
|
||||||
|
md_main_loop()
|
||||||
{
|
{
|
||||||
do md_process_queued_events(); while(md_handle_input()>=0);
|
do {
|
||||||
|
if (md_periodic_func != NULL) {
|
||||||
|
md_periodic_func();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Process async XEvent events that have been read */
|
||||||
|
md_process_queued_events();
|
||||||
|
|
||||||
|
/* Loop over, reading input events */
|
||||||
|
} while(md_handle_input()>=0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int md_connection_number()
|
int md_connection_number()
|
||||||
|
|||||||
@@ -229,11 +229,12 @@ LONG FindArg(STRPTR template, STRPTR keyword)
|
|||||||
ch=*template++;
|
ch=*template++;
|
||||||
if(!ch)
|
if(!ch)
|
||||||
return (kwindex == kwlen? argindex : -1);
|
return (kwindex == kwlen? argindex : -1);
|
||||||
if(ch == ',' || ch == '=' || ch == '/')
|
if(ch == ',' || ch == '=' || ch == '/') {
|
||||||
if(kwindex == kwlen)
|
if(kwindex == kwlen)
|
||||||
return argindex;
|
return argindex;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
} while(ToUpper(ch) == ToUpper(keyword[kwindex++]));
|
} while(ToUpper(ch) == ToUpper(keyword[kwindex++]));
|
||||||
|
|
||||||
while(ch != '=') {
|
while(ch != '=') {
|
||||||
@@ -353,7 +354,7 @@ struct RDArgs * ReadArgs(STRPTR template, LONG *array, struct RDArgs *rdargs)
|
|||||||
while(numargs-->0) {
|
while(numargs-->0) {
|
||||||
int isnumeric=0;
|
int isnumeric=0;
|
||||||
|
|
||||||
if((*swptr)&RA_MULTI)
|
if((*swptr)&RA_MULTI) {
|
||||||
if(multinum) {
|
if(multinum) {
|
||||||
((Argtype *)array)->ptr=ra_alloc(rdargs,
|
((Argtype *)array)->ptr=ra_alloc(rdargs,
|
||||||
sizeof(Argtype)*(multinum+1));
|
sizeof(Argtype)*(multinum+1));
|
||||||
@@ -365,6 +366,7 @@ struct RDArgs * ReadArgs(STRPTR template, LONG *array, struct RDArgs *rdargs)
|
|||||||
isnumeric=((*swptr)&RA_NUMERIC)!=0;
|
isnumeric=((*swptr)&RA_NUMERIC)!=0;
|
||||||
}
|
}
|
||||||
else ((Argtype *)array)->ptr=NULL;
|
else ((Argtype *)array)->ptr=NULL;
|
||||||
|
}
|
||||||
array=(LONG*)(((Argtype *)array)+1);
|
array=(LONG*)(((Argtype *)array)+1);
|
||||||
if(!((sw=*swptr++)&RA_FOUND) && (sw&RA_ALWAYS)) {
|
if(!((sw=*swptr++)&RA_FOUND) && (sw&RA_ALWAYS)) {
|
||||||
if((!lastmarg) || (sw&RA_KEYWORD) || multinum<2 ||
|
if((!lastmarg) || (sw&RA_KEYWORD) || multinum<2 ||
|
||||||
|
|||||||
178
menu.c
178
menu.c
@@ -19,7 +19,8 @@
|
|||||||
" " LF "version "VERSION LF "by Marcus Comstedt" LF \
|
" " LF "version "VERSION LF "by Marcus Comstedt" LF \
|
||||||
"<marcus@lysator.liu.se>" LF " " LF \
|
"<marcus@lysator.liu.se>" LF " " LF \
|
||||||
"Contributions by Scott Lawrence" LF "<amiwm10@umlautllama.com>" LF \
|
"Contributions by Scott Lawrence" LF "<amiwm10@umlautllama.com>" LF \
|
||||||
"and Nicolas Sipieter " LF "<freeeaks@gmail.com>" LF " " LF
|
"and Nicolas Sipieter " LF "<freeeaks@gmail.com>" LF " " LF \
|
||||||
|
"Some small contributions by redsPL" LF "<reds@sakamoto.pl>" LF " " LF
|
||||||
|
|
||||||
#ifdef AMIGAOS
|
#ifdef AMIGAOS
|
||||||
#include <pragmas/xlib_pragmas.h>
|
#include <pragmas/xlib_pragmas.h>
|
||||||
@@ -36,6 +37,8 @@ extern struct Library *XLibBase;
|
|||||||
#define CHECKED 2
|
#define CHECKED 2
|
||||||
#define DISABLED 4
|
#define DISABLED 4
|
||||||
|
|
||||||
|
char battery_status[128];
|
||||||
|
|
||||||
extern Display *dpy;
|
extern Display *dpy;
|
||||||
extern Cursor wm_curs;
|
extern Cursor wm_curs;
|
||||||
extern XContext screen_context, client_context;
|
extern XContext screen_context, client_context;
|
||||||
@@ -45,6 +48,7 @@ extern void select_all_icons(Scrn *i);
|
|||||||
extern void mod_menuselect(struct module *, int, int, int);
|
extern void mod_menuselect(struct module *, int, int, int);
|
||||||
extern void setfocus(Window);
|
extern void setfocus(Window);
|
||||||
extern void flushmodules();
|
extern void flushmodules();
|
||||||
|
extern void wberror(Scrn *, char *);
|
||||||
|
|
||||||
Scrn *mbdclick=NULL, *mbdscr=NULL;
|
Scrn *mbdclick=NULL, *mbdscr=NULL;
|
||||||
|
|
||||||
@@ -301,7 +305,7 @@ void redraw_item(struct Item *i, Window w)
|
|||||||
XSetForeground(dpy, scr->menubargc, scr->dri.dri_Pens[BARDETAILPEN]);
|
XSetForeground(dpy, scr->menubargc, scr->dri.dri_Pens[BARDETAILPEN]);
|
||||||
XSetBackground(dpy, scr->menubargc, scr->dri.dri_Pens[BARBLOCKPEN]);
|
XSetBackground(dpy, scr->menubargc, scr->dri.dri_Pens[BARBLOCKPEN]);
|
||||||
}
|
}
|
||||||
if(i->text)
|
if(i->text) {
|
||||||
#ifdef USE_FONTSETS
|
#ifdef USE_FONTSETS
|
||||||
XmbDrawImageString(dpy, w, scr->dri.dri_FontSet,
|
XmbDrawImageString(dpy, w, scr->dri.dri_FontSet,
|
||||||
scr->menubargc, (i->flags&CHECKIT)?1+scr->checkmarkspace:1,
|
scr->menubargc, (i->flags&CHECKIT)?1+scr->checkmarkspace:1,
|
||||||
@@ -310,23 +314,24 @@ void redraw_item(struct Item *i, Window w)
|
|||||||
XDrawImageString(dpy, w, scr->menubargc, (i->flags&CHECKIT)?1+scr->checkmarkspace:1,
|
XDrawImageString(dpy, w, scr->menubargc, (i->flags&CHECKIT)?1+scr->checkmarkspace:1,
|
||||||
scr->dri.dri_Ascent+1, i->text, i->textlen);
|
scr->dri.dri_Ascent+1, i->text, i->textlen);
|
||||||
#endif
|
#endif
|
||||||
else
|
} else {
|
||||||
XFillRectangle(dpy, w, scr->menubargc, 2, 2, m->width-10, 2);
|
XFillRectangle(dpy, w, scr->menubargc, 2, 2, m->width-10, 2);
|
||||||
|
}
|
||||||
if(i->sub) {
|
if(i->sub) {
|
||||||
int x=m->width-6-scr->hotkeyspace-1+8;
|
int x=m->width-6-scr->hotkeyspace-1+8;
|
||||||
#ifdef USE_FONTSETS
|
#ifdef USE_FONTSETS
|
||||||
#ifdef HAVE_XUTF8DRAWIMAGESTRING
|
#ifdef HAVE_XUTF8DRAWIMAGESTRING
|
||||||
Xutf8DrawImageString(dpy, w, scr->dri.dri_FontSet,
|
Xutf8DrawImageString(dpy, w, scr->dri.dri_FontSet,
|
||||||
scr->menubargc, x+scr->dri.dri_Ascent+1,
|
scr->menubargc, x+scr->dri.dri_Ascent+1,
|
||||||
1+scr->dri.dri_Ascent, "\302\273", 2);
|
1+scr->dri.dri_Ascent, "»", 2);
|
||||||
#else
|
#else
|
||||||
XmbDrawImageString(dpy, w, scr->dri.dri_FontSet,
|
XmbDrawImageString(dpy, w, scr->dri.dri_FontSet,
|
||||||
scr->menubargc, x+scr->dri.dri_Ascent+1,
|
scr->menubargc, x+scr->dri.dri_Ascent+1,
|
||||||
1+scr->dri.dri_Ascent, "»", 1);
|
1+scr->dri.dri_Ascent, "\xBB", 1);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
XDrawImageString(dpy, w, scr->menubargc, x+scr->dri.dri_Ascent+1,
|
XDrawImageString(dpy, w, scr->menubargc, x+scr->dri.dri_Ascent+1,
|
||||||
1+scr->dri.dri_Ascent, "»", 1);
|
1+scr->dri.dri_Ascent, "\xBB", 1);
|
||||||
#endif
|
#endif
|
||||||
} else if(i->hotkey) {
|
} else if(i->hotkey) {
|
||||||
int x=m->width-6-scr->hotkeyspace-1+8;
|
int x=m->width-6-scr->hotkeyspace-1+8;
|
||||||
@@ -360,29 +365,46 @@ void redraw_item(struct Item *i, Window w)
|
|||||||
void createmenubar()
|
void createmenubar()
|
||||||
{
|
{
|
||||||
XSetWindowAttributes attr;
|
XSetWindowAttributes attr;
|
||||||
struct Menu *m, *sm1, *sm2, *sm3;
|
struct Menu *m, *sm1;
|
||||||
|
// struct Menu *sm2, *sm3;
|
||||||
struct ToolItem *ti;
|
struct ToolItem *ti;
|
||||||
GC gc;
|
GC gc;
|
||||||
|
|
||||||
scr->firstmenu = NULL;
|
scr->firstmenu = NULL;
|
||||||
attr.override_redirect=True;
|
attr.override_redirect=True;
|
||||||
attr.background_pixel=scr->dri.dri_Pens[BARBLOCKPEN];
|
|
||||||
scr->menubar=XCreateWindow(dpy, scr->back, 0, 0, scr->width, scr->bh, 0,
|
|
||||||
CopyFromParent,
|
if (scr->deftitle) {
|
||||||
InputOutput, CopyFromParent,
|
attr.background_pixel=scr->dri.dri_Pens[BARBLOCKPEN];
|
||||||
CWOverrideRedirect|CWBackPixel,
|
scr->menubar=XCreateWindow(dpy, scr->back, 0, 0, scr->width, scr->bh, 0,
|
||||||
&attr);
|
CopyFromParent,
|
||||||
|
InputOutput, CopyFromParent,
|
||||||
|
CWOverrideRedirect|CWBackPixel,
|
||||||
|
&attr);
|
||||||
|
scr->menubarparent=XCreateWindow(dpy, scr->menubar, 0, 0, scr->width,
|
||||||
|
scr->bh-1, 0,
|
||||||
|
CopyFromParent, InputOutput, CopyFromParent,
|
||||||
|
CWOverrideRedirect|CWBackPixel, &attr);
|
||||||
|
attr.background_pixel=scr->dri.dri_Pens[BACKGROUNDPEN];
|
||||||
|
scr->menubardepth=XCreateWindow(dpy, scr->menubar, scr->width-23,
|
||||||
|
0, 23, scr->bh, 0,
|
||||||
|
CopyFromParent, InputOutput, CopyFromParent,
|
||||||
|
CWOverrideRedirect|CWBackPixel, &attr);
|
||||||
|
} else {
|
||||||
|
scr->menubar=XCreateWindow(dpy, scr->back, 0, 0, scr->width, scr->bh, 0, 0,
|
||||||
|
InputOnly, CopyFromParent,
|
||||||
|
CWOverrideRedirect, &attr);
|
||||||
|
scr->menubarparent=None;
|
||||||
|
scr->menubardepth=XCreateWindow(dpy, scr->menubar, scr->width-23,
|
||||||
|
0, 23, scr->bh, 0, 0,
|
||||||
|
InputOnly, CopyFromParent,
|
||||||
|
CWOverrideRedirect, &attr);
|
||||||
|
}
|
||||||
|
|
||||||
XSaveContext(dpy, scr->menubar, screen_context, (XPointer)scr);
|
XSaveContext(dpy, scr->menubar, screen_context, (XPointer)scr);
|
||||||
scr->menubarparent=XCreateWindow(dpy, scr->menubar, 0, 0, scr->width,
|
|
||||||
scr->bh-1, 0,
|
if (scr->menubarparent)
|
||||||
CopyFromParent, InputOutput, CopyFromParent,
|
XSaveContext(dpy, scr->menubarparent, screen_context, (XPointer)scr);
|
||||||
CWOverrideRedirect|CWBackPixel, &attr);
|
|
||||||
XSaveContext(dpy, scr->menubarparent, screen_context, (XPointer)scr);
|
|
||||||
attr.background_pixel=scr->dri.dri_Pens[BACKGROUNDPEN];
|
|
||||||
scr->menubardepth=XCreateWindow(dpy, scr->menubar, scr->width-23,
|
|
||||||
0, 23, scr->bh, 0,
|
|
||||||
CopyFromParent, InputOutput, CopyFromParent,
|
|
||||||
CWOverrideRedirect|CWBackPixel, &attr);
|
|
||||||
XSaveContext(dpy, scr->menubardepth, screen_context, (XPointer)scr);
|
XSaveContext(dpy, scr->menubardepth, screen_context, (XPointer)scr);
|
||||||
scr->disabled_stipple=XCreatePixmap(dpy, scr->back, 6, 2, 1);
|
scr->disabled_stipple=XCreatePixmap(dpy, scr->back, 6, 2, 1);
|
||||||
gc=XCreateGC(dpy, scr->disabled_stipple, 0, NULL);
|
gc=XCreateGC(dpy, scr->disabled_stipple, 0, NULL);
|
||||||
@@ -392,11 +414,16 @@ void createmenubar()
|
|||||||
XDrawPoint(dpy, scr->disabled_stipple, gc, 0, 0);
|
XDrawPoint(dpy, scr->disabled_stipple, gc, 0, 0);
|
||||||
XDrawPoint(dpy, scr->disabled_stipple, gc, 3, 1);
|
XDrawPoint(dpy, scr->disabled_stipple, gc, 3, 1);
|
||||||
XFreeGC(dpy, gc);
|
XFreeGC(dpy, gc);
|
||||||
scr->menubargc=XCreateGC(dpy, scr->menubar, 0, NULL);
|
|
||||||
|
if (scr->deftitle) {
|
||||||
|
scr->menubargc=XCreateGC(dpy, scr->menubar, 0, NULL);
|
||||||
#ifndef USE_FONTSETS
|
#ifndef USE_FONTSETS
|
||||||
XSetFont(dpy, scr->menubargc, scr->dri.dri_Font->fid);
|
XSetFont(dpy, scr->menubargc, scr->dri.dri_Font->fid);
|
||||||
#endif
|
#endif
|
||||||
XSetBackground(dpy, scr->menubargc, scr->dri.dri_Pens[BARBLOCKPEN]);
|
XSetBackground(dpy, scr->menubargc, scr->dri.dri_Pens[BARBLOCKPEN]);
|
||||||
|
} else {
|
||||||
|
scr->menubargc = NULL;
|
||||||
|
}
|
||||||
XSelectInput(dpy, scr->menubar, ExposureMask|ButtonPressMask|ButtonReleaseMask);
|
XSelectInput(dpy, scr->menubar, ExposureMask|ButtonPressMask|ButtonReleaseMask);
|
||||||
XSelectInput(dpy, scr->menubardepth, ExposureMask|ButtonPressMask|
|
XSelectInput(dpy, scr->menubardepth, ExposureMask|ButtonPressMask|
|
||||||
ButtonReleaseMask|EnterWindowMask|LeaveWindowMask);
|
ButtonReleaseMask|EnterWindowMask|LeaveWindowMask);
|
||||||
@@ -407,16 +434,22 @@ void createmenubar()
|
|||||||
scr->checkmarkspace=4+scr->dri.dri_Ascent;
|
scr->checkmarkspace=4+scr->dri.dri_Ascent;
|
||||||
scr->subspace=scr->hotkeyspace-scr->dri.dri_Ascent;
|
scr->subspace=scr->hotkeyspace-scr->dri.dri_Ascent;
|
||||||
scr->menuleft=4;
|
scr->menuleft=4;
|
||||||
|
|
||||||
|
if (!scr->menubarparent)
|
||||||
|
return;
|
||||||
|
|
||||||
m=add_menu("Workbench", 0);
|
m=add_menu("Workbench", 0);
|
||||||
add_item(m,"Backdrop",'B',CHECKIT|CHECKED|DISABLED);
|
//add_item(m,"Backdrop",'B',CHECKIT|CHECKED|DISABLED);
|
||||||
add_item(m,"Execute Command...",'E',0);
|
add_item(m,"Execute Command...",'E',0);
|
||||||
|
add_item(m,"Configuration",'C',0);
|
||||||
add_item(m,"Redraw All",0,0);
|
add_item(m,"Redraw All",0,0);
|
||||||
add_item(m,"Update All",0,DISABLED);
|
//add_item(m,"Update All",0,DISABLED);
|
||||||
add_item(m,"Last Message",0,DISABLED);
|
//add_item(m,"Last Message",0,DISABLED);
|
||||||
|
add_item(m,NULL,0,DISABLED);
|
||||||
add_item(m,"About...",'?',0);
|
add_item(m,"About...",'?',0);
|
||||||
add_item(m,"Quit...",'Q',0);
|
add_item(m,"Quit...",'Q',0);
|
||||||
menu_layout(m);
|
menu_layout(m);
|
||||||
m=add_menu("Window", 0);
|
/*m=add_menu("Window", 0);
|
||||||
add_item(m,"New Drawer",'N',DISABLED);
|
add_item(m,"New Drawer",'N',DISABLED);
|
||||||
add_item(m,"Open Parent",0,DISABLED);
|
add_item(m,"Open Parent",0,DISABLED);
|
||||||
add_item(m,"Close",'K',DISABLED);
|
add_item(m,"Close",'K',DISABLED);
|
||||||
@@ -437,8 +470,8 @@ void createmenubar()
|
|||||||
menu_layout(m);
|
menu_layout(m);
|
||||||
menu_layout(sm1);
|
menu_layout(sm1);
|
||||||
menu_layout(sm2);
|
menu_layout(sm2);
|
||||||
menu_layout(sm3);
|
menu_layout(sm3);*/
|
||||||
m=add_menu("Icons", DISABLED);
|
/*m=add_menu("Icons", DISABLED);
|
||||||
add_item(m,"Open",'O',DISABLED);
|
add_item(m,"Open",'O',DISABLED);
|
||||||
add_item(m,"Copy",'C',DISABLED);
|
add_item(m,"Copy",'C',DISABLED);
|
||||||
add_item(m,"Rename...",'R',DISABLED);
|
add_item(m,"Rename...",'R',DISABLED);
|
||||||
@@ -451,7 +484,7 @@ void createmenubar()
|
|||||||
add_item(m,"Delete...",'D',DISABLED);
|
add_item(m,"Delete...",'D',DISABLED);
|
||||||
add_item(m,"Format Disk...",0,DISABLED);
|
add_item(m,"Format Disk...",0,DISABLED);
|
||||||
add_item(m,"Empty Trash",0,DISABLED);
|
add_item(m,"Empty Trash",0,DISABLED);
|
||||||
menu_layout(m);
|
menu_layout(m);*/
|
||||||
m=add_menu("Tools", 0);
|
m=add_menu("Tools", 0);
|
||||||
#ifdef AMIGAOS
|
#ifdef AMIGAOS
|
||||||
add_item(m,"ResetWB",0,DISABLED);
|
add_item(m,"ResetWB",0,DISABLED);
|
||||||
@@ -480,16 +513,24 @@ void createmenubar()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void redrawmenubar(Window w)
|
/*
|
||||||
|
* Redraw the menu bar and its components.
|
||||||
|
*
|
||||||
|
* This takes in the target window, which may be the basic menubar,
|
||||||
|
* a clicked-on menu, or the depth widget.
|
||||||
|
*/
|
||||||
|
void redrawmenubar(Scrn *scr, Window w)
|
||||||
{
|
{
|
||||||
static const char defaultTimeFormat[] = "%c";
|
static const char defaultTimeFormat[] = "%c";
|
||||||
|
int widget_rhs;
|
||||||
|
|
||||||
struct Menu *m;
|
struct Menu *m;
|
||||||
struct Item *item;
|
struct Item *item;
|
||||||
|
|
||||||
if(!w)
|
if(!w || !scr->menubargc)
|
||||||
return;
|
return;
|
||||||
if(w==scr->menubar) {
|
if(w==scr->menubar) {
|
||||||
|
/* Menubar itself */
|
||||||
XSetForeground(dpy, scr->menubargc, scr->dri.dri_Pens[BARDETAILPEN]);
|
XSetForeground(dpy, scr->menubargc, scr->dri.dri_Pens[BARDETAILPEN]);
|
||||||
XSetBackground(dpy, scr->menubargc, scr->dri.dri_Pens[BARBLOCKPEN]);
|
XSetBackground(dpy, scr->menubargc, scr->dri.dri_Pens[BARBLOCKPEN]);
|
||||||
#ifdef USE_FONTSETS
|
#ifdef USE_FONTSETS
|
||||||
@@ -502,6 +543,13 @@ void redrawmenubar(Window w)
|
|||||||
#endif
|
#endif
|
||||||
XSetForeground(dpy, scr->menubargc, scr->dri.dri_Pens[BARTRIMPEN]);
|
XSetForeground(dpy, scr->menubargc, scr->dri.dri_Pens[BARTRIMPEN]);
|
||||||
XDrawLine(dpy, w, scr->menubargc, 0, scr->bh-1, scr->width-1, scr->bh-1);
|
XDrawLine(dpy, w, scr->menubargc, 0, scr->bh-1, scr->width-1, scr->bh-1);
|
||||||
|
|
||||||
|
/* Widgets start here and move to the left */
|
||||||
|
widget_rhs = (scr->width - 30);
|
||||||
|
/*
|
||||||
|
* Update the title bar clock if it's enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
if( prefs.titlebarclock )
|
if( prefs.titlebarclock )
|
||||||
{
|
{
|
||||||
char clockbuf[512];
|
char clockbuf[512];
|
||||||
@@ -514,15 +562,38 @@ void redrawmenubar(Window w)
|
|||||||
#ifdef USE_FONTSETS
|
#ifdef USE_FONTSETS
|
||||||
l = XmbTextEscapement(scr->dri.dri_FontSet, clockbuf, strlen(clockbuf));
|
l = XmbTextEscapement(scr->dri.dri_FontSet, clockbuf, strlen(clockbuf));
|
||||||
XmbDrawImageString(dpy, w, scr->dri.dri_FontSet, scr->menubargc,
|
XmbDrawImageString(dpy, w, scr->dri.dri_FontSet, scr->menubargc,
|
||||||
(scr->width-30-l), 1+scr->dri.dri_Ascent,
|
widget_rhs - l, 1+scr->dri.dri_Ascent,
|
||||||
clockbuf, strlen(clockbuf));
|
clockbuf, strlen(clockbuf));
|
||||||
#else
|
#else
|
||||||
l = XTextWidth(scr->dri.dri_Font, clockbuf, strlen(clockbuf));
|
l = XTextWidth(scr->dri.dri_Font, clockbuf, strlen(clockbuf));
|
||||||
XDrawImageString( dpy, w, scr->menubargc,(scr->width-30-l),
|
XDrawImageString( dpy, w, scr->menubargc, widget_rhs - l,
|
||||||
1+scr->dri.dri_Ascent, clockbuf, strlen(clockbuf));
|
1+scr->dri.dri_Ascent, clockbuf, strlen(clockbuf));
|
||||||
#endif
|
#endif
|
||||||
}
|
widget_rhs = widget_rhs - l - 8; // 8 = padding
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update the battery indicator if it's enabled.
|
||||||
|
*/
|
||||||
|
if (prefs.battery_info) {
|
||||||
|
char battery_buf[512];
|
||||||
|
int l;
|
||||||
|
|
||||||
|
sprintf(battery_buf, "| %s |", battery_status);
|
||||||
|
#ifdef USE_FONTSETS
|
||||||
|
l = XmbTextEscapement(scr->dri.dri_FontSet, battery_buf, strlen(battery_buf));
|
||||||
|
XmbDrawImageString(dpy, w, scr->dri.dri_FontSet, scr->menubargc,
|
||||||
|
widget_rhs - l, 1+scr->dri.dri_Ascent,
|
||||||
|
battery_buf, strlen(battery_buf));
|
||||||
|
#else
|
||||||
|
l = XTextWidth(scr->dri.dri_Font, battery_buf, strlen(battery_buf));
|
||||||
|
XDrawImageString( dpy, w, scr->menubargc, widget_rhs - l,
|
||||||
|
1+scr->dri.dri_Ascent, battery_buf, strlen(battery_buf));
|
||||||
|
#endif
|
||||||
|
widget_rhs = widget_rhs - l - 8; // 8 = padding
|
||||||
|
}
|
||||||
} else if(w==scr->menubardepth) {
|
} else if(w==scr->menubardepth) {
|
||||||
|
/* Menubar depth widget */
|
||||||
if(!mbdclick) {
|
if(!mbdclick) {
|
||||||
XSetForeground(dpy, scr->menubargc, scr->dri.dri_Pens[SHADOWPEN]);
|
XSetForeground(dpy, scr->menubargc, scr->dri.dri_Pens[SHADOWPEN]);
|
||||||
XDrawRectangle(dpy, w, scr->menubargc, 4, scr->h2, 10, scr->h6-scr->h2);
|
XDrawRectangle(dpy, w, scr->menubargc, 4, scr->h2, 10, scr->h6-scr->h2);
|
||||||
@@ -540,6 +611,7 @@ void redrawmenubar(Window w)
|
|||||||
XDrawLine(dpy, w, scr->menubargc, 0, scr->bh-1, 22, scr->bh-1);
|
XDrawLine(dpy, w, scr->menubargc, 0, scr->bh-1, 22, scr->bh-1);
|
||||||
XDrawLine(dpy, w, scr->menubargc, 22, 0, 22, scr->bh-1);
|
XDrawLine(dpy, w, scr->menubargc, 22, 0, 22, scr->bh-1);
|
||||||
} else {
|
} else {
|
||||||
|
/* One of the menus is being displayed */
|
||||||
for(m=scr->firstmenu; m; m=m->next)
|
for(m=scr->firstmenu; m; m=m->next)
|
||||||
if(m->win==w)
|
if(m->win==w)
|
||||||
redraw_menu(m, w);
|
redraw_menu(m, w);
|
||||||
@@ -572,11 +644,13 @@ static void leave_item(struct Item *i, Window w)
|
|||||||
{
|
{
|
||||||
if(i==activesubitem)
|
if(i==activesubitem)
|
||||||
activesubitem=NULL;
|
activesubitem=NULL;
|
||||||
if(i==activeitem)
|
if(i==activeitem) {
|
||||||
if(activesubmenu && i->sub==activesubmenu)
|
if(activesubmenu && i->sub==activesubmenu) {
|
||||||
return;
|
return;
|
||||||
else
|
} else {
|
||||||
activeitem=NULL;
|
activeitem=NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
XSetWindowBackground(dpy, i->win, scr->dri.dri_Pens[BARBLOCKPEN]);
|
XSetWindowBackground(dpy, i->win, scr->dri.dri_Pens[BARBLOCKPEN]);
|
||||||
XClearWindow(dpy, i->win);
|
XClearWindow(dpy, i->win);
|
||||||
redraw_item(i, i->win);
|
redraw_item(i, i->win);
|
||||||
@@ -711,9 +785,11 @@ void menuaction(struct Item *i, struct Item *si)
|
|||||||
switch(menu) {
|
switch(menu) {
|
||||||
case 0: /* Workbench */
|
case 0: /* Workbench */
|
||||||
switch(item) {
|
switch(item) {
|
||||||
case 1:
|
case 0:
|
||||||
spawn(BIN_PREFIX"executecmd");
|
spawn(BIN_PREFIX"executecmd");
|
||||||
break;
|
break;
|
||||||
|
case 1:
|
||||||
|
spawn(BIN_PREFIX"config_util");
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
XSetWindowAttributes xswa;
|
XSetWindowAttributes xswa;
|
||||||
@@ -731,7 +807,7 @@ void menuaction(struct Item *i, struct Item *si)
|
|||||||
XDestroyWindow(dpy, win);
|
XDestroyWindow(dpy, win);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 4:
|
||||||
#ifdef AMIGAOS
|
#ifdef AMIGAOS
|
||||||
spawn(BIN_PREFIX"requestchoice >NIL: amiwm \""
|
spawn(BIN_PREFIX"requestchoice >NIL: amiwm \""
|
||||||
ABOUT_STRING("*N") "\" Ok");
|
ABOUT_STRING("*N") "\" Ok");
|
||||||
@@ -740,7 +816,7 @@ void menuaction(struct Item *i, struct Item *si)
|
|||||||
ABOUT_STRING("\n") "' Ok");
|
ABOUT_STRING("\n") "' Ok");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 5:
|
||||||
#ifndef AMIGAOS
|
#ifndef AMIGAOS
|
||||||
if(prefs.fastquit) {
|
if(prefs.fastquit) {
|
||||||
#endif
|
#endif
|
||||||
@@ -761,7 +837,7 @@ void menuaction(struct Item *i, struct Item *si)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1: /* Window */
|
/* case 1: // Window
|
||||||
switch(item) {
|
switch(item) {
|
||||||
case 4:
|
case 4:
|
||||||
select_all_icons(scr);
|
select_all_icons(scr);
|
||||||
@@ -770,10 +846,10 @@ void menuaction(struct Item *i, struct Item *si)
|
|||||||
cleanupicons();
|
cleanupicons();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break; */
|
||||||
case 2: /* Icons */
|
// case 2: /* Icons */
|
||||||
break;
|
// break;
|
||||||
case 3: /* Tools */
|
case 1: /* Tools */
|
||||||
#ifndef AMIGAOS
|
#ifndef AMIGAOS
|
||||||
if(item==0)
|
if(item==0)
|
||||||
restart_amiwm();
|
restart_amiwm();
|
||||||
@@ -792,11 +868,11 @@ void menuaction(struct Item *i, struct Item *si)
|
|||||||
if(ti && ti->cmd) spawn(ti->cmd);
|
if(ti && ti->cmd) spawn(ti->cmd);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4: /* Screens */
|
case 2: /* Screens */
|
||||||
if(item==0) {
|
if(item==0) {
|
||||||
openscreen("New Screen", DefaultRootWindow(dpy));
|
openscreen("New Screen", DefaultRootWindow(dpy));
|
||||||
realizescreens();
|
realizescreens();
|
||||||
scr=front->upfront;
|
scr = get_front_scr()->upfront;
|
||||||
screentoback();
|
screentoback();
|
||||||
}
|
}
|
||||||
if(item==1) {
|
if(item==1) {
|
||||||
|
|||||||
109
module.c
109
module.c
@@ -1,5 +1,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -12,9 +13,6 @@
|
|||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SYS_TIME_H
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_RESOURCE_H
|
#ifdef HAVE_SYS_RESOURCE_H
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -41,7 +39,6 @@ extern Display *dpy;
|
|||||||
extern void add_fd_to_set(int);
|
extern void add_fd_to_set(int);
|
||||||
extern void remove_fd_from_set(int);
|
extern void remove_fd_from_set(int);
|
||||||
|
|
||||||
extern void screentoback();
|
|
||||||
extern void raiselowerclient(Client *, int);
|
extern void raiselowerclient(Client *, int);
|
||||||
extern void wberror(Scrn *, char *);
|
extern void wberror(Scrn *, char *);
|
||||||
|
|
||||||
@@ -110,7 +107,7 @@ void delete_keygrab(struct module *m, int id)
|
|||||||
|
|
||||||
static void destroy_module(struct module *m)
|
static void destroy_module(struct module *m)
|
||||||
{
|
{
|
||||||
Scrn *s=front;
|
Scrn *s = get_front_scr();
|
||||||
delete_keygrab(m, -1);
|
delete_keygrab(m, -1);
|
||||||
do {
|
do {
|
||||||
Icon *i, *ni;
|
Icon *i, *ni;
|
||||||
@@ -120,7 +117,7 @@ static void destroy_module(struct module *m)
|
|||||||
rmicon(i);
|
rmicon(i);
|
||||||
}
|
}
|
||||||
s=s->behind;
|
s=s->behind;
|
||||||
} while(s!=front);
|
} while(s != get_front_scr());
|
||||||
disown_item_chain(m, m->menuitems);
|
disown_item_chain(m, m->menuitems);
|
||||||
if(m->in_fd>=0) { remove_fd_from_set(m->in_fd); close(m->in_fd); }
|
if(m->in_fd>=0) { remove_fd_from_set(m->in_fd); close(m->in_fd); }
|
||||||
if(m->out_fd>=0) { close(m->out_fd); }
|
if(m->out_fd>=0) { close(m->out_fd); }
|
||||||
@@ -267,11 +264,13 @@ static int m_write(int fd, char *ptr, int len)
|
|||||||
char *p=ptr;
|
char *p=ptr;
|
||||||
int r, tot=0;
|
int r, tot=0;
|
||||||
while(len>0) {
|
while(len>0) {
|
||||||
if((r=write(fd, p, len))<0)
|
if((r=write(fd, p, len))<0) {
|
||||||
if(errno==EINTR)
|
if(errno==EINTR) {
|
||||||
continue;
|
continue;
|
||||||
else
|
} else {
|
||||||
return r;
|
return r;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(!r)
|
if(!r)
|
||||||
return tot;
|
return tot;
|
||||||
tot+=r;
|
tot+=r;
|
||||||
@@ -293,22 +292,23 @@ int dispatch_event_to_broker(XEvent *e, unsigned long mask, struct module *m)
|
|||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
Icon *i;
|
Icon *i;
|
||||||
e->xany.display=(Display *)0;
|
/* XXX TODO: overloading display here seems .. dangerous? */
|
||||||
|
e->xany.display=(Display *)(uintptr_t) 0;
|
||||||
if(!XFindContext(dpy, e->xany.window, client_context, (XPointer *)&c))
|
if(!XFindContext(dpy, e->xany.window, client_context, (XPointer *)&c))
|
||||||
if(e->xany.window==c->window)
|
if(e->xany.window==c->window)
|
||||||
e->xany.display=(Display *)1;
|
e->xany.display=(Display *)(uintptr_t) 1;
|
||||||
else
|
else
|
||||||
e->xany.display=(Display *)2;
|
e->xany.display=(Display *)(uintptr_t) 2;
|
||||||
else if(!XFindContext(dpy, e->xany.window, icon_context, (XPointer *)&i))
|
else if(!XFindContext(dpy, e->xany.window, icon_context, (XPointer *)&i))
|
||||||
if(e->xany.window==i->window)
|
if(e->xany.window==i->window)
|
||||||
e->xany.display=(Display *)3;
|
e->xany.display=(Display *)(uintptr_t) 3;
|
||||||
|
|
||||||
while(m) {
|
while(m) {
|
||||||
if(m->out_fd>=0 && ((m->broker.mask & mask)||(m->broker.exists && !mask))) {
|
if(m->out_fd>=0 && ((m->broker.mask & mask)||(m->broker.exists && !mask))) {
|
||||||
struct mcmd_event me;
|
struct mcmd_event me;
|
||||||
me.mask=mask;
|
me.mask=mask;
|
||||||
me.event=*e;
|
me.event=*e;
|
||||||
reply_module(m, (char *)&me, ~sizeof(me));
|
reply_module(m, (char *)&me, ~((int) sizeof(me)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
m=m->next;
|
m=m->next;
|
||||||
@@ -326,11 +326,14 @@ static void incoming_event(struct module *m, struct mcmd_event *me)
|
|||||||
|
|
||||||
void mod_menuselect(struct module *m, int menu, int item, int subitem)
|
void mod_menuselect(struct module *m, int menu, int item, int subitem)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Nu valde någon minsann menyitem %d:%d:%d.\n"
|
fprintf(stderr, "No value assigned for menu item %d:%d:%d.\n"
|
||||||
"Man kanske skulle berätta detta för modul %d\n?",
|
"Read manual for module %d\n?",
|
||||||
menu, item, subitem, (int)m->pid);
|
menu, item, subitem, (int)m->pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void lowertopmostclient(Scrn *scr);
|
||||||
|
extern void raisebottommostclient(Scrn *scr);
|
||||||
|
|
||||||
static void handle_module_cmd(struct module *m, char *data, int data_len)
|
static void handle_module_cmd(struct module *m, char *data, int data_len)
|
||||||
{
|
{
|
||||||
extern Scrn *getscreen(Window);
|
extern Scrn *getscreen(Window);
|
||||||
@@ -365,6 +368,20 @@ static void handle_module_cmd(struct module *m, char *data, int data_len)
|
|||||||
screentoback();
|
screentoback();
|
||||||
reply_module(m, NULL, 0);
|
reply_module(m, NULL, 0);
|
||||||
break;
|
break;
|
||||||
|
case MCMD_ROTATE_WINDOW_RAISE:
|
||||||
|
/* Get the current screen */
|
||||||
|
scr = getscreen(id);
|
||||||
|
/* raise away! */
|
||||||
|
raisebottommostclient(scr);
|
||||||
|
reply_module(m, NULL, 0);
|
||||||
|
break;
|
||||||
|
case MCMD_ROTATE_WINDOW_LOWER:
|
||||||
|
/* Get the current screen */
|
||||||
|
scr = getscreen(id);
|
||||||
|
/* lower away! */
|
||||||
|
lowertopmostclient(scr);
|
||||||
|
reply_module(m, NULL, 0);
|
||||||
|
break;
|
||||||
case MCMD_ADD_KEYGRAB:
|
case MCMD_ADD_KEYGRAB:
|
||||||
if(data_len>=sizeof(int[2])) {
|
if(data_len>=sizeof(int[2])) {
|
||||||
int res=create_keygrab(m, ((int*)data)[0], ((int*)data)[1]);
|
int res=create_keygrab(m, ((int*)data)[0], ((int*)data)[1]);
|
||||||
@@ -469,6 +486,56 @@ static void handle_module_cmd(struct module *m, char *data, int data_len)
|
|||||||
} else
|
} else
|
||||||
reply_module(m, NULL, -1);
|
reply_module(m, NULL, -1);
|
||||||
break;
|
break;
|
||||||
|
case MCMD_UPDATE_BATTERY:
|
||||||
|
{
|
||||||
|
struct mcmd_update_battery *batt;
|
||||||
|
extern char battery_status[];
|
||||||
|
|
||||||
|
if (data == NULL) {
|
||||||
|
reply_module(m, NULL, -1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (data_len != sizeof(struct mcmd_update_battery)) {
|
||||||
|
reply_module(m, NULL, -1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
batt = (void *) data;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
fprintf(stderr, "%s: called, BATTERY, pct=%d, time=%d, ac=%d\n",
|
||||||
|
__func__,
|
||||||
|
batt->battery_pct,
|
||||||
|
batt->battery_time,
|
||||||
|
batt->battery_ac);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XXX TODO: for now we're just populating a string here.
|
||||||
|
* Later on we should just store the current battery state
|
||||||
|
* somewhere (a key/value table would be nice!) and then
|
||||||
|
* the widget code can pull out its needed state to render.
|
||||||
|
*/
|
||||||
|
snprintf(battery_status, 128, "%d pct%s", batt->battery_pct,
|
||||||
|
batt->battery_ac == 1 ? " A" : " -");
|
||||||
|
|
||||||
|
reply_module(m, NULL, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MCMD_WINDOW_MOVE_NEXT_DESKTOP:
|
||||||
|
/* Move the current window, if any, to the next desktop */
|
||||||
|
c = NULL;
|
||||||
|
if(! XFindContext(dpy, id, client_context, (XPointer*)&c)) {
|
||||||
|
/* Get the current screen */
|
||||||
|
scr=getscreen(id);
|
||||||
|
/* Rotate screen, get the now front screen */
|
||||||
|
screentoback();
|
||||||
|
scr = get_front_scr();
|
||||||
|
/* Assign this client to next screen */
|
||||||
|
reparent_client(scr, c);
|
||||||
|
}
|
||||||
|
reply_module(m, NULL, 0);
|
||||||
|
break;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
reply_module(m, NULL, -1);
|
reply_module(m, NULL, -1);
|
||||||
}
|
}
|
||||||
@@ -506,7 +573,7 @@ static void module_input_callback(struct module *m)
|
|||||||
int t=(r>m->in_left? m->in_left:r);
|
int t=(r>m->in_left? m->in_left:r);
|
||||||
memcpy(m->in_ptr, p, t);
|
memcpy(m->in_ptr, p, t);
|
||||||
m->in_ptr+=t;
|
m->in_ptr+=t;
|
||||||
if(!(m->in_left-=t))
|
if(!(m->in_left-=t)) {
|
||||||
if(m->in_phase || ((!m->mcmd.len)&&(m->in_ptr=m->in_buf))) {
|
if(m->in_phase || ((!m->mcmd.len)&&(m->in_ptr=m->in_buf))) {
|
||||||
*m->in_ptr=0;
|
*m->in_ptr=0;
|
||||||
handle_module_cmd(m, m->in_buf, m->mcmd.len);
|
handle_module_cmd(m, m->in_buf, m->mcmd.len);
|
||||||
@@ -515,15 +582,17 @@ static void module_input_callback(struct module *m)
|
|||||||
m->in_phase=0;
|
m->in_phase=0;
|
||||||
} else {
|
} else {
|
||||||
if(m->mcmd.len>=m->in_buf_size) {
|
if(m->mcmd.len>=m->in_buf_size) {
|
||||||
if((m->in_buf_size<<=1)<=m->mcmd.len)
|
/* Resize buffer if needed */
|
||||||
m->in_buf_size=m->mcmd.len+1; {
|
if((m->in_buf_size<<=1)<=m->mcmd.len) {
|
||||||
m->in_buf=realloc(m->in_buf, m->in_buf_size);
|
m->in_buf_size=m->mcmd.len+1;
|
||||||
|
m->in_buf=realloc(m->in_buf, m->in_buf_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m->in_ptr=m->in_buf;
|
m->in_ptr=m->in_buf;
|
||||||
m->in_left=m->mcmd.len;
|
m->in_left=m->mcmd.len;
|
||||||
m->in_phase++;
|
m->in_phase++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
p+=t;
|
p+=t;
|
||||||
r-=t;
|
r-=t;
|
||||||
}
|
}
|
||||||
|
|||||||
12
module.h
12
module.h
@@ -14,6 +14,10 @@
|
|||||||
#define MCMD_GETICONDIR 16
|
#define MCMD_GETICONDIR 16
|
||||||
#define MCMD_GETICONPALETTE 17
|
#define MCMD_GETICONPALETTE 17
|
||||||
#define MCMD_MANAGEMENU 18
|
#define MCMD_MANAGEMENU 18
|
||||||
|
#define MCMD_ROTATE_WINDOW_RAISE 19
|
||||||
|
#define MCMD_ROTATE_WINDOW_LOWER 20
|
||||||
|
#define MCMD_UPDATE_BATTERY 21
|
||||||
|
#define MCMD_WINDOW_MOVE_NEXT_DESKTOP 22
|
||||||
|
|
||||||
struct mcmd_header {
|
struct mcmd_header {
|
||||||
XID id;
|
XID id;
|
||||||
@@ -40,6 +44,14 @@ struct NewAppIcon {
|
|||||||
char name[1];
|
char name[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct mcmd_update_battery {
|
||||||
|
int battery_time;
|
||||||
|
int battery_pct;
|
||||||
|
int battery_cap;
|
||||||
|
int battery_ac;
|
||||||
|
int battery_charging;
|
||||||
|
};
|
||||||
|
|
||||||
extern struct module {
|
extern struct module {
|
||||||
struct module *next;
|
struct module *next;
|
||||||
int in_fd, out_fd;
|
int in_fd, out_fd;
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SYS_TIME_H
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define WB_DISKMAGIC 0xe310
|
#define WB_DISKMAGIC 0xe310
|
||||||
#define WB_DISKVERSION 1
|
#define WB_DISKVERSION 1
|
||||||
|
|||||||
2
prefs.h
2
prefs.h
@@ -16,6 +16,8 @@ extern struct prefs_struct {
|
|||||||
int titlebarclock; /* display titlebar clock? */
|
int titlebarclock; /* display titlebar clock? */
|
||||||
char *titleclockformat; /* format to use for the clock */
|
char *titleclockformat; /* format to use for the clock */
|
||||||
int titleclockinterval; /* how often do we update the clock?*/
|
int titleclockinterval; /* how often do we update the clock?*/
|
||||||
|
int icontray; // if true then icons will be shown in a tray on top of each screen (besides clock and screen name)
|
||||||
|
int battery_info; /* display battery info? */
|
||||||
struct _Style *firststyle, *laststyle;
|
struct _Style *firststyle, *laststyle;
|
||||||
} prefs;
|
} prefs;
|
||||||
|
|
||||||
|
|||||||
8
rc.c
8
rc.c
@@ -7,7 +7,7 @@
|
|||||||
#include "prefs.h"
|
#include "prefs.h"
|
||||||
#include "drawinfo.h"
|
#include "drawinfo.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "gram.h"
|
#include "gram.tab.h"
|
||||||
#include "icc.h"
|
#include "icc.h"
|
||||||
#include "style.h"
|
#include "style.h"
|
||||||
|
|
||||||
@@ -25,6 +25,8 @@ struct prefs_struct prefs;
|
|||||||
#define RC_FILENAME ".amiwmrc"
|
#define RC_FILENAME ".amiwmrc"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define AMIWM_MODULES AMIWM_HOME"/modules/"
|
||||||
|
|
||||||
FILE *rcfile;
|
FILE *rcfile;
|
||||||
int ParseError=0;
|
int ParseError=0;
|
||||||
|
|
||||||
@@ -36,7 +38,7 @@ void read_rc_file(char *filename, int manage_all)
|
|||||||
prefs.manage_all = manage_all;
|
prefs.manage_all = manage_all;
|
||||||
prefs.sizeborder=Psizeright;
|
prefs.sizeborder=Psizeright;
|
||||||
prefs.icondir=AMIWM_HOME;
|
prefs.icondir=AMIWM_HOME;
|
||||||
prefs.module_path=AMIWM_HOME;
|
prefs.module_path=AMIWM_MODULES;
|
||||||
prefs.defaulticon="def_tool.info";
|
prefs.defaulticon="def_tool.info";
|
||||||
prefs.borderwidth=1;
|
prefs.borderwidth=1;
|
||||||
prefs.titleclockinterval=1;
|
prefs.titleclockinterval=1;
|
||||||
@@ -45,6 +47,7 @@ void read_rc_file(char *filename, int manage_all)
|
|||||||
prefs.screenmenu=False;
|
prefs.screenmenu=False;
|
||||||
prefs.firststyle=NULL;
|
prefs.firststyle=NULL;
|
||||||
prefs.laststyle=NULL;
|
prefs.laststyle=NULL;
|
||||||
|
prefs.icontray=TRUE;
|
||||||
set_sys_palette();
|
set_sys_palette();
|
||||||
|
|
||||||
if(filename!=NULL && (rcfile=fopen(filename, "r"))) {
|
if(filename!=NULL && (rcfile=fopen(filename, "r"))) {
|
||||||
@@ -102,6 +105,7 @@ struct keyword { char *name; int token; } keywords[] = {
|
|||||||
{ "barblockpen", T_BARBLOCKPEN },
|
{ "barblockpen", T_BARBLOCKPEN },
|
||||||
{ "bardetailpen", T_BARDETAILPEN },
|
{ "bardetailpen", T_BARDETAILPEN },
|
||||||
{ "bartrimpen", T_BARTRIMPEN },
|
{ "bartrimpen", T_BARTRIMPEN },
|
||||||
|
{ "batteryinfo", BATTERYINFO },
|
||||||
{ "blockpen", T_BLOCKPEN },
|
{ "blockpen", T_BLOCKPEN },
|
||||||
{ "both", BOTH },
|
{ "both", BOTH },
|
||||||
{ "bottom", BOTTOM },
|
{ "bottom", BOTTOM },
|
||||||
|
|||||||
217
requestchoice.c
217
requestchoice.c
@@ -13,30 +13,33 @@
|
|||||||
extern struct Library *XLibBase;
|
extern struct Library *XLibBase;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// These are used for button spacing, not the button itself
|
||||||
#define BUT_BUTSPACE (2*(2+5))
|
#define BUT_BUTSPACE (2*(2+5))
|
||||||
#define BUT_INTSPACE 12
|
#define BUT_INTSPACE 12
|
||||||
#define BUT_EXTSPACE 4
|
#define BUT_EXTSPACE 4
|
||||||
#define BUT_VSPACE 6
|
|
||||||
#define TXT_HSPACE 48
|
#include "gadget_button.h"
|
||||||
#define TXT_TOPSPACE 4
|
#include "gadget_textbox.h"
|
||||||
#define TXT_MIDSPACE 3
|
|
||||||
#define TXT_BOTSPACE 4
|
|
||||||
|
|
||||||
struct choice {
|
struct choice {
|
||||||
struct choice *next;
|
struct choice *next;
|
||||||
const char *text;
|
const char *text;
|
||||||
int l, w;
|
int l, w;
|
||||||
Window win;
|
struct gadget_button *b;
|
||||||
} *firstchoice=NULL, *lastchoice=NULL;
|
} *firstchoice=NULL, *lastchoice=NULL;
|
||||||
|
|
||||||
struct line {
|
struct line {
|
||||||
struct line *next;
|
struct line *next;
|
||||||
const char *text;
|
const char *text;
|
||||||
int l, w, h;
|
int l, w, h;
|
||||||
} *firstline=NULL, *lastline=NULL;
|
} *firstline=NULL, *lastline=NULL;
|
||||||
|
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Window root, mainwin, textwin;
|
Window root, mainwin;
|
||||||
|
|
||||||
|
//Window textwin;
|
||||||
|
struct gadget_textbox *g_textbox;
|
||||||
|
|
||||||
char *progname;
|
char *progname;
|
||||||
GC gc;
|
GC gc;
|
||||||
Pixmap stipple;
|
Pixmap stipple;
|
||||||
@@ -49,43 +52,59 @@ struct DrawInfo dri;
|
|||||||
|
|
||||||
struct RDArgs *ra=NULL;
|
struct RDArgs *ra=NULL;
|
||||||
|
|
||||||
void selection(int n)
|
static void
|
||||||
|
selection(int n)
|
||||||
{
|
{
|
||||||
printf("%d\n", n);
|
printf("%d\n", n);
|
||||||
XDestroyWindow(dpy, mainwin);
|
XDestroyWindow(dpy, mainwin);
|
||||||
XCloseDisplay(dpy);
|
XCloseDisplay(dpy);
|
||||||
FreeArgs(ra);
|
FreeArgs(ra);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *myalloc(size_t s)
|
static void
|
||||||
|
*myalloc(size_t s)
|
||||||
{
|
{
|
||||||
void *p=calloc(s,1);
|
void *p=calloc(s,1);
|
||||||
if(p)
|
if(p)
|
||||||
return p;
|
return p;
|
||||||
fprintf(stderr, "%s: out of memory!\n", progname);
|
fprintf(stderr, "%s: out of memory!\n", progname);
|
||||||
FreeArgs(ra);
|
FreeArgs(ra);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addchoice(const char *txt)
|
/*
|
||||||
|
* Add a choice to the list of choices, but don't create
|
||||||
|
* the button just yet. This'll be done once all of them
|
||||||
|
* are known and the math to create the window sizing/layout
|
||||||
|
* can be done.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
addchoice(const char *txt)
|
||||||
{
|
{
|
||||||
struct choice *c=myalloc(sizeof(struct choice));
|
struct choice *c=myalloc(sizeof(struct choice));
|
||||||
if(lastchoice)
|
if(lastchoice)
|
||||||
lastchoice->next=c;
|
lastchoice->next=c;
|
||||||
else
|
else
|
||||||
firstchoice=c;
|
firstchoice=c;
|
||||||
lastchoice=c;
|
lastchoice=c;
|
||||||
c->l=strlen(c->text=txt);
|
|
||||||
|
c->l = strlen(txt);
|
||||||
|
c->text = txt;
|
||||||
|
|
||||||
#ifdef USE_FONTSETS
|
#ifdef USE_FONTSETS
|
||||||
totw+=(c->w=XmbTextEscapement(dri.dri_FontSet, c->text, c->l))+BUT_BUTSPACE;
|
totw+=(c->w=XmbTextEscapement(dri.dri_FontSet, c->text, c->l))+BUT_BUTSPACE;
|
||||||
#else
|
#else
|
||||||
totw+=(c->w=XTextWidth(dri.dri_Font, c->text, c->l))+BUT_BUTSPACE;
|
totw+=(c->w=XTextWidth(dri.dri_Font, c->text, c->l))+BUT_BUTSPACE;
|
||||||
#endif
|
#endif
|
||||||
nchoices++;
|
nchoices++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addline(const char *txt)
|
/*
|
||||||
|
* Add a line to the text box that we can draw.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
addline(const char *txt)
|
||||||
{
|
{
|
||||||
struct line *l=myalloc(sizeof(struct line));
|
struct line *l=myalloc(sizeof(struct line));
|
||||||
if(lastline)
|
if(lastline)
|
||||||
@@ -94,6 +113,13 @@ void addline(const char *txt)
|
|||||||
firstline=l;
|
firstline=l;
|
||||||
lastline=l;
|
lastline=l;
|
||||||
l->l=strlen(l->text=txt);
|
l->l=strlen(l->text=txt);
|
||||||
|
|
||||||
|
/* These are used to find the size, which we want
|
||||||
|
* to use in order to determine how big our window
|
||||||
|
* should be. It's a bit of a chicken/egg problem
|
||||||
|
* for now whilst this is figured out - it's also
|
||||||
|
* done in gadget_textbox_addline().
|
||||||
|
*/
|
||||||
#ifdef USE_FONTSETS
|
#ifdef USE_FONTSETS
|
||||||
l->w=XmbTextEscapement(dri.dri_FontSet, l->text, l->l);
|
l->w=XmbTextEscapement(dri.dri_FontSet, l->text, l->l);
|
||||||
#else
|
#else
|
||||||
@@ -104,57 +130,13 @@ void addline(const char *txt)
|
|||||||
maxw=l->w;
|
maxw=l->w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void refresh_text()
|
|
||||||
{
|
|
||||||
int w=totw-BUT_EXTSPACE-BUT_EXTSPACE;
|
|
||||||
int h=toth-TXT_TOPSPACE-TXT_MIDSPACE-TXT_BOTSPACE-BUT_VSPACE-
|
|
||||||
(dri.dri_Ascent+dri.dri_Descent);
|
|
||||||
int x=(totw-maxw+TXT_HSPACE)>>1;
|
|
||||||
int y=((dri.dri_Ascent+dri.dri_Descent)>>1)+dri.dri_Ascent;
|
|
||||||
struct line *l;
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[SHADOWPEN]);
|
|
||||||
XDrawLine(dpy, textwin, gc, 0, 0, w-2, 0);
|
|
||||||
XDrawLine(dpy, textwin, gc, 0, 0, 0, h-2);
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[SHINEPEN]);
|
|
||||||
XDrawLine(dpy, textwin, gc, 0, h-1, w-1, h-1);
|
|
||||||
XDrawLine(dpy, textwin, gc, w-1, 0, w-1, h-1);
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
|
|
||||||
for(l=firstline; l; l=l->next) {
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
XmbDrawString(dpy, textwin, dri.dri_FontSet, gc, x, y, l->text, l->l);
|
|
||||||
#else
|
|
||||||
XDrawString(dpy, textwin, gc, x, y, l->text, l->l);
|
|
||||||
#endif
|
|
||||||
y+=dri.dri_Ascent+dri.dri_Descent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void refresh_choice(struct choice *c)
|
void refresh_choice(struct choice *c)
|
||||||
{
|
{
|
||||||
int w=c->w+BUT_BUTSPACE;
|
gadget_button_refresh(c->b);
|
||||||
int h=dri.dri_Ascent+dri.dri_Descent+BUT_VSPACE;
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
|
|
||||||
#ifdef USE_FONTSETS
|
|
||||||
XmbDrawString(dpy, c->win, dri.dri_FontSet, gc, BUT_BUTSPACE/2,
|
|
||||||
dri.dri_Ascent+BUT_VSPACE/2, c->text, c->l);
|
|
||||||
#else
|
|
||||||
XDrawString(dpy, c->win, gc, BUT_BUTSPACE/2,
|
|
||||||
dri.dri_Ascent+BUT_VSPACE/2, c->text, c->l);
|
|
||||||
#endif
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[(c==selected && depressed)?
|
|
||||||
SHADOWPEN:SHINEPEN]);
|
|
||||||
XDrawLine(dpy, c->win, gc, 0, 0, w-2, 0);
|
|
||||||
XDrawLine(dpy, c->win, gc, 0, 0, 0, h-2);
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[(c==selected && depressed)?
|
|
||||||
SHINEPEN:SHADOWPEN]);
|
|
||||||
XDrawLine(dpy, c->win, gc, 1, h-1, w-1, h-1);
|
|
||||||
XDrawLine(dpy, c->win, gc, w-1, 1, w-1, h-1);
|
|
||||||
XSetForeground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
|
|
||||||
XDrawPoint(dpy, c->win, gc, w-1, 0);
|
|
||||||
XDrawPoint(dpy, c->win, gc, 0, h-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void split(char *str, const char *delim, void (*func)(const char *))
|
static void
|
||||||
|
split(char *str, const char *delim, void (*func)(const char *))
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
if((p=strtok(str, delim)))
|
if((p=strtok(str, delim)))
|
||||||
@@ -167,23 +149,21 @@ struct choice *getchoice(Window w)
|
|||||||
{
|
{
|
||||||
struct choice *c;
|
struct choice *c;
|
||||||
for(c=firstchoice; c; c=c->next)
|
for(c=firstchoice; c; c=c->next)
|
||||||
if(w == c->win)
|
if(w == c->b->w)
|
||||||
return c;
|
return c;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggle(struct choice *c)
|
void toggle(struct choice *c)
|
||||||
{
|
{
|
||||||
XSetWindowBackground(dpy, c->win, dri.dri_Pens[(depressed&&c==selected)?
|
gadget_button_toggle(c->b);
|
||||||
FILLPEN:BACKGROUNDPEN]);
|
|
||||||
XClearWindow(dpy, c->win);
|
|
||||||
refresh_choice(c);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void abortchoice()
|
void abortchoice()
|
||||||
{
|
{
|
||||||
if(depressed) {
|
if(depressed) {
|
||||||
depressed=0;
|
depressed=0;
|
||||||
|
gadget_button_set_depressed(selected->b, 0);
|
||||||
toggle(selected);
|
toggle(selected);
|
||||||
}
|
}
|
||||||
selected=NULL;
|
selected=NULL;
|
||||||
@@ -210,6 +190,7 @@ int main(int argc, char *argv[])
|
|||||||
static XTextProperty txtprop1, txtprop2;
|
static XTextProperty txtprop1, txtprop2;
|
||||||
int x, y, extra=0, n=0;
|
int x, y, extra=0, n=0;
|
||||||
struct choice *c;
|
struct choice *c;
|
||||||
|
struct line *l;
|
||||||
Argtype array[3], *atp;
|
Argtype array[3], *atp;
|
||||||
|
|
||||||
progname=argv[0];
|
progname=argv[0];
|
||||||
@@ -258,28 +239,41 @@ int main(int argc, char *argv[])
|
|||||||
XDrawPoint(dpy, stipple, gc, 0, 1);
|
XDrawPoint(dpy, stipple, gc, 0, 1);
|
||||||
XDrawPoint(dpy, stipple, gc, 1, 0);
|
XDrawPoint(dpy, stipple, gc, 1, 0);
|
||||||
XSetWindowBackgroundPixmap(dpy, mainwin, stipple);
|
XSetWindowBackgroundPixmap(dpy, mainwin, stipple);
|
||||||
|
|
||||||
|
g_textbox = gadget_textbox_create(dpy, &dri, gc, mainwin,
|
||||||
|
BUT_EXTSPACE,
|
||||||
|
TXT_TOPSPACE,
|
||||||
|
totw - BUT_EXTSPACE - BUT_EXTSPACE,
|
||||||
|
toth-TXT_TOPSPACE- TXT_MIDSPACE-TXT_BOTSPACE-BUT_VSPACE- (dri.dri_Ascent+dri.dri_Descent));
|
||||||
|
#if 0
|
||||||
textwin=XCreateSimpleWindow(dpy, mainwin, BUT_EXTSPACE, TXT_TOPSPACE, totw-
|
textwin=XCreateSimpleWindow(dpy, mainwin, BUT_EXTSPACE, TXT_TOPSPACE, totw-
|
||||||
BUT_EXTSPACE-BUT_EXTSPACE, toth-TXT_TOPSPACE-
|
BUT_EXTSPACE-BUT_EXTSPACE,
|
||||||
TXT_MIDSPACE-TXT_BOTSPACE-BUT_VSPACE-
|
|
||||||
(dri.dri_Ascent+dri.dri_Descent),
|
|
||||||
0, dri.dri_Pens[SHADOWPEN],
|
0, dri.dri_Pens[SHADOWPEN],
|
||||||
dri.dri_Pens[BACKGROUNDPEN]);
|
dri.dri_Pens[BACKGROUNDPEN]);
|
||||||
XSelectInput(dpy, textwin, ExposureMask);
|
XSelectInput(dpy, textwin, ExposureMask);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Lay out + create buttons */
|
||||||
x=BUT_EXTSPACE;
|
x=BUT_EXTSPACE;
|
||||||
y=toth-TXT_BOTSPACE-(dri.dri_Ascent+dri.dri_Descent)-BUT_VSPACE;
|
y=toth-TXT_BOTSPACE-(dri.dri_Ascent+dri.dri_Descent)-BUT_VSPACE;
|
||||||
for(c=firstchoice; c; c=c->next) {
|
for(c=firstchoice; c; c=c->next) {
|
||||||
c->win=XCreateSimpleWindow(dpy, mainwin,
|
c->b = gadget_button_init(dpy, &dri, gc, mainwin,
|
||||||
x+(nchoices==1? (extra>>1):
|
x + (nchoices == 1 ? (extra >> 1) : n++*extra/(nchoices-1)),
|
||||||
n++*extra/(nchoices-1)),
|
y,
|
||||||
y, c->w+BUT_BUTSPACE,
|
c->w + BUT_BUTSPACE,
|
||||||
dri.dri_Ascent+dri.dri_Descent+
|
// Note: the original code didn't need a +2 here, but
|
||||||
BUT_VSPACE, 0,
|
// when using the ported button gadget it's needed or
|
||||||
dri.dri_Pens[SHADOWPEN],
|
// the bottom of the button isn't shown. Figure out why!
|
||||||
dri.dri_Pens[BACKGROUNDPEN]);
|
dri.dri_Ascent+dri.dri_Descent + BUT_VSPACE + 2);
|
||||||
XSelectInput(dpy, c->win, ExposureMask|ButtonPressMask|ButtonReleaseMask|
|
gadget_button_set_text(c->b, c->text);
|
||||||
EnterWindowMask|LeaveWindowMask);
|
|
||||||
x+=c->w+BUT_BUTSPACE+BUT_INTSPACE;
|
x+=c->w+BUT_BUTSPACE+BUT_INTSPACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Lay out + create text box contents */
|
||||||
|
for (l = firstline; l; l = l->next) {
|
||||||
|
gadget_textbox_addline(g_textbox, l->text);
|
||||||
|
}
|
||||||
|
|
||||||
size_hints.flags = PResizeInc;
|
size_hints.flags = PResizeInc;
|
||||||
txtprop1.value=(unsigned char *)array[0].ptr;
|
txtprop1.value=(unsigned char *)array[0].ptr;
|
||||||
txtprop2.value=(unsigned char *)"RequestChoice";
|
txtprop2.value=(unsigned char *)"RequestChoice";
|
||||||
@@ -296,20 +290,23 @@ int main(int argc, char *argv[])
|
|||||||
XNextEvent(dpy, &event);
|
XNextEvent(dpy, &event);
|
||||||
switch(event.type) {
|
switch(event.type) {
|
||||||
case Expose:
|
case Expose:
|
||||||
if(!event.xexpose.count)
|
if(!event.xexpose.count) {
|
||||||
if(event.xexpose.window == textwin)
|
if(event.xexpose.window == g_textbox->w)
|
||||||
refresh_text();
|
gadget_textbox_refresh(g_textbox);
|
||||||
else if((c=getchoice(event.xexpose.window)))
|
else if((c=getchoice(event.xexpose.window)))
|
||||||
refresh_choice(c);
|
refresh_choice(c);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case LeaveNotify:
|
case LeaveNotify:
|
||||||
if(depressed && event.xcrossing.window==selected->win) {
|
if(depressed && event.xcrossing.window==selected->b->w) {
|
||||||
depressed=0;
|
depressed=0;
|
||||||
|
gadget_button_set_depressed(selected->b, 0);
|
||||||
toggle(selected);
|
toggle(selected);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EnterNotify:
|
case EnterNotify:
|
||||||
if((!depressed) && selected && event.xcrossing.window==selected->win) {
|
if((!depressed) && selected && event.xcrossing.window==selected->b->w) {
|
||||||
|
gadget_button_set_depressed(selected->b, 1);
|
||||||
depressed=1;
|
depressed=1;
|
||||||
toggle(selected);
|
toggle(selected);
|
||||||
}
|
}
|
||||||
@@ -319,15 +316,17 @@ int main(int argc, char *argv[])
|
|||||||
(c=getchoice(event.xbutton.window))) {
|
(c=getchoice(event.xbutton.window))) {
|
||||||
abortchoice();
|
abortchoice();
|
||||||
depressed=1;
|
depressed=1;
|
||||||
|
gadget_button_set_depressed(c->b, 1);
|
||||||
toggle(selected=c);
|
toggle(selected=c);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
if(event.xbutton.button==Button1 && selected)
|
if(event.xbutton.button==Button1 && selected) {
|
||||||
if(depressed)
|
if(depressed)
|
||||||
endchoice();
|
endchoice();
|
||||||
else
|
else
|
||||||
abortchoice();
|
abortchoice();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
142
screen.c
142
screen.c
@@ -23,7 +23,23 @@ extern XContext screen_context, client_context, vroot_context;
|
|||||||
extern void createmenubar();
|
extern void createmenubar();
|
||||||
extern void reparent(Client *);
|
extern void reparent(Client *);
|
||||||
|
|
||||||
Scrn *front = NULL, *scr = NULL;
|
static Scrn *_front = NULL;
|
||||||
|
Scrn *scr = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Accessor methods to get and set the 'front' screen.
|
||||||
|
*/
|
||||||
|
Scrn *
|
||||||
|
get_front_scr(void)
|
||||||
|
{
|
||||||
|
return _front;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_front_scr(Scrn *s)
|
||||||
|
{
|
||||||
|
_front = s;
|
||||||
|
}
|
||||||
|
|
||||||
static Scrn *getvroot(Window root)
|
static Scrn *getvroot(Window root)
|
||||||
{
|
{
|
||||||
@@ -52,37 +68,37 @@ void setvirtualroot(Scrn *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Scrn *getscreenbyroot(Window w);
|
Scrn *getscreenbyrootext(Window w, int include_fs);
|
||||||
|
|
||||||
void screentoback(void)
|
void screentoback(void)
|
||||||
{
|
{
|
||||||
Scrn *f;
|
Scrn *f;
|
||||||
if((!scr)||(scr->back==scr->root)) return;
|
if((!scr)||(scr->back==scr->root)) return;
|
||||||
if(scr==front) {
|
if(scr == get_front_scr()) {
|
||||||
XLowerWindow(dpy, scr->back);
|
XLowerWindow(dpy, scr->back);
|
||||||
front=scr->behind;
|
set_front_scr(scr->behind);
|
||||||
} else if(scr==getscreenbyroot(scr->root)) {
|
} else if(scr==getscreenbyrootext(scr->root, 1)) {
|
||||||
XLowerWindow(dpy, scr->back);
|
XLowerWindow(dpy, scr->back);
|
||||||
scr->upfront->behind=scr->behind;
|
scr->upfront->behind=scr->behind;
|
||||||
scr->behind->upfront=scr->upfront;
|
scr->behind->upfront=scr->upfront;
|
||||||
scr->upfront=front->upfront;
|
scr->upfront = get_front_scr()->upfront;
|
||||||
scr->behind=front;
|
scr->behind = get_front_scr();
|
||||||
front->upfront->behind=scr;
|
get_front_scr()->upfront->behind=scr;
|
||||||
front->upfront=scr;
|
get_front_scr()->upfront=scr;
|
||||||
} else if(scr->behind==front) {
|
} else if(scr->behind == get_front_scr()) {
|
||||||
XRaiseWindow(dpy, scr->back);
|
XRaiseWindow(dpy, scr->back);
|
||||||
front=scr;
|
set_front_scr(scr);
|
||||||
} else {
|
} else {
|
||||||
XRaiseWindow(dpy, scr->back);
|
XRaiseWindow(dpy, scr->back);
|
||||||
scr->upfront->behind=scr->behind;
|
scr->upfront->behind=scr->behind;
|
||||||
scr->behind->upfront=scr->upfront;
|
scr->behind->upfront=scr->upfront;
|
||||||
scr->upfront=front->upfront;
|
scr->upfront = get_front_scr()->upfront;
|
||||||
scr->behind=front;
|
scr->behind = get_front_scr();
|
||||||
front->upfront->behind=scr;
|
get_front_scr()->upfront->behind=scr;
|
||||||
front->upfront=scr;
|
get_front_scr()->upfront=scr;
|
||||||
front=scr;
|
set_front_scr(scr);
|
||||||
}
|
}
|
||||||
if((f = getscreenbyroot(scr->root))) {
|
if((f = getscreenbyrootext(scr->root, 0))) {
|
||||||
init_dri(&f->dri, dpy, f->root, f->cmap, True);
|
init_dri(&f->dri, dpy, f->root, f->cmap, True);
|
||||||
setvirtualroot(f);
|
setvirtualroot(f);
|
||||||
}
|
}
|
||||||
@@ -106,46 +122,54 @@ static void scanwins()
|
|||||||
unsigned int i, nwins;
|
unsigned int i, nwins;
|
||||||
Client *c;
|
Client *c;
|
||||||
Window dw1, dw2, *wins;
|
Window dw1, dw2, *wins;
|
||||||
XWindowAttributes *pattr=NULL;
|
|
||||||
XPointer dummy;
|
XPointer dummy;
|
||||||
Scrn *s=scr;
|
Scrn *s=scr;
|
||||||
|
|
||||||
|
XGrabServer(dpy);
|
||||||
XQueryTree(dpy, scr->root, &dw1, &dw2, &wins, &nwins);
|
XQueryTree(dpy, scr->root, &dw1, &dw2, &wins, &nwins);
|
||||||
if(nwins && (pattr=calloc(nwins, sizeof(XWindowAttributes)))) {
|
for (int scan_dialogs = 0; nwins > 0 && scan_dialogs <= 1; scan_dialogs++) {
|
||||||
for (i = 0; i < nwins; i++)
|
|
||||||
XGetWindowAttributes(dpy, wins[i], pattr+i);
|
|
||||||
for (i = 0; i < nwins; i++) {
|
for (i = 0; i < nwins; i++) {
|
||||||
|
XWindowAttributes attr;
|
||||||
|
Window leader = None;
|
||||||
|
|
||||||
|
XGetTransientForHint(dpy, wins[i], &leader);
|
||||||
|
if (!scan_dialogs && leader != None)
|
||||||
|
continue; /* first pass; skip dialogs */
|
||||||
|
if (scan_dialogs && leader == None)
|
||||||
|
continue; /* second pass; skip leaders */
|
||||||
|
XGetWindowAttributes(dpy, wins[i], &attr);
|
||||||
if (!XFindContext(dpy, wins[i], client_context, &dummy))
|
if (!XFindContext(dpy, wins[i], client_context, &dummy))
|
||||||
continue;
|
continue;
|
||||||
if (pattr[i].override_redirect) {
|
if (attr.override_redirect) {
|
||||||
if(scr->back!=scr->root && XFindContext(dpy, wins[i], screen_context, &dummy))
|
if(scr->back!=scr->root && XFindContext(dpy, wins[i], screen_context, &dummy))
|
||||||
assimilate(wins[i], pattr[i].x, pattr[i].y);
|
assimilate(wins[i], attr.x, attr.y);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
c = createclient(wins[i]);
|
c = createclient(wins[i]);
|
||||||
if (c != 0 && c->window == wins[i]) {
|
if (c != NULL && c->window == wins[i]) {
|
||||||
if (pattr[i].map_state == IsViewable) {
|
if (attr.map_state == IsViewable) {
|
||||||
c->state=NormalState;
|
c->state=NormalState;
|
||||||
getstate(c);
|
getstate(c);
|
||||||
reparent(c);
|
reparent(c);
|
||||||
if(c->state==IconicState) {
|
if(c->state==IconicState && c->leader == NULL) {
|
||||||
createicon(c);
|
createicon(c);
|
||||||
adjusticon(c->icon);
|
adjusticon(c->icon);
|
||||||
XMapWindow(dpy, c->icon->window);
|
XMapWindow(dpy, c->icon->window);
|
||||||
if(c->icon->labelwidth)
|
if(c->icon->labelwidth)
|
||||||
XMapWindow(dpy, c->icon->labelwin);
|
XMapWindow(dpy, c->icon->labelwin);
|
||||||
c->icon->mapped=1;
|
c->icon->mapped=1;
|
||||||
} else if(c->state==NormalState)
|
} else if(c->state==NormalState) {
|
||||||
XMapRaised(dpy, c->parent);
|
XMapRaised(dpy, c->parent);
|
||||||
else
|
} else {
|
||||||
XRaiseWindow(dpy, c->parent);
|
XRaiseWindow(dpy, c->parent);
|
||||||
|
}
|
||||||
c->reparenting=1;
|
c->reparenting=1;
|
||||||
scr=s;
|
scr=s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(pattr);
|
|
||||||
}
|
}
|
||||||
|
XUngrabServer(dpy);
|
||||||
XFree((void *) wins);
|
XFree((void *) wins);
|
||||||
cleanupicons();
|
cleanupicons();
|
||||||
}
|
}
|
||||||
@@ -163,8 +187,10 @@ void closescreen(void)
|
|||||||
|
|
||||||
XDeleteContext(dpy,scr->menubardepth,screen_context);
|
XDeleteContext(dpy,scr->menubardepth,screen_context);
|
||||||
XDestroyWindow(dpy,scr->menubardepth);
|
XDestroyWindow(dpy,scr->menubardepth);
|
||||||
XDeleteContext(dpy,scr->menubarparent,screen_context);
|
if (scr->menubarparent != None) {
|
||||||
XDestroyWindow(dpy,scr->menubarparent);
|
XDeleteContext(dpy,scr->menubarparent,screen_context);
|
||||||
|
XDestroyWindow(dpy,scr->menubarparent);
|
||||||
|
}
|
||||||
XDeleteContext(dpy,scr->menubar,screen_context);
|
XDeleteContext(dpy,scr->menubar,screen_context);
|
||||||
XDestroyWindow(dpy,scr->menubar);
|
XDestroyWindow(dpy,scr->menubar);
|
||||||
if(scr->inputbox != None) {
|
if(scr->inputbox != None) {
|
||||||
@@ -181,8 +207,8 @@ void closescreen(void)
|
|||||||
term_dri(&scr->dri, dpy, scr->cmap);
|
term_dri(&scr->dri, dpy, scr->cmap);
|
||||||
if(scr->iconcolorsallocated)
|
if(scr->iconcolorsallocated)
|
||||||
XFreeColors(dpy, scr->cmap, scr->iconcolor, scr->iconcolorsallocated, 0);
|
XFreeColors(dpy, scr->cmap, scr->iconcolor, scr->iconcolorsallocated, 0);
|
||||||
if(front==scr)
|
if(get_front_scr()==scr)
|
||||||
front=scr->behind;
|
set_front_scr(scr->behind);
|
||||||
dummy=scr->behind;
|
dummy=scr->behind;
|
||||||
free(scr);
|
free(scr);
|
||||||
scr=dummy;
|
scr=dummy;
|
||||||
@@ -292,14 +318,14 @@ Scrn *openscreen(char *deftitle, Window root)
|
|||||||
s->default_tool_pm_w=0;
|
s->default_tool_pm_w=0;
|
||||||
s->default_tool_pm_h=0;
|
s->default_tool_pm_h=0;
|
||||||
|
|
||||||
if(front) {
|
if(get_front_scr()) {
|
||||||
s->behind=front;
|
s->behind = get_front_scr();
|
||||||
s->upfront=front->upfront;
|
s->upfront = get_front_scr()->upfront;
|
||||||
front->upfront->behind=s;
|
get_front_scr()->upfront->behind=s;
|
||||||
front->upfront=s;
|
get_front_scr()->upfront=s;
|
||||||
} else {
|
} else {
|
||||||
s->behind = s->upfront = s;
|
s->behind = s->upfront = s;
|
||||||
front = s;
|
set_front_scr(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
scr=s;
|
scr=s;
|
||||||
@@ -309,7 +335,7 @@ Scrn *openscreen(char *deftitle, Window root)
|
|||||||
|
|
||||||
void realizescreens(void)
|
void realizescreens(void)
|
||||||
{
|
{
|
||||||
scr = front;
|
scr = get_front_scr();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if(!scr->realized) {
|
if(!scr->realized) {
|
||||||
@@ -342,12 +368,15 @@ void realizescreens(void)
|
|||||||
KeyPressMask|KeyReleaseMask|
|
KeyPressMask|KeyReleaseMask|
|
||||||
ButtonPressMask|ButtonReleaseMask);
|
ButtonPressMask|ButtonReleaseMask);
|
||||||
|
|
||||||
XStoreName(dpy, scr->back, scr->title);
|
if (scr->title)
|
||||||
|
XStoreName(dpy, scr->back, scr->title);
|
||||||
XLowerWindow(dpy, scr->back);
|
XLowerWindow(dpy, scr->back);
|
||||||
XMapWindow(dpy, scr->back);
|
XMapWindow(dpy, scr->back);
|
||||||
|
if (!scr->deftitle)
|
||||||
|
scr->realized = 1;
|
||||||
}
|
}
|
||||||
scr=scr->behind;
|
scr=scr->behind;
|
||||||
} while(scr!=front);
|
} while(scr != get_front_scr());
|
||||||
do {
|
do {
|
||||||
if(!scr->realized) {
|
if(!scr->realized) {
|
||||||
scanwins();
|
scanwins();
|
||||||
@@ -358,29 +387,34 @@ void realizescreens(void)
|
|||||||
scr->realized=1;
|
scr->realized=1;
|
||||||
}
|
}
|
||||||
scr=scr->behind;
|
scr=scr->behind;
|
||||||
} while(scr!=front);
|
} while(scr != get_front_scr());
|
||||||
}
|
}
|
||||||
|
|
||||||
Scrn *getscreen(Window w)
|
Scrn *getscreen(Window w)
|
||||||
{
|
{
|
||||||
Scrn *s=front;
|
Scrn *s = get_front_scr();
|
||||||
if(w && s)
|
if(w && s)
|
||||||
do {
|
do {
|
||||||
if(s->back == w || s->root == w)
|
if(s->back == w || s->root == w)
|
||||||
return s;
|
return s;
|
||||||
s=s->behind;
|
s=s->behind;
|
||||||
} while(s!=front);
|
} while(s != get_front_scr());
|
||||||
return front;
|
return get_front_scr();
|
||||||
|
}
|
||||||
|
|
||||||
|
Scrn *getscreenbyrootext(Window w, int include_fs)
|
||||||
|
{
|
||||||
|
Scrn *s = get_front_scr();
|
||||||
|
if(s)
|
||||||
|
do {
|
||||||
|
if(s->root == w && (include_fs || s->deftitle))
|
||||||
|
return s;
|
||||||
|
s=s->behind;
|
||||||
|
} while(s != get_front_scr());
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Scrn *getscreenbyroot(Window w)
|
Scrn *getscreenbyroot(Window w)
|
||||||
{
|
{
|
||||||
Scrn *s=front;
|
return getscreenbyrootext(w, 0);
|
||||||
if(s)
|
|
||||||
do {
|
|
||||||
if(s->root == w)
|
|
||||||
return s;
|
|
||||||
s=s->behind;
|
|
||||||
} while(s!=front);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|||||||
27
screen.h
27
screen.h
@@ -3,6 +3,18 @@
|
|||||||
|
|
||||||
#include "icon.h"
|
#include "icon.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Struct _Scrn - virtual desktop screen
|
||||||
|
*
|
||||||
|
* @root: root window for virtual desktop
|
||||||
|
* @back: background window
|
||||||
|
* @colormap: current colourmap
|
||||||
|
* @fh: font height for menu/window, including ascender/descender.
|
||||||
|
* @bh: title bar / menu bar height; fh + fixed padding.
|
||||||
|
* @icons: list of icons on this desktop.
|
||||||
|
* @firstselected: first selected icon on this desktop.
|
||||||
|
*/
|
||||||
|
|
||||||
typedef struct _Scrn {
|
typedef struct _Scrn {
|
||||||
struct _Scrn *behind, *upfront;
|
struct _Scrn *behind, *upfront;
|
||||||
Window root, back, inputbox;
|
Window root, back, inputbox;
|
||||||
@@ -25,6 +37,19 @@ typedef struct _Scrn {
|
|||||||
unsigned long iconcolor[256];
|
unsigned long iconcolor[256];
|
||||||
} Scrn;
|
} Scrn;
|
||||||
|
|
||||||
extern Scrn *scr, *front;
|
extern Scrn *scr;
|
||||||
|
|
||||||
|
Scrn * get_front_scr(void);
|
||||||
|
void set_front_scr(Scrn *s);
|
||||||
|
|
||||||
|
extern void closescreen();
|
||||||
|
extern Scrn * openscreen(char *, Window);
|
||||||
|
extern void realizescreens();
|
||||||
|
extern void screentoback();
|
||||||
|
|
||||||
|
void closescreen();
|
||||||
|
Scrn *openscreen(char *deftitle, Window root);
|
||||||
|
void realizescreens();
|
||||||
|
void screentoback();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
47
smakefile
47
smakefile
@@ -1,47 +0,0 @@
|
|||||||
|
|
||||||
PROGRAMS = amiwm requestchoice
|
|
||||||
|
|
||||||
AMIWM_HOME = amiwm:
|
|
||||||
|
|
||||||
SRCS1 = main.c drawinfo.c client.c frame.c icc.c \
|
|
||||||
icon.c menu.c diskobject.c gram.c lex.c rc.c
|
|
||||||
OBJS1 = main.o drawinfo.o client.o frame.o icc.o \
|
|
||||||
icon.o menu.o diskobject.o gram.o lex.o rc.o
|
|
||||||
|
|
||||||
SRCS2 = requestchoice.c drawinfo.c
|
|
||||||
OBJS2 = requestchoice.o drawinfo.o
|
|
||||||
|
|
||||||
|
|
||||||
all : $(PROGRAMS)
|
|
||||||
|
|
||||||
amiwm : $(OBJS1)
|
|
||||||
sc LINK PNAME amiwm $(OBJS1)
|
|
||||||
|
|
||||||
requestchoice : $(OBJS2)
|
|
||||||
sc LINK PNAME requestchoice $(OBJS2)
|
|
||||||
|
|
||||||
gram.c : gram.y
|
|
||||||
bison -y -d -o gram.c gram.y
|
|
||||||
|
|
||||||
lex.c : lex.l
|
|
||||||
flex -t < lex.l > lex.c
|
|
||||||
|
|
||||||
gram.o : gram.c
|
|
||||||
|
|
||||||
lex.o : lex.c
|
|
||||||
|
|
||||||
menu.o : menu.c
|
|
||||||
sc menu DEF AMIWM_HOME="$(AMIWM_HOME)"
|
|
||||||
|
|
||||||
rc.o : rc.c
|
|
||||||
sc rc DEF AMIWM_HOME="$(AMIWM_HOME)"
|
|
||||||
|
|
||||||
clean : tidy
|
|
||||||
-delete FORCE $(PROGRAMS)
|
|
||||||
|
|
||||||
tidy :
|
|
||||||
-delete FORCE \#?.(o|q|tmp|lnk) lex.c gram.c gram.h core
|
|
||||||
|
|
||||||
install :
|
|
||||||
copy amiwm requestchoice system.amiwmrc def_tool.info $(AMIWM_HOME)
|
|
||||||
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
FastQuit Off
|
FastQuit Off
|
||||||
SizeBorder Right
|
SizeBorder Right
|
||||||
IconPalette MagicWB
|
IconPalette MagicWB
|
||||||
|
IconDir "@AMIWM_HOME@/"
|
||||||
DefaultIcon "def_tool.info"
|
DefaultIcon "def_tool.info"
|
||||||
CustomIconsOnly Off
|
CustomIconsOnly Off
|
||||||
ShortLabelIcons Off
|
ShortLabelIcons Off
|
||||||
Reference in New Issue
Block a user