mirror of
https://github.com/openbsd/xenocara.git
synced 2025-12-08 18:28:43 +00:00
Remove the whole extras directory, not used in OpenBSD builds.
Noticed by fgsch@ a while ago.
This commit is contained in:
@@ -1,209 +0,0 @@
|
||||
1999-11-30 Dominik Vogt <dominik.vogt@gmx.de>
|
||||
|
||||
* FvwmTaskBar/Goodies.c:
|
||||
added #ifdef SHAPE
|
||||
|
||||
1999-11-29 Dominik Vogt <dominik.vogt@gmx.de>
|
||||
|
||||
* FvwmWharf/FvwmWharf.c (My_XNextEvent):
|
||||
* FvwmTaskBar/FvwmTaskBar.c (EndLessLoop):
|
||||
* FvwmScript/Widgets/Menu.c (EvtMouseMenu):
|
||||
* FvwmScript/Widgets/List.c (EvtMouseList):
|
||||
* FvwmScript/Instructions.c (Quit):
|
||||
* FvwmScript/FvwmScript.c (MainLoop):
|
||||
* FvwmPipe/FvwmPipe.c:
|
||||
* FvwmGoodStuff/FvwmGoodStuff.c (My_XNextEvent):
|
||||
* FvwmConsole/FvwmConsole.c:
|
||||
fixed select arguments
|
||||
|
||||
1999-02-15 Bob Woodside <proteus@pcnet.com>
|
||||
|
||||
* FvwmConsole/FvwmConsole.h: Switched the order of the includes for
|
||||
un.h and sockets.h, to correct a compile failure under Linux 2.2.1.
|
||||
|
||||
1999-02-14 Dominik Vogt <dominik_vogt@hp.com>
|
||||
|
||||
* FvwmGoodStuff/FvwmGoodStuff.c (RelieveWindow):
|
||||
* FvwmGoodStuff/FvwmGoodStuff.h: removed inline from declaration of
|
||||
RelieveWindow
|
||||
|
||||
1999-01-26 Steven Michael ROBBINS <stever@jeff.cs.mcgill.ca>
|
||||
|
||||
* FvwmConfig/WinBase.C: Removed include of strings.h, moved
|
||||
include of config.h to top.
|
||||
|
||||
1999-01-13 Steven Michael ROBBINS <stever@jeff.cs.mcgill.ca>
|
||||
|
||||
* FvwmTaskBar/FvwmTaskBar.c (ParseConfigLine): Made argument just
|
||||
"char", since "unsigned char" caused problems on systems with
|
||||
signed chars.
|
||||
|
||||
* FvwmConsole/FvwmConsole.c: Removed non-constant pointer from
|
||||
initializer of xterm_a.
|
||||
|
||||
Sun Jan 10 23:13:45 1999 Steve Robbins <steve@nyongwa.montreal.qc.ca>
|
||||
|
||||
* FvwmGoodStuff/FvwmGoodStuff.c (main): Inserted parentheses
|
||||
around && within ||.
|
||||
|
||||
Sun Jan 10 23:06:00 1999 Steve Robbins <steve@nyongwa.montreal.qc.ca>
|
||||
|
||||
* FvwmWharf/FvwmWharf.c:
|
||||
* FvwmTaskBar/FvwmTaskBar.c:
|
||||
* FvwmDebug/FvwmDebug.c: Removed unused variables.
|
||||
|
||||
Sun Jan 10 21:11:09 1999 Steve Robbins <steve@nyongwa.montreal.qc.ca>
|
||||
|
||||
* FvwmWharf/FvwmWharf.c (main):
|
||||
* FvwmTaskBar/FvwmTaskBar.c (main):
|
||||
* FvwmScript/FvwmScript.c (main):
|
||||
* FvwmPipe/FvwmPipe.c (main):
|
||||
* FvwmGoodStuff/FvwmGoodStuff.c (main):
|
||||
* FvwmDebug/FvwmDebug.c (main): Fixed "control reaches end of
|
||||
non-void function" bug.
|
||||
|
||||
Sun Jan 10 15:14:22 1999 Steve Robbins <steve@nyongwa.montreal.qc.ca>
|
||||
|
||||
* FvwmTaskBar/Colors.c:
|
||||
* FvwmGoodStuff/FvwmGoodStuff.c (GetHilite): Removed min & max
|
||||
macros; they are already in config.h.
|
||||
|
||||
Sun Jan 10 15:11:15 1999 Steve Robbins <steve@nyongwa.montreal.qc.ca>
|
||||
|
||||
* FvwmCommand/FvwmCommand.c:
|
||||
* FvwmCommand/FvwmCommand.h: Replaced select() code conditional on
|
||||
__hpux with code that uses SELECT_TYPE_ARG234.
|
||||
|
||||
Sun Jan 10 15:08:43 1999 Steve Robbins <steve@nyongwa.montreal.qc.ca>
|
||||
|
||||
* FvwmCommand/FvwmCommand.h: Replaced __linux with HAVE_GETOPT_H.
|
||||
|
||||
Sun Jan 10 15:05:33 1999 Steve Robbins <steve@nyongwa.montreal.qc.ca>
|
||||
|
||||
* FvwmWharf/icons.c:
|
||||
* FvwmGoodStuff/icons.c: Replaced NeXT with HAVE_FNCTL_H.
|
||||
|
||||
Sun Jan 10 15:03:26 1999 Steve Robbins <steve@nyongwa.montreal.qc.ca>
|
||||
|
||||
* FvwmGoodStuff/FvwmGoodStuff.c:
|
||||
* FvwmTaskBar/FvwmTaskBar.c:
|
||||
* FvwmWharf/FvwmWharf.c: Replaced messy set of symbols with
|
||||
HAVE_SYS_SELECT_H.
|
||||
|
||||
Sun Jan 10 15:01:37 1999 Steve Robbins <steve@nyongwa.montreal.qc.ca>
|
||||
|
||||
* FvwmWharf/FvwmWharf.c:
|
||||
* FvwmTaskBar/FvwmTaskBar.c:
|
||||
* FvwmGoodStuff/FvwmGoodStuff.c: Replaced symbol ISC with
|
||||
HAVE_SYS_BSDTYPES_H.
|
||||
|
||||
1999-01-08 Dominik Vogt <dominik_vogt@hp.com>
|
||||
|
||||
* FvwmTaskBar/**: some general cleanup
|
||||
|
||||
* FvwmTaskBar/FvwmTaskBar.c (ErrorHandler): added missing return value
|
||||
|
||||
* FvwmTaskBar/FvwmTaskBar.c (ReadFvwmPipe):
|
||||
(ProcessMessage):
|
||||
* FvwmTaskBar/ButtonArray.c (ButtonNew):
|
||||
(DrawButtonArray):
|
||||
(LocateButton):
|
||||
removed unused variables
|
||||
|
||||
* FvwmTaskBar/Goodies.c: Applied a RedHat bugfix for "mailbox"
|
||||
|
||||
1999-01-06 Paul D. Smith <psmith@gnu.org>
|
||||
|
||||
* FvwmConsole/Makefile.am: Use X_EXTRA_LIBS instead of socket_LIBS.
|
||||
|
||||
1998-12-02 Paul D. Smith <psmith@gnu.org>
|
||||
|
||||
* FvwmCommand/Makefile.am: Put FvwmCommand into bindir, not the
|
||||
module directory. FvwmCommandS still goes in the module dir.
|
||||
|
||||
1998-12-02 Dan Espen <dane@mk.bellcore.com>
|
||||
|
||||
* FvwmTaskBar/FvwmTaskBar.h: Update prototype for ParseConfig.
|
||||
|
||||
* FvwmTaskBar/FvwmTaskBar.1: Update config file reading note, bugs
|
||||
info, and remove references to fvwm95.
|
||||
|
||||
* FvwmTaskBar/FvwmTaskBar.c: Use GetConfigLine to read the config.
|
||||
|
||||
1998-11-24 Paul D. Smith <psmith@gnu.org>
|
||||
|
||||
* FvwmScript/types.h: Remove headers that are duplicated (and
|
||||
better tested for by autoconf) in the config.h file.
|
||||
|
||||
* FvwmConsole/FvwmConsole.h: Move sys/types.h include nearer the
|
||||
top, before sys/select.h.
|
||||
|
||||
1998-11-20 Dominik Vogt <dominik_vogt@hp.com>
|
||||
|
||||
* FvwmGoodStuff/FvwmGoodStuff.c (CreateWindow): border size bugfix
|
||||
|
||||
Tue Nov 10 10:23:11 1998 Steve Robbins <steve@nyongwa.montreal.qc.ca>
|
||||
|
||||
* FvwmScript: Added the yacc & lex output (scanner.c, script.c and
|
||||
script.h) to the CVS tree, so you can build without having these
|
||||
tools. Removed the old version of the yacc/lex input (the
|
||||
Compilers subdirectory).
|
||||
|
||||
Tue Nov 10 10:05:05 1998 Steve Robbins <steve@nyongwa.montreal.qc.ca>
|
||||
|
||||
* FvwmScript/Makefile.am (EXTRA_DIST): Added script.h.
|
||||
|
||||
Tue Nov 10 08:44:34 1998 Steve Robbins <steve@nyongwa.montreal.qc.ca>
|
||||
|
||||
* FvwmScript: Copied the yacc & lex source files from the Compiler
|
||||
subdirectory, and changed the makefile to build the .c and .h
|
||||
files from scanner.l and script.y.
|
||||
|
||||
Mon Nov 9 18:56:50 1998 Steve Robbins <steve@nyongwa.montreal.qc.ca>
|
||||
|
||||
* Makefile.am (SUBDIRS): Removed fvwmperl, since this version is
|
||||
known to be obsolete. Removed fvwmpython on suspicion of being
|
||||
obsolete.
|
||||
|
||||
1998-11-06 Paul D. Smith <psmith@gnu.org>
|
||||
|
||||
* FvwmWharf/Makefile.am (FvwmWharf_DEPENDENCIES):
|
||||
* FvwmTaskBar/Makefile.am (FvwmTaskBar_DEPENDENCIES):
|
||||
* FvwmScript/Makefile.am (FvwmScript_DEPENDENCIES):
|
||||
* FvwmPipe/Makefile.am (FvwmPipe_DEPENDENCIES):
|
||||
* FvwmGoodStuff/Makefile.am (FvwmGoodStuff_DEPENDENCIES):
|
||||
* FvwmCommand/Makefile.am (FvwmCommand_DEPENDENCIES,FvwmCommandS_DEPENDENCIES):
|
||||
* FvwmConfig/Makefile.am (FvwmConfig_DEPENDENCIES):
|
||||
* FvwmConsole/Makefile.am (FvwmConsole_DEPENDENCIES,FvwmConsoleC_DEPENDENCIES):
|
||||
* FvwmDebug/Makefile.am (FvwmDebug_DEPENDENCIES):
|
||||
Added a dependency on libfvwm.a.
|
||||
|
||||
* FvwmConsole/FvwmConsole.h: Remove reference to internal Linux
|
||||
include files.
|
||||
|
||||
1998-11-05 Paul D. Smith <psmith@gnu.org>
|
||||
|
||||
* FvwmScript/FvwmScript.c: Change DEBUG surrounding bounds checker
|
||||
code to MEMDEBUG, so you don't need the special library to enable
|
||||
debugging.
|
||||
|
||||
* FvwmCommand/FvwmCommand.h: Remove reference to internal Linux
|
||||
include files.
|
||||
* FvwmCommand/FvwmCommand.c: Include getopt.h.
|
||||
|
||||
* FvwmScript/Instructions.c (RemainderOfDiv): If the host doesn't
|
||||
have div(), just return an error message.
|
||||
|
||||
1998-11-05 Steven Michael ROBBINS <stever@jeff.cs.mcgill.ca>
|
||||
|
||||
* FvwmWharf/Wharf.h: Made icon_info.depth a signed char, because
|
||||
it is sometimes compared with -1.
|
||||
|
||||
* FvwmDebug/FvwmDebug.h (setvbuf): Checks for HAVE_SETVBUF and
|
||||
SETVBUF_REVERSED.
|
||||
|
||||
* FvwmTaskBar/Makefile.am (INCLUDES):
|
||||
* FvwmPipe/Makefile.am (INCLUDES):
|
||||
* FvwmDebug/Makefile.am (INCLUDES):
|
||||
* FvwmConsole/Makefile.am (INCLUDES): Added xpm_CFLAGS, since
|
||||
xpm.h is included by fvwmlib.h.
|
||||
@@ -1,322 +0,0 @@
|
||||
.\" t
|
||||
.\" @(#)FvwmCommand.1 4/6/98
|
||||
.de EX \"Begin example
|
||||
.ne 5
|
||||
.if n .sp 1
|
||||
.if t .sp .5
|
||||
.nf
|
||||
.in +.25i
|
||||
..
|
||||
.de EE
|
||||
.fi
|
||||
.in -.25i
|
||||
.if n .sp 1
|
||||
.if t .sp .5
|
||||
..
|
||||
.ta .2i .4i .6i .8i
|
||||
.TH FvwmCommand 1x "May 11 1998"
|
||||
.UC
|
||||
.SH NAME
|
||||
FvwmCommand \- FVWM2 command external interface
|
||||
|
||||
.SH SYNOPSIS
|
||||
FvwmCommand [-mrvw] [-S name] [-i level] [-f name] [-F level] [command...]
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
FvwmCommand lets you monitor fvwm2 transaction and issue fvwm2 command
|
||||
from a shell command line or scripts.
|
||||
FvwmCommand takes each argument as a fvwm2 command. Quotes can be
|
||||
used to send commands including spaces.
|
||||
.EX
|
||||
FvwmCommand 'FvwmPager 0 1'
|
||||
.EE
|
||||
.br
|
||||
.SH INVOCATION
|
||||
FvwmCommandS should be spawned once by fvwm2, either in .fvwm2rc file,
|
||||
from menu, or from FvwmConsole.
|
||||
From then on, FvwmCommand
|
||||
can be called from a shell or script to execute fvwm2 commands.
|
||||
|
||||
From within .fvwm2rc file:
|
||||
.EX
|
||||
Module FvwmCommandS
|
||||
|
||||
or
|
||||
|
||||
AddToFunc "InitFunction" "I" Module FvwmBanner
|
||||
+ "I" Module FvwmPager 0 8
|
||||
+ "I" Module FvwmCommandS
|
||||
|
||||
AddToFunc "RestartFunction" "I" Module FvwmCommandS
|
||||
+ "I" Module FvwmPager 0 8
|
||||
.EE
|
||||
|
||||
Then, in script file or from shell:
|
||||
|
||||
.EX
|
||||
FvwmCommand 'popup "Utilities"'
|
||||
.EE
|
||||
|
||||
.SH OPTIONS
|
||||
.IP "\fI-F <level>\fR" 0.4i
|
||||
Specifies the level of fvwm2 window flags FvwmCommand outputs.
|
||||
.sp
|
||||
.RS
|
||||
.IP 0 0.4i
|
||||
No window flags will be printed.
|
||||
.RE
|
||||
.RS
|
||||
.IP 2 0.4i
|
||||
Full window flags will be printed if information level, -i
|
||||
option, is 2 or 3.
|
||||
.sp
|
||||
.RE
|
||||
|
||||
.IP "\fI-f <name>\fR" 0.4i
|
||||
Specifies an alternative FIFO set to communicate with a server.
|
||||
The default FIFO set is ~/.FvwmCommand, in which
|
||||
~/.FvwmCommandC is used to send commands and ~/.FvwmCommandM is to receive
|
||||
messages.
|
||||
FvwmCommandS must have been invoked with the same <name> as its first argument
|
||||
prior to FvwmCommand invocation.
|
||||
Alternatively, option -S can be used. Refer option -S.
|
||||
This option -f is useful when a dedicated connection is necessary
|
||||
to run a background job while another connection is kept for
|
||||
interactive use.
|
||||
|
||||
.IP "\fI-i <level>\fR"
|
||||
Specifies the level of information that FvwmCommand outputs.
|
||||
.sp
|
||||
.RS
|
||||
.IP 0 0.4i
|
||||
Error messages only.
|
||||
.EX
|
||||
FvwmCommand -i0 FvwmBanner
|
||||
.EE
|
||||
will show a banner without any output. On the other hand,
|
||||
.EX
|
||||
FvwmCommand -i 0 foobar
|
||||
.EE
|
||||
will return,
|
||||
.EX
|
||||
[FVWM][executeModule]: <<ERROR>> No such module
|
||||
\'foobar\' in ModulePath '/usr/lib/X11/fvwm2'
|
||||
.EE
|
||||
|
||||
Note that Fvwm2 doesn't return any error messages in
|
||||
cases like below since 'windowid' itself is a valid command.
|
||||
.sp
|
||||
.EX
|
||||
FvwmCommand -i 0 'windowid foo bar'
|
||||
.EE
|
||||
.IP 1
|
||||
Errors and window configuration information. This is the default.
|
||||
.EX
|
||||
FvwmCommand send_windowlist
|
||||
.EE
|
||||
Information like below will show up.
|
||||
.EX
|
||||
|
||||
0x02000014 window FvwmConsole
|
||||
0x02000014 icon FvwmConsole
|
||||
0x02000014 class XTerm
|
||||
0x02000014 resource FvwmConsole
|
||||
0x01c00014 window console
|
||||
0x01c00014 icon console
|
||||
0x01c00014 class XTerm
|
||||
0x01c00014 resource console
|
||||
0x01000003 window Fvwm Pager
|
||||
0x01000003 icon
|
||||
0x01000003 class FvwmModule
|
||||
0x01000003 resource FvwmPager
|
||||
0x00c0002c window emacs: FvwmCommand.man
|
||||
0x00c0002c icon FvwmCommand.man
|
||||
0x00c0002c icon file xemacs.xpm
|
||||
0x00c0002c class Emacs
|
||||
0x00c0002c resource emacs
|
||||
end windowlist
|
||||
.EE
|
||||
The first column shows the window ID number, which can be used in 'windowid' command.
|
||||
The second column shows the information types.
|
||||
The last column shows the information contents.
|
||||
If no information is returned, add -w <time> or -r option.
|
||||
This might be needed in heavily loaded systems.
|
||||
.IP 2
|
||||
Above and static window information.
|
||||
.EX
|
||||
FvwmCommand -i2 'FvwmPager 0 1'
|
||||
.EE
|
||||
The below is its output.
|
||||
.EX
|
||||
|
||||
0x03c00003 frame x 962, y 743, width 187, height 114
|
||||
0x03c00003 desktop 0
|
||||
0x03c00003 StartIconic no
|
||||
0x03c00003 OnTop yes
|
||||
0x03c00003 Sticky yes
|
||||
0x03c00003 WindowListSkip yes
|
||||
0x03c00003 SuppressIcon no
|
||||
0x03c00003 NoiconTitle no
|
||||
0x03c00003 Lenience no
|
||||
0x03c00003 StickyIcon no
|
||||
0x03c00003 CirculateSkipIcon no
|
||||
0x03c00003 CirculateSkip no
|
||||
0x03c00003 ClickToFocus no
|
||||
0x03c00003 SloppyFocus no
|
||||
0x03c00003 SkipMapping no
|
||||
0x03c00003 Handles no
|
||||
0x03c00003 Title no
|
||||
0x03c00003 Mapped no
|
||||
0x03c00003 Iconified no
|
||||
0x03c00003 Transient no
|
||||
0x03c00003 Raised no
|
||||
0x03c00003 Visible no
|
||||
0x03c00003 IconOurs no
|
||||
0x03c00003 PixmapOurs no
|
||||
0x03c00003 ShapedIcon no
|
||||
0x03c00003 Maximized no
|
||||
0x03c00003 WmTakeFocus no
|
||||
0x03c00003 WmDeleteWindow yes
|
||||
0x03c00003 IconMoved no
|
||||
0x03c00003 IconUnmapped no
|
||||
0x03c00003 MapPending no
|
||||
0x03c00003 HintOverride yes
|
||||
0x03c00003 MWMButtons no
|
||||
0x03c00003 MWMBorders no
|
||||
0x03c00003 title height 0
|
||||
0x03c00003 border width 4
|
||||
0x03c00003 base size width 8, height 7
|
||||
0x03c00003 size increment width 9, height 9
|
||||
0x03c00003 min size width 8, height 7
|
||||
0x03c00003 max size width 32767, height 32767
|
||||
0x03c00003 gravity SouthEast
|
||||
0x03c00003 pixel text 0xffffff, back 0x7f7f7f
|
||||
0x03c00003 window Fvwm Pager
|
||||
0x03c00003 icon Fvwm Pager
|
||||
0x03c00003 class FvwmModule
|
||||
0x03c00003 resource FvwmPager
|
||||
.EE
|
||||
.IP 3
|
||||
All information available.
|
||||
.EX
|
||||
FvwmCommand -i3 'Killmodule Fvwm*'
|
||||
.EE
|
||||
This will report which windows are closed.
|
||||
.EX
|
||||
0x03400003 destroy
|
||||
0x02400002 destroy
|
||||
.EE
|
||||
.RE
|
||||
|
||||
.IP "\fI-m\fR"
|
||||
Monitors fvwm2 window information transaction. FvwmCommand continuously outputs
|
||||
information that it receives without exiting.
|
||||
This option can be used in a
|
||||
background job often combined with -i3 option in order to control windows
|
||||
dynamically.
|
||||
.EX
|
||||
FvwmCommand -mi3 | grep 'iconify'
|
||||
.EE
|
||||
It will report when windows are iconified or deiconified.
|
||||
.sp
|
||||
Note: FvwmCommand does not block buffer its output but many utilities such as
|
||||
grep or sed use block buffer. The output of the next example will not show up
|
||||
until either FvwmCommand is terminated or stdout buffer from
|
||||
grep is filled.
|
||||
.EX
|
||||
FvwmCommand -mi3 | grep ' map' |
|
||||
sed 's/\(0x[0-9a-f]*\).*/windowid \1 move 0 0/'
|
||||
.EE
|
||||
Instead, use tools with buffer control such as pty or perl.
|
||||
The below will iconify new windows when opened.
|
||||
.EX
|
||||
Fvwm -mi3 | perl -ne '
|
||||
$|=1;
|
||||
print "windowid $1 iconify\\n" if /^(0x\\S+) add/;
|
||||
\' > ~/\.FvwmCommandC
|
||||
.EE
|
||||
.IP "\fI-r\fR"
|
||||
Waits for a reply before it exits.
|
||||
FvwmCommand exits if no information or error is returned in a fixed amount of
|
||||
time period. (Refer option -w.)
|
||||
The option -r overrides this time limit and wait for at least one message
|
||||
back.
|
||||
After the initial message, it will wait for another message for the time
|
||||
limit.
|
||||
This option is useful when the system is too loaded to make any predition
|
||||
when the system is responding AND the command causes some
|
||||
message to be sent back.
|
||||
|
||||
.IP "\fI-S <name>\fR" 0.4i
|
||||
Invokes another server, FvwmCommandS, with FIFO set <name>.
|
||||
.br
|
||||
If -f option is not used with this option,
|
||||
the invoking FvwmCommand uses the default FIFO to communicate
|
||||
the default server to invoke a new server.
|
||||
.br
|
||||
If -f option is used with this option,
|
||||
the invoking FvwmCommand uses the default FIFO to communicate
|
||||
the default server to invoke a new server. Then, switch the FIFO
|
||||
set and start communicating the new server.
|
||||
.br
|
||||
This option -S is useful when a dedicated connection is necessary
|
||||
to run a background
|
||||
job while another connection is kept for interactive use.
|
||||
|
||||
If the <name> is a relative path name, that is relative from where
|
||||
fvwm2 is running, not from where FvwmCommand is invoked.
|
||||
|
||||
.IP "\fI-v\fR"
|
||||
Returns FvwmCommand version number and exits.
|
||||
|
||||
.IP "\fI-w <time>\fR"
|
||||
Waits for <time> micro seconds for a message.
|
||||
FvwmCommand exits if no information or error is returned in a fixed amount of
|
||||
time period unless option -m is used.
|
||||
The default is 500 ms. This option overrides this default value.
|
||||
|
||||
.SH WRAPPER
|
||||
.sp
|
||||
.sp
|
||||
FvwmCommand.sh has bourne shell function definitions
|
||||
to keep the syntax similar to fvwm2 configuration file.
|
||||
This file is to be sourced:
|
||||
.EX
|
||||
\&. FvwmCommand.sh
|
||||
.br
|
||||
DesktopSize 5x5
|
||||
.EE
|
||||
.br
|
||||
FvwmCommand.pm is for perl in order
|
||||
to keep the syntax similar to fvwm2 configuration file.
|
||||
Commas can be used to separate Fvwm2 commands' arguments.
|
||||
.EX
|
||||
use FvwmCommand;
|
||||
if( $ARGV[0] eq 'home' ) {
|
||||
Desk 0,0; GotoPage '1 1';
|
||||
}elsif( $ARGV[0] eq 'jump' ) {
|
||||
Desk "0 2"; GotoPage 0, 1;
|
||||
}
|
||||
.EE
|
||||
Although arguments in FvwmCommand are not case sensitive as fvwm2,
|
||||
the functions defined in FvwmCommand.sh and FvwmCommand.pl are case sensitive.
|
||||
|
||||
|
||||
.SH ERRORS
|
||||
If the following error message show up, it is most likely that FvwmCommandS
|
||||
is not running.
|
||||
.EX
|
||||
FvwmCommand error in opening message fifo
|
||||
--No such file or directory--
|
||||
.EE
|
||||
Fvwm2 modules don't return error messages to fvwm2 but output on
|
||||
stderr. These error messages will not be shown as FvwmCommand messages.
|
||||
|
||||
.SH SEE ALSO
|
||||
fvwm2
|
||||
|
||||
.SH AUTHOR
|
||||
Toshi Isogai isogai@ucsub.colorado.edu
|
||||
|
||||
|
||||
@@ -1,757 +0,0 @@
|
||||
/* $Id: FvwmCommand.c,v 1.2 2012/03/04 12:07:01 fgsch Exp $
|
||||
* $Source: /home/cvs/xenocara/app/fvwm/extras/FvwmCommand/Attic/FvwmCommand.c,v $
|
||||
*
|
||||
* Fvwm2 command input interface.
|
||||
*
|
||||
* Copyright 1998, Toshi Isogai.
|
||||
* Use this program at your own risk.
|
||||
* Permission to use this program for any purpose is given,
|
||||
* as long as the copyright is kept intact.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "FvwmCommand.h"
|
||||
|
||||
#define MYNAME "FvwmCommand"
|
||||
|
||||
int Fdr, Fdw; /* file discriptor for fifo */
|
||||
FILE *Frun; /* File contains pid */
|
||||
char *Fr_name;
|
||||
int Pfd;
|
||||
char *get_line();
|
||||
fd_set fdset;
|
||||
|
||||
struct timeval Tv;
|
||||
int Opt_reply; /* wait for replay */
|
||||
int Opt_monitor;
|
||||
int Opt_info;
|
||||
int Opt_Serv;
|
||||
int Opt_flags;
|
||||
FILE *Fp;
|
||||
int Rc; /* return code */
|
||||
int Bg; /* FvwmCommand in background */
|
||||
|
||||
void err_msg( char *msg );
|
||||
void err_quit( char *msg );
|
||||
void sendit( char *cmd );
|
||||
void receive( void );
|
||||
void sig_ttin ( int );
|
||||
void sig_pipe ( int );
|
||||
void sig_quit ( int );
|
||||
void usage(void);
|
||||
int read_f (int fd, char *p, int len);
|
||||
void close_fifos (void);
|
||||
|
||||
void process_message( void ) ;
|
||||
void list( unsigned long *body, char *) ;
|
||||
void list_configure(unsigned long *body);
|
||||
void list_focus_change(unsigned long *body) ;
|
||||
void list_header(unsigned long *body, char *) ;
|
||||
void list_icon_loc(unsigned long *body) ;
|
||||
void list_iconify(unsigned long *body);
|
||||
void list_mini_icon(unsigned long *body) ;
|
||||
void list_new_desk(unsigned long *body) ;
|
||||
void list_new_page(unsigned long *body) ;
|
||||
void list_string (char *str);
|
||||
void spawn_child( void );
|
||||
|
||||
|
||||
/*******************************************************
|
||||
*
|
||||
* send command to and receive message from the server
|
||||
*
|
||||
*******************************************************/
|
||||
int main ( int argc, char *argv[]) {
|
||||
char cmd[MAX_COMMAND_SIZE];
|
||||
char *home;
|
||||
char *f_stem, *fc_name, *fm_name;
|
||||
char *sf_stem;
|
||||
int i;
|
||||
int opt;
|
||||
int ncnt;
|
||||
int count;
|
||||
struct timeval tv2;
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
|
||||
signal (SIGINT, sig_quit);
|
||||
signal (SIGHUP, sig_quit);
|
||||
signal (SIGQUIT, sig_quit);
|
||||
signal (SIGTERM, sig_quit);
|
||||
signal (SIGTTIN, sig_ttin);
|
||||
signal (SIGTTOU, sig_ttin);
|
||||
|
||||
Opt_reply = 0;
|
||||
Opt_info = 1;
|
||||
f_stem = NULL;
|
||||
sf_stem = NULL;
|
||||
Opt_monitor = 0;
|
||||
Opt_Serv = 0;
|
||||
Opt_flags = 2;
|
||||
Tv.tv_sec = 0;
|
||||
Tv.tv_usec = 500000;
|
||||
Rc = 0;
|
||||
Bg = 0;
|
||||
|
||||
|
||||
while( (opt = getopt( argc, argv, "S:hvF:f:w:i:rm" )) != EOF ) {
|
||||
switch(opt) {
|
||||
case 'h':
|
||||
usage();
|
||||
exit(0);
|
||||
break;
|
||||
case 'f':
|
||||
f_stem = optarg;
|
||||
break;
|
||||
case 'F':
|
||||
Opt_flags = atoi (optarg);
|
||||
break;
|
||||
case 'S':
|
||||
sf_stem = optarg;
|
||||
Opt_Serv = 1;
|
||||
break;
|
||||
case 'i':
|
||||
Opt_info = atoi( optarg );
|
||||
break;
|
||||
case 'v':
|
||||
printf("%s %s\n", MYNAME, MYVERSION );
|
||||
exit(0);
|
||||
case 'w':
|
||||
Tv.tv_usec = atoi( optarg ) % 1000000;
|
||||
Tv.tv_sec = atoi( optarg ) / 1000000;
|
||||
break;
|
||||
case 'm':
|
||||
Opt_monitor = 1;
|
||||
break;
|
||||
case 'r':
|
||||
Opt_reply = 1;
|
||||
break;
|
||||
case '?':
|
||||
exit(3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( f_stem == NULL ) {
|
||||
home = getenv("HOME");
|
||||
f_stem = safemalloc( strlen(home)+ strlen(F_NAME) + 3);
|
||||
strcpy (f_stem, home);
|
||||
if (f_stem[strlen(f_stem)-1] != '/') {
|
||||
strcat (f_stem, "/");
|
||||
}
|
||||
strcat (f_stem, F_NAME);
|
||||
}
|
||||
|
||||
/* create 2 fifos */
|
||||
fm_name = safemalloc( strlen(f_stem) + 2 );
|
||||
strcpy(fm_name,f_stem);
|
||||
strcat(fm_name, "M");
|
||||
fc_name = safemalloc( strlen(f_stem) + 2 );
|
||||
strcpy(fc_name,f_stem);
|
||||
strcat(fc_name, "C");
|
||||
Fr_name = safemalloc( strlen(f_stem) + 2 );
|
||||
strcpy(Fr_name,f_stem);
|
||||
strcat(Fr_name, "R");
|
||||
|
||||
if ((Frun = fopen (Fr_name,"r" )) !=NULL) {
|
||||
if (fgets (cmd, 20, Frun) != NULL) {
|
||||
fprintf (stderr, "\nFvwmCommand lock file %sR is detected. "
|
||||
"This may indicate another FvwmCommand is running. "
|
||||
"It appears to be running under process ID:\n%s\n",
|
||||
f_stem, cmd );
|
||||
fprintf (stderr, "You may either kill the process or run FvwmCommand "
|
||||
"with another FIFO set using option -S and -f. "
|
||||
"If the process doesn't exist, simply remove file:\n%sR\n\n",
|
||||
f_stem);
|
||||
exit(1);
|
||||
}
|
||||
fclose (Frun);
|
||||
unlink (Fr_name);
|
||||
}
|
||||
|
||||
if( Opt_Serv ) {
|
||||
sprintf (cmd,"%s '%sS %s'", argv[0], MYNAME, sf_stem);
|
||||
system (cmd);
|
||||
}
|
||||
|
||||
if ((Frun = fopen (Fr_name,"w" )) != NULL) {
|
||||
fprintf (Frun, "%d\n", (int) getpid());
|
||||
fclose (Frun);
|
||||
}else {
|
||||
err_quit ("writing lock file");
|
||||
}
|
||||
|
||||
Fdr = Fdw = -1;
|
||||
count = 0;
|
||||
while ((Fdr=open (fm_name, O_RDONLY)) < 0) {
|
||||
if (count++>5) {
|
||||
err_quit ("opening message fifo");
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
count = 0;
|
||||
while ((Fdw=open (fc_name, O_WRONLY)) < 0) {
|
||||
if (count++>2) {
|
||||
err_quit ("opening command fifo");
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
strcpy (cmd, CMD_CONNECT);
|
||||
sendit (cmd);
|
||||
|
||||
i = optind;
|
||||
if( Opt_monitor ) {
|
||||
|
||||
/* test if its stdin is closed for coprocess */
|
||||
tv2.tv_sec = 0;
|
||||
tv2.tv_usec = 5;
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(STDIN_FILENO, &fdset);
|
||||
ncnt = select(FD_SETSIZE,SELECT_TYPE_ARG234 &fdset, 0, 0, &tv2);
|
||||
if( ncnt && (fgets( cmd, 1, stdin )==0 || cmd[0] == 0)) {
|
||||
Bg = 1;
|
||||
}
|
||||
|
||||
/* line buffer stdout for coprocess */
|
||||
setvbuf( stdout, NULL, _IOLBF, 0);
|
||||
|
||||
/* send arguments first */
|
||||
for( ;i < argc; i++ ) {
|
||||
strncpy( cmd, argv[i], MAX_COMMAND_SIZE-2 );
|
||||
sendit( cmd );
|
||||
}
|
||||
|
||||
|
||||
while(1) {
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(Fdr, &fdset);
|
||||
if( Bg == 0 ) {
|
||||
FD_SET(STDIN_FILENO, &fdset);
|
||||
}
|
||||
ncnt = select(FD_SETSIZE,SELECT_TYPE_ARG234 &fdset, 0, 0, NULL);
|
||||
|
||||
/* message from fvwm */
|
||||
if (FD_ISSET(Fdr, &fdset)){
|
||||
process_message();
|
||||
}
|
||||
|
||||
if( Bg == 0 ) {
|
||||
/* command input */
|
||||
if( FD_ISSET(STDIN_FILENO, &fdset) ) {
|
||||
if( fgets( cmd, MAX_COMMAND_SIZE-2, stdin ) == 0 ) {
|
||||
if( Bg == 0 ) {
|
||||
/* other than SIGTTIN */
|
||||
break;
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
sendit( cmd );
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
for( ;i < argc; i++ ) {
|
||||
strncpy( cmd, argv[i], MAX_COMMAND_SIZE-2 );
|
||||
sendit( cmd );
|
||||
receive();
|
||||
}
|
||||
}
|
||||
close_fifos();
|
||||
exit( Rc );
|
||||
}
|
||||
|
||||
/*
|
||||
* send exit notice and close fifos
|
||||
*/
|
||||
void close_fifos (void) {
|
||||
char cmd[10];
|
||||
|
||||
if (Fdw >= 0) {
|
||||
strcpy (cmd, CMD_EXIT);
|
||||
sendit (cmd);
|
||||
}
|
||||
close(Fdr);
|
||||
close(Fdw);
|
||||
unlink (Fr_name);
|
||||
}
|
||||
|
||||
/******************************************
|
||||
* signal handlers
|
||||
******************************************/
|
||||
void sig_quit (int dummy) {
|
||||
close_fifos();
|
||||
err_msg("receiving signal\n" );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void sig_ttin( int dummy ) {
|
||||
Bg = 1;
|
||||
signal( SIGTTIN, SIG_IGN );
|
||||
}
|
||||
|
||||
/************************************/
|
||||
/* print error message on stderr */
|
||||
/************************************/
|
||||
void err_quit( char *msg ) {
|
||||
fprintf (stderr, "%s ", strerror(errno));
|
||||
err_msg(msg);
|
||||
close_fifos();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void err_msg( char *msg ) {
|
||||
fprintf( stderr, "%s error in %s\n", MYNAME , msg );
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/* add cr to the command and send it */
|
||||
/*************************************/
|
||||
void sendit( char *cmd ) {
|
||||
int clen;
|
||||
|
||||
if( cmd[0] != '\0' ) {
|
||||
clen = strlen(cmd);
|
||||
|
||||
/* add cr */
|
||||
if( cmd[clen-1] != '\n' ) {
|
||||
strcat(cmd, "\n");
|
||||
clen++;
|
||||
}
|
||||
if( clen != 1 ) {
|
||||
write( Fdw, cmd, clen );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void receive () {
|
||||
int ncnt;
|
||||
struct timeval tv;
|
||||
|
||||
if( Opt_reply ) {
|
||||
/* wait indefinitely */
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET( Fdr, &fdset);
|
||||
ncnt = select(FD_SETSIZE, SELECT_TYPE_ARG234 &fdset, 0, 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
while (1){
|
||||
tv.tv_sec = Tv.tv_sec;
|
||||
tv.tv_usec = Tv.tv_usec;
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(Fdr, &fdset);
|
||||
|
||||
ncnt = select(FD_SETSIZE, SELECT_TYPE_ARG234 &fdset, 0, 0, &tv);
|
||||
|
||||
if( ncnt < 0 ) {
|
||||
err_quit("receive");
|
||||
break;
|
||||
}
|
||||
if( ncnt == 0 ) {
|
||||
/* timeout */
|
||||
break;
|
||||
}
|
||||
if (FD_ISSET(Fdr, &fdset)) {
|
||||
process_message();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************
|
||||
* print usage
|
||||
*******************************/
|
||||
void usage(void) {
|
||||
fprintf (stderr, "Usage: %s [OPTION] [COMMAND]...\n", MYNAME);
|
||||
fprintf (stderr, "Send commands to fvwm2 via %sS\n\n", MYNAME);
|
||||
fprintf (stderr,
|
||||
" -F <flag info> 0 - no flag info\n");
|
||||
fprintf (stderr,
|
||||
" 2 - full flag info (default)\n");
|
||||
fprintf (stderr,
|
||||
" -S <file name> "
|
||||
"invoke another %s server with fifo <file name>\n",
|
||||
MYNAME);
|
||||
fprintf (stderr,
|
||||
" -f <file name> use fifo <file name> to connect to %sS\n",
|
||||
MYNAME);
|
||||
fprintf (stderr,
|
||||
" -i <info level> 0 - error only\n" );
|
||||
fprintf (stderr,
|
||||
" 1 - above and config info (default)\n" );
|
||||
fprintf (stderr,
|
||||
" 2 - above and static info\n" );
|
||||
fprintf (stderr,
|
||||
" 3 - above and dynamic info\n" );
|
||||
fprintf (stderr,
|
||||
" -m monitor fvwm2 message transaction\n");
|
||||
fprintf (stderr,
|
||||
" -r "
|
||||
"wait for a reply (overrides waiting time)\n");
|
||||
fprintf (stderr,
|
||||
" -v print version number\n");
|
||||
fprintf (stderr,
|
||||
" -w <micro sec> waiting time for the reponse from fvwm\n");
|
||||
fprintf (stderr, "\nDefault fifo names are ~/.%sC and ~/.%sM\n",
|
||||
MYNAME, MYNAME);
|
||||
fprintf (stderr, "Default waiting time is 500,000 us\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* read fifo
|
||||
*/
|
||||
int read_f (int fd, char *p, int len) {
|
||||
int i, n;
|
||||
for (i=0; i<len; ) {
|
||||
n = read (fd, &p[i], len-i);
|
||||
if (n<0 && errno!=EAGAIN) {
|
||||
err_quit("reading message");
|
||||
}
|
||||
if (n==0) {
|
||||
/* eof */
|
||||
close_fifos();
|
||||
exit( Rc );
|
||||
}
|
||||
i += n;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
* process message
|
||||
*/
|
||||
void process_message( void ) {
|
||||
unsigned long type, length, body[24*SOL];
|
||||
|
||||
read_f( Fdr, (char*)&type, SOL);
|
||||
read_f( Fdr, (char*)&length, SOL);
|
||||
read_f( Fdr, (char*)body, length );
|
||||
|
||||
if( type==M_ERROR ) {
|
||||
fprintf( stderr,"%s", (char *)&body[3] );
|
||||
Rc = 1;
|
||||
}else if( Opt_info >= 1 ) {
|
||||
|
||||
switch( type ) {
|
||||
|
||||
case M_WINDOW_NAME:
|
||||
list( body, "window");
|
||||
break;
|
||||
case M_ICON_NAME:
|
||||
list(body, "icon");
|
||||
break;
|
||||
case M_RES_CLASS:
|
||||
list(body, "class" );
|
||||
break;
|
||||
case M_RES_NAME:
|
||||
list(body, "resource");
|
||||
break;
|
||||
|
||||
case M_END_WINDOWLIST:
|
||||
list_string("end windowlist");
|
||||
break;
|
||||
|
||||
case M_ICON_FILE:
|
||||
list(body, "icon file");
|
||||
break;
|
||||
case M_ICON_LOCATION:
|
||||
list_icon_loc(body);
|
||||
break;
|
||||
|
||||
case M_END_CONFIG_INFO:
|
||||
list_string("end configinfo");
|
||||
break;
|
||||
|
||||
case M_DEFAULTICON:
|
||||
list(body, "default icon");
|
||||
break;
|
||||
|
||||
case M_MINI_ICON:
|
||||
list_mini_icon( body );
|
||||
break;
|
||||
|
||||
case M_CONFIG_INFO:
|
||||
printf( "%s", (char *)&body[3] );
|
||||
break;
|
||||
|
||||
default:
|
||||
if( Opt_info >=2 ) {
|
||||
|
||||
switch(type) {
|
||||
|
||||
case M_CONFIGURE_WINDOW:
|
||||
list_configure( body);
|
||||
break;
|
||||
case M_STRING:
|
||||
list(body, "string");
|
||||
break;
|
||||
|
||||
default:
|
||||
if( Opt_info >= 3 ) {
|
||||
switch( type ) {
|
||||
case M_NEW_PAGE:
|
||||
list_new_page(body);
|
||||
break;
|
||||
case M_NEW_DESK:
|
||||
list_new_desk(body);
|
||||
break;
|
||||
case M_ADD_WINDOW:
|
||||
list_header(body, "add");
|
||||
list_configure( body);
|
||||
break;
|
||||
case M_RAISE_WINDOW:
|
||||
list_header(body, "raise");
|
||||
break;
|
||||
case M_LOWER_WINDOW:
|
||||
list_header(body, "lower");
|
||||
break;
|
||||
case M_FOCUS_CHANGE:
|
||||
list_focus_change( body );
|
||||
break;
|
||||
case M_DESTROY_WINDOW:
|
||||
list_header(body, "destroy");
|
||||
break;
|
||||
case M_ICONIFY:
|
||||
list_iconify( body );
|
||||
break;
|
||||
case M_DEICONIFY:
|
||||
list_header(body, "deiconify");
|
||||
break;
|
||||
case M_MAP:
|
||||
list_header(body, "map");
|
||||
break;
|
||||
case M_WINDOWSHADE:
|
||||
list_header(body, "windowshade");
|
||||
break;
|
||||
case M_DEWINDOWSHADE:
|
||||
list_header(body, "dewindowshade");
|
||||
break;
|
||||
default:
|
||||
printf("0x%lx type 0x%lx\n", body[0], type );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************
|
||||
*
|
||||
* print configuration info
|
||||
*
|
||||
**********************************/
|
||||
|
||||
void list_configure(unsigned long *body) {
|
||||
unsigned long i;
|
||||
char *flag;
|
||||
char *grav;
|
||||
char *flagstr[32] = {
|
||||
"StartIconic",
|
||||
"OnTop",
|
||||
"Sticky",
|
||||
"WindowListSkip",
|
||||
"SuppressIcon",
|
||||
"NoiconTitle",
|
||||
"Lenience",
|
||||
"StickyIcon",
|
||||
"CirculateSkipIcon",
|
||||
"CirculateSkip",
|
||||
"ClickToFocus",
|
||||
"SloppyFocus",
|
||||
"SkipMapping",
|
||||
"Handles",
|
||||
"Title",
|
||||
"Mapped",
|
||||
"Iconified",
|
||||
"Transient",
|
||||
"Raised", /* ??? */
|
||||
"Visible",
|
||||
"IconOurs",
|
||||
"PixmapOurs",
|
||||
"ShapedIcon",
|
||||
"Maximized",
|
||||
"WmTakeFocus",
|
||||
"WmDeleteWindow",
|
||||
"IconMoved",
|
||||
"IconUnmapped",
|
||||
"MapPending",
|
||||
"HintOverride",
|
||||
"MWMButtons",
|
||||
"MWMBorders"
|
||||
};
|
||||
|
||||
|
||||
printf( "0x%08lx %-20s x %ld, y %ld, width %ld, height %ld\n",
|
||||
body[0], "frame", body[3], body[4], body[5], body[6] );
|
||||
printf( "0x%08lx %-20s %ld\n" ,body[0], "desktop", body[7]);
|
||||
|
||||
if (Opt_flags == 2) {
|
||||
for( i=0; i<=31; i++ ) {
|
||||
if( body[8] & (1<<i) ) {
|
||||
flag = "yes";
|
||||
}else{
|
||||
flag = "no";
|
||||
}
|
||||
printf( "0x%08lx %-20s %s\n", body[0], flagstr[i], flag );
|
||||
}
|
||||
}
|
||||
|
||||
printf( "0x%08lx %-20s %ld\n",
|
||||
body[0], "title height", body[9]);
|
||||
printf( "0x%08lx %-20s %ld\n",
|
||||
body[0], "border width", body[10]);
|
||||
printf( "0x%08lx %-20s width %ld, height %ld\n",
|
||||
body[0], "base size", body[11], body[12]);
|
||||
printf( "0x%08lx %-20s width %ld, height %ld\n",
|
||||
body[0], "size increment", body[13], body[14]);
|
||||
printf( "0x%08lx %-20s width %ld, height %ld\n",
|
||||
body[0], "min size", body[15], body[16]);
|
||||
printf( "0x%08lx %-20s width %ld, height %ld\n",
|
||||
body[0], "max size", body[17], body[18]);
|
||||
|
||||
|
||||
switch(body[21]) {
|
||||
case ForgetGravity:
|
||||
grav = "Forget";
|
||||
break;
|
||||
case NorthWestGravity:
|
||||
grav = "NorthWest";
|
||||
break;
|
||||
case NorthGravity:
|
||||
grav = "North";
|
||||
break;
|
||||
case NorthEastGravity:
|
||||
grav = "NorthEast";
|
||||
break;
|
||||
case WestGravity:
|
||||
grav = "West";
|
||||
break;
|
||||
case CenterGravity:
|
||||
grav = "Center";
|
||||
break;
|
||||
case EastGravity:
|
||||
grav = "East";
|
||||
break;
|
||||
case SouthWestGravity:
|
||||
grav = "SouthWest";
|
||||
break;
|
||||
case SouthGravity:
|
||||
grav = "South";
|
||||
break;
|
||||
case SouthEastGravity:
|
||||
grav = "SouthEast";
|
||||
break;
|
||||
case StaticGravity:
|
||||
grav = "Static";
|
||||
break;
|
||||
default:
|
||||
grav = "Unknown";
|
||||
break;
|
||||
}
|
||||
printf( "0x%08lx %-20s %s\n", body[0], "gravity", grav);
|
||||
|
||||
printf( "0x%08lx %-20s text 0x%lx, back 0x%lx\n",
|
||||
body[0], "pixel", body[22], body[23]);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* print info icon location
|
||||
*
|
||||
************************************************************************/
|
||||
void list_icon_loc(unsigned long *body) {
|
||||
|
||||
printf( "0x%08lx %-20s x %ld, y %ld, width %ld, height%ld\n",
|
||||
body[0], "icon location", body[3], body[4], body[5], body[6] );
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* print info mini icon
|
||||
*
|
||||
************************************************************************/
|
||||
void list_mini_icon(unsigned long *body) {
|
||||
|
||||
printf( "0x%08lx %-20s width %ld, height %ld, depth %ld\n",
|
||||
body[0], "mini icon",body[5], body[6], body[7] );
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* print info message body[3]
|
||||
*
|
||||
************************************************************************/
|
||||
void list( unsigned long *body, char *text ) {
|
||||
|
||||
printf( "0x%08lx %-20s %s\n", body[0], text, (char *)&body[3] );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* print info new page
|
||||
*
|
||||
************************************************************************/
|
||||
void list_new_page(unsigned long *body) {
|
||||
|
||||
printf( " %-20s x %ld, y %ld, desk %ld, max x %ld, max y %ld\n",
|
||||
"new page",
|
||||
body[0], body[0], body[2], body[3], body[4]);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* print info new desk
|
||||
*
|
||||
************************************************************************/
|
||||
void list_new_desk(unsigned long *body) {
|
||||
|
||||
printf( " %-20s %ld\n", "new desk", body[0] );
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* print string
|
||||
*
|
||||
************************************************************************/
|
||||
void list_string (char *str) {
|
||||
printf( "%-20s\n", str );
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* print info header
|
||||
*
|
||||
************************************************************************/
|
||||
void list_header(unsigned long *body, char *text) {
|
||||
|
||||
printf("0x%08lx %s\n", body[0], text);
|
||||
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* print info focus change
|
||||
*
|
||||
************************************************************************/
|
||||
void list_focus_change(unsigned long *body) {
|
||||
|
||||
printf( "0x%08lx %-20s highlight 0x%lx, foreground 0x%lx, background 0x%lx\n",
|
||||
body[0], "focus change", body[3], body[4], body[5] );
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* print info iconify
|
||||
*
|
||||
************************************************************************/
|
||||
void list_iconify(unsigned long *body) {
|
||||
|
||||
printf( "0x%08lx %-20s x %ld, y %ld, width %ld, hight %ld\n",
|
||||
body[0], "iconify", body[3], body[4], body[5], body[6] );
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#include "config.h"
|
||||
#include "fvwmlib.h"
|
||||
|
||||
#if HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#if HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../../fvwm/module.h"
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
extern char *sys_errlist[];
|
||||
#define strerror(_e) (sys_errlist[_e])
|
||||
#endif
|
||||
|
||||
|
||||
#define F_NAME ".FvwmCommand"
|
||||
|
||||
#define MAX_COMMAND_SIZE 768
|
||||
|
||||
#define CMD_KILL_NOUNLINK "#@killme\n"
|
||||
#define CMD_CONNECT "#@connect"
|
||||
#define CMD_EXIT "#@exit\n"
|
||||
|
||||
/* number of default arguments when invoked from fvwm2 */
|
||||
#define FARGS 6
|
||||
|
||||
#define SOL sizeof( unsigned long )
|
||||
|
||||
#define MYVERSION "1.5"
|
||||
@@ -1,406 +0,0 @@
|
||||
/* $Id: FvwmCommandS.c,v 1.1.1.1 2006/11/26 10:53:10 matthieu Exp $
|
||||
* $Source: /home/cvs/xenocara/app/fvwm/extras/FvwmCommand/Attic/FvwmCommandS.c,v $
|
||||
*
|
||||
* Fvwm command input interface.
|
||||
*
|
||||
* Copyright 1997, Toshi Isogai. No guarantees or warantees or anything
|
||||
* are provided. Use this program at your own risk. Permission to use
|
||||
* this program for any purpose is given,
|
||||
* as long as the copyright is kept intact.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "FvwmCommand.h"
|
||||
|
||||
#define MYNAME "FvwmCommandS"
|
||||
|
||||
int Fd[2]; /* pipe to fvwm */
|
||||
int Ffdr; /* command fifo file discriptors */
|
||||
int Ffdw; /* message fifo file discriptors */
|
||||
char *F_name, *Fc_name, *Fm_name; /* fifo name */
|
||||
char Nounlink; /* don't delete fifo when true */
|
||||
char Connect; /* client is connected */
|
||||
|
||||
int open_fifos (char *f_stem);
|
||||
void close_fifos();
|
||||
void close_pipes();
|
||||
void DeadPipe( int );
|
||||
void err_msg( char *msg );
|
||||
void err_quit( char *msg );
|
||||
void process_message(unsigned long type,unsigned long *body);
|
||||
void relay_packet( unsigned long, unsigned long, unsigned long *);
|
||||
void server( char * );
|
||||
void sig_handler( int );
|
||||
int write_f (int fd, char *p, int len);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
char *fifoname;
|
||||
|
||||
if(argc < FARGS) {
|
||||
fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",
|
||||
MYNAME, MYVERSION);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if( argc == FARGS+1 ) {
|
||||
fifoname = argv[FARGS];
|
||||
}else{
|
||||
fifoname = NULL;
|
||||
}
|
||||
|
||||
signal (SIGPIPE, DeadPipe);
|
||||
signal (SIGINT, sig_handler);
|
||||
signal (SIGQUIT, sig_handler);
|
||||
signal (SIGHUP, sig_handler);
|
||||
signal (SIGTERM, sig_handler);
|
||||
|
||||
Fd[0] = atoi(argv[1]);
|
||||
Fd[1] = atoi(argv[2]);
|
||||
|
||||
Nounlink = 0;
|
||||
|
||||
server( fifoname );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* signal handler
|
||||
*/
|
||||
void DeadPipe( int dummy ) {
|
||||
fprintf(stderr,"%s: dead pipe\n", MYNAME);
|
||||
close_pipes();
|
||||
exit(0);
|
||||
|
||||
}
|
||||
|
||||
void sig_handler(int signo) {
|
||||
close_pipes();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* setup server and communicate with fvwm and the client
|
||||
*/
|
||||
void server ( char *name ) {
|
||||
char *home;
|
||||
char *f_stem;
|
||||
int len;
|
||||
fd_set fdset;
|
||||
unsigned long *body;
|
||||
unsigned long header[HEADER_SIZE];
|
||||
char buf[MAX_COMMAND_SIZE]; /* command receiving buffer */
|
||||
char cmd[MAX_COMMAND_SIZE];
|
||||
int ix,cix;
|
||||
|
||||
if( name == NULL ) {
|
||||
/* default name */
|
||||
home = getenv("HOME");
|
||||
f_stem = safemalloc( strlen(home)+ strlen(F_NAME) + 3);
|
||||
strcpy (f_stem, home);
|
||||
if (f_stem[strlen(f_stem)-1] != '/') {
|
||||
strcat (f_stem, "/");
|
||||
}
|
||||
strcat (f_stem, F_NAME);
|
||||
}else{
|
||||
f_stem = name;
|
||||
}
|
||||
|
||||
if (open_fifos (f_stem) < 0) {
|
||||
exit (-1);
|
||||
}
|
||||
SendText(Fd," ",0); /* tell fvwm that we are here */
|
||||
|
||||
cix = 0;
|
||||
|
||||
while (1){
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(Ffdr, &fdset);
|
||||
FD_SET(Fd[1], &fdset);
|
||||
|
||||
if (select(FD_SETSIZE, SELECT_TYPE_ARG234 &fdset, 0, 0, NULL) < 0) {
|
||||
if (errno == EINTR) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (FD_ISSET(Fd[1], &fdset)){
|
||||
if( ReadFvwmPacket(Fd[1],header,&body) > 0) {
|
||||
if (Connect) {
|
||||
process_message(header[1], body);
|
||||
}
|
||||
free(body);
|
||||
}
|
||||
}
|
||||
|
||||
if (FD_ISSET(Ffdr, &fdset)){
|
||||
len = read( Ffdr, buf, MAX_COMMAND_SIZE-1 );
|
||||
if (len == 0) {
|
||||
continue;
|
||||
}
|
||||
if (len < 0) {
|
||||
if (errno != EAGAIN && errno != EINTR) {
|
||||
err_quit("reading fifo");
|
||||
}
|
||||
}
|
||||
|
||||
Connect = 1;
|
||||
/* in case of multiple long lines */
|
||||
for (ix=0; ix<len; ix++) {
|
||||
cmd[cix] = buf[ix];
|
||||
if (cmd[cix] == '\n') {
|
||||
cmd[cix+1] = '\0';
|
||||
cix = 0;
|
||||
if (!strncmp (cmd, CMD_CONNECT, strlen(CMD_CONNECT))) {
|
||||
/* do nothing */
|
||||
} else if (!strcmp (cmd, CMD_EXIT)) {
|
||||
Connect = 0;
|
||||
break;
|
||||
} else {
|
||||
if (!strcmp (cmd, CMD_KILL_NOUNLINK)) {
|
||||
Nounlink = 1;
|
||||
strcpy (cmd, "killme" );
|
||||
}
|
||||
SendText (Fd,cmd,0);
|
||||
}
|
||||
}else{
|
||||
if (cix >= MAX_COMMAND_SIZE-1) {
|
||||
err_msg ("command too long");
|
||||
cix = 0;
|
||||
} else {
|
||||
cix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* close fifos and pipes
|
||||
*/
|
||||
void close_pipes() {
|
||||
close (Fd[0]);
|
||||
close (Fd[1]);
|
||||
close_fifos();
|
||||
}
|
||||
|
||||
void close_fifos () {
|
||||
close (Ffdw);
|
||||
close (Ffdr);
|
||||
if (!Nounlink) {
|
||||
strcat (F_name,"C");
|
||||
unlink (F_name);
|
||||
F_name[strlen(F_name)-1] = 'M';
|
||||
unlink (F_name);
|
||||
F_name[strlen(F_name)-1] = 'R';
|
||||
unlink (F_name);
|
||||
}
|
||||
free (F_name);
|
||||
Ffdr = -1;
|
||||
Ffdw = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* open fifos
|
||||
*/
|
||||
int open_fifos (char *f_stem) {
|
||||
char *fc_name, *fm_name;
|
||||
|
||||
/* create 2 fifos */
|
||||
fc_name = malloc( strlen(f_stem) + 2 );
|
||||
if (fc_name == NULL) {
|
||||
err_msg( "allocating command" );
|
||||
return -1;
|
||||
}
|
||||
fm_name = malloc( strlen(f_stem) + 2 );
|
||||
if (fm_name == NULL) {
|
||||
err_msg( "allocating message" );
|
||||
return -1;
|
||||
}
|
||||
strcpy(fc_name,f_stem);
|
||||
strcpy(fm_name,f_stem);
|
||||
strcat(fc_name, "C");
|
||||
strcat(fm_name, "M");
|
||||
|
||||
if( (Ffdw = open(fc_name, O_RDWR | O_NONBLOCK ) ) > 0) {
|
||||
write_f( Ffdw, CMD_KILL_NOUNLINK, strlen(CMD_KILL_NOUNLINK) );
|
||||
close( Ffdw );
|
||||
}
|
||||
|
||||
unlink( fm_name );
|
||||
unlink( fc_name );
|
||||
|
||||
if( mkfifo( fm_name, S_IRUSR | S_IWUSR ) < 0 ) {
|
||||
err_msg( fm_name );
|
||||
return -1;
|
||||
}
|
||||
if( mkfifo( fc_name, S_IRUSR | S_IWUSR ) < 0 ) {
|
||||
err_msg( fc_name );
|
||||
return -1;
|
||||
}
|
||||
|
||||
Ffdr = open(fc_name, O_RDWR | O_NONBLOCK | O_TRUNC);
|
||||
if (Ffdr < 0) {
|
||||
err_msg( "opening command fifo" );
|
||||
return -1;
|
||||
}
|
||||
free(fc_name);
|
||||
Ffdw = open(fm_name, O_RDWR | O_NONBLOCK | O_TRUNC);
|
||||
if (Ffdw < 0) {
|
||||
err_msg( "opening message fifo" );
|
||||
return -1;
|
||||
}
|
||||
free(fm_name);
|
||||
|
||||
F_name = malloc (strlen (f_stem) + 2);
|
||||
if (F_name == NULL) {
|
||||
err_msg( "allocating name string" );
|
||||
return -1;
|
||||
}
|
||||
strcpy (F_name, f_stem);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Process window list messages
|
||||
*/
|
||||
|
||||
void process_message(unsigned long type,unsigned long *body){
|
||||
int msglen;
|
||||
|
||||
switch(type) {
|
||||
|
||||
case M_CONFIGURE_WINDOW:
|
||||
relay_packet( type, 24*SOL, body );
|
||||
break;
|
||||
|
||||
case M_WINDOW_NAME:
|
||||
case M_ICON_NAME:
|
||||
case M_RES_CLASS:
|
||||
case M_RES_NAME:
|
||||
case M_ICON_FILE:
|
||||
case M_DEFAULTICON:
|
||||
msglen = strlen( (char *)&body[3] );
|
||||
relay_packet( type, msglen+1+3*SOL, body );
|
||||
break;
|
||||
|
||||
case M_END_WINDOWLIST:
|
||||
case M_END_CONFIG_INFO:
|
||||
relay_packet( type, 0*SOL, body );
|
||||
break;
|
||||
|
||||
case M_ICON_LOCATION:
|
||||
relay_packet( type, 7*SOL, body );
|
||||
break;
|
||||
|
||||
case M_ERROR:
|
||||
case M_STRING:
|
||||
case M_CONFIG_INFO:
|
||||
msglen = strlen( (char *)&body[3] );
|
||||
relay_packet( type, msglen+1+3*SOL, body );
|
||||
break;
|
||||
|
||||
|
||||
case M_MINI_ICON:
|
||||
relay_packet( type, 6*SOL, body );
|
||||
break;
|
||||
|
||||
|
||||
case M_NEW_PAGE:
|
||||
relay_packet( type, 5*SOL, body );
|
||||
break;
|
||||
|
||||
case M_NEW_DESK:
|
||||
relay_packet( type, 1*SOL, body );
|
||||
break;
|
||||
|
||||
case M_ADD_WINDOW:
|
||||
relay_packet( type, 24*SOL, body );
|
||||
break;
|
||||
|
||||
case M_RAISE_WINDOW:
|
||||
case M_LOWER_WINDOW:
|
||||
case M_FOCUS_CHANGE:
|
||||
case M_DESTROY_WINDOW:
|
||||
case M_DEICONIFY:
|
||||
case M_MAP:
|
||||
case M_WINDOWSHADE:
|
||||
case M_DEWINDOWSHADE:
|
||||
relay_packet( type, 4*SOL, body );
|
||||
break;
|
||||
|
||||
case M_ICONIFY:
|
||||
relay_packet( type, 7*SOL, body );
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
relay_packet( type, 4*SOL, body );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* print error message on stderr and exit
|
||||
*/
|
||||
|
||||
void err_msg( char *msg ) {
|
||||
fprintf( stderr, "%s server error in %s, %s\n",
|
||||
MYNAME, msg, strerror(errno) );
|
||||
}
|
||||
|
||||
void err_quit( char *msg ) {
|
||||
err_msg (msg);
|
||||
close_pipes();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* relay packet to front-end
|
||||
*/
|
||||
void relay_packet( unsigned long type,
|
||||
unsigned long length, unsigned long *body) {
|
||||
write_f( Ffdw, (char*)&type, SOL );
|
||||
write_f( Ffdw, (char*)&length, SOL );
|
||||
write_f( Ffdw, (char*)body, length );
|
||||
}
|
||||
|
||||
/*
|
||||
* write to fifo
|
||||
*/
|
||||
int write_f (int fd, char *p, int len) {
|
||||
int i, n;
|
||||
struct timeval tv;
|
||||
int again;
|
||||
static int giveup=0;
|
||||
|
||||
again = 0;
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 50000;
|
||||
|
||||
for (i=0; i<len; ) {
|
||||
n = write (fd, &p[i], len-i);
|
||||
if (n<0) {
|
||||
if( errno==EINTR) {
|
||||
continue;
|
||||
} else if (errno==EAGAIN ) {
|
||||
if (again++ < 5) {
|
||||
select(0, 0, 0, 0, &tv);
|
||||
continue;
|
||||
}else{
|
||||
if (giveup++ > 20) {
|
||||
Connect = 0;
|
||||
}
|
||||
return -1; /* give up this message */
|
||||
}
|
||||
}
|
||||
err_quit ("writing fifo");
|
||||
}
|
||||
i += n;
|
||||
}
|
||||
giveup = 0;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
Installation
|
||||
|
||||
0. Un-tar the tar file under fvwm2/extras directory.
|
||||
|
||||
1. Edit Imake file to specify directory names to install
|
||||
function collection files.
|
||||
|
||||
2. Make Makefile by,
|
||||
xmkmf
|
||||
|
||||
3. Compile source files,
|
||||
make
|
||||
|
||||
4. To install binary files,
|
||||
make install
|
||||
|
||||
5. To install man page,
|
||||
make install.man
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
FvwmCommand is an interface to send commands to and receive
|
||||
information from Fvwm2 from processes which are not Fvwm modules.
|
||||
|
||||
|
||||
Examples
|
||||
|
||||
test1.pl - takes 1 argument 't' to invoke FvwmTalk
|
||||
'td' to kill FvwmTalk
|
||||
'' to move windows
|
||||
test2.sh - takes 1 argument 'b' to invoke FvwmButtons
|
||||
'kb' to kill FvwmButtons
|
||||
'r' to change # of button rows
|
||||
'c' to change # of button columns
|
||||
ex-auto.pl - auto raise small windows. It will keep them visible.
|
||||
ex-cascade.pl - cascade windows, then move them back.
|
||||
ex-grpmv.pl - choose a group of windows to move together.
|
||||
|
||||
Above examples are not meant to be practical but to show how it can
|
||||
be done.
|
||||
|
||||
|
||||
|
||||
focus-link.pl
|
||||
This is a user programmable window focus script.
|
||||
Default behavior is:
|
||||
1. When a window is opened up, focus the window and move the pointer
|
||||
to it. The parent window regains focus when a window is closed.
|
||||
Parenthood is determined when a window is opened. It is the last
|
||||
focused window with the same X class.
|
||||
2. #1 would not occur to AcroRead opening window.
|
||||
3. #1 would not occur when SkipMapping is set and the window is the
|
||||
only window of its class.
|
||||
4. For Netscape find dialog window, addition to #1, resize the window
|
||||
to 300x150 pixels and move it to East edge of the screen.
|
||||
Download/upload windows will not be focused nor be in focus link
|
||||
list.
|
||||
5. Move appletviewer to NorthWest corner.
|
||||
6. Xterm won't focus back to its parent after closed.
|
||||
7. When a window is de-iconified, focus it and move the pointer.
|
||||
|
||||
focus-Netscape.pl
|
||||
Focuses pop-up windows, such as 'open URL' or 'find' whenever
|
||||
opened up. This let the user to type in immediately without
|
||||
moving mouse. This script also moves 'download' window to the
|
||||
right edge to keep it visible. If this is invoked from
|
||||
.fvwm2rc, use as:
|
||||
|
||||
AddToFunc "InitFunction" "I" Module FvwmCommandS
|
||||
+ "I" Exec $HOME/scripts/focus-Netscape.pl
|
||||
|
||||
push-away.pl <direction> <window name>
|
||||
Pushes windows away to avoid overlapping. use as:
|
||||
|
||||
push-away.pl up 'Fvwm Pager'
|
||||
|
||||
|
||||
|
||||
Your comments will be appreciated.
|
||||
|
||||
|
||||
Toshi Isogai
|
||||
isogai@ucsub.colorado.edu
|
||||
|
||||
|
||||
May 11 '98
|
||||
@@ -1,51 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# FvwmCommand example - auto raise small windows
|
||||
# arg1 - size ( w * h in pixel) (default 60000)
|
||||
# arg2 - delay (second) (default 1)
|
||||
|
||||
open( FCM, "FvwmCommand -m -i3 send_windowlist |" ) || die "FCM";
|
||||
open( FCC, ">$ENV{'HOME'}/.FvwmCommandC" ) || die "FCC";
|
||||
|
||||
select( FCC ); $| = 1;
|
||||
select( STDOUT ); $| = 1;
|
||||
|
||||
|
||||
$Size = shift;
|
||||
if( $Size <= 0 ) {
|
||||
$Size = 60000;
|
||||
}
|
||||
|
||||
if( $#ARGV >= 0) {
|
||||
$Delay = shift;
|
||||
}else{
|
||||
$Delay = 1;
|
||||
}
|
||||
|
||||
|
||||
LOOP1:while( <FCM> ) {
|
||||
if( /^0x(\S+) frame .*width (\d+), height (\d+)/ ) {
|
||||
$Config{$1}{'area'} = $2 * $3;
|
||||
}elsif( /^0x(\S+) (focus change|end windowlist)/ ) {
|
||||
|
||||
if( $1 != 0 ) {
|
||||
# delay longer than FvwmAuto
|
||||
select(undef,undef,undef,$Delay);
|
||||
|
||||
foreach $w (keys %Config) {
|
||||
if( $Config{$w}{'area'} < $Size ) {
|
||||
print FCC "windowid 0x$w Raise\n";
|
||||
|
||||
# ignore
|
||||
while(<FCM>) {
|
||||
last if /^0x$w raise/;
|
||||
redo LOOP1 if /^0x\S+ focus change/;
|
||||
}
|
||||
select(undef,undef,undef,0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# FvwmCommand example - cascade windows
|
||||
|
||||
open( F, "FvwmCommand -ri2 send_windowlist |" ) || die "command" ;
|
||||
while( <F> ) {
|
||||
if( /^(0x[0-9a-f]+) frame *x (\d+), y (\d+), width (\d+), height (\d+)/ ) {
|
||||
$config{$1}{'area'} = $4 * $5;
|
||||
$config{$1}{'x'} = $2;
|
||||
$config{$1}{'y'} = $3;
|
||||
}elsif( /^(0x[0-9a-f]+) Sticky +(yes|no)$/ ) {
|
||||
$config{$1}{'sticky'} = $2;
|
||||
}elsif( /^(0x[0-9a-f]+) desktop +(\d+)/ ) {
|
||||
$config{$1}{'desktop'} = $2;
|
||||
}
|
||||
}
|
||||
close F;
|
||||
|
||||
|
||||
$x = $y = 0;
|
||||
|
||||
$delay = 3000; #need bigger number for slower machine
|
||||
|
||||
foreach $i (keys %config) {
|
||||
next if( $config{$i}{'sticky'} =~ /yes/ ) ;
|
||||
system("FvwmCommand -w $delay 'windowid $i windowsdesk 0' " );
|
||||
system("FvwmCommand -w 0 'windowid $i move ${x}p ${y}p' " );
|
||||
system("FvwmCommand -w 0 'windowid $i raise' " );
|
||||
$x += 50;
|
||||
$y += 50;
|
||||
}
|
||||
|
||||
print( 'hit return to move them back!' );
|
||||
<>;
|
||||
foreach $i (keys %config) {
|
||||
next if( $config{$i}{'sticky'} =~ /yes/ ) ;
|
||||
system("FvwmCommand -w 0 'windowid $i windowsdesk $config{$i}{desktop}'>/dev/null");
|
||||
system("FvwmCommand -w $delay 'gotopage 0 0' 'windowid $i move $config{$i}{x}p $config{$i}{y}p' >/dev/null" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# FvwmCommand example - move a group of windows
|
||||
|
||||
|
||||
ask();
|
||||
|
||||
|
||||
open( FCM, "FvwmCommand -m -i3 |" ) || die "$! FvwmCommand";
|
||||
open( FCC, ">$ENV{'HOME'}/.FvwmCommandC" ) || die "FCC";
|
||||
select( FCC ); $| = 1;
|
||||
select( STDOUT ); $| = 1;
|
||||
|
||||
while( <FCM> ) {
|
||||
if( /^0x(\S+) frame +x (\d+), y (\d+)/ ) {
|
||||
# check if a member window is moved
|
||||
($id,$x,$y) = ($1,$2,$3);
|
||||
|
||||
if( defined $Config{$id} ) {
|
||||
foreach $w (keys %Config) {
|
||||
$newx = $x + $Config{$w}{'x'}-$Config{$id}{'x'};
|
||||
$newy = $y + $Config{$w}{'y'}-$Config{$id}{'y'};
|
||||
if( $newx < 0 ) {
|
||||
$newx = 0;
|
||||
}
|
||||
if( $newy < 0 ) {
|
||||
$newy = 0;
|
||||
}
|
||||
print FCC "windowid 0x$w move ${newx}p ${newy}p\n";
|
||||
|
||||
# ignore - pixel info is the last info for move
|
||||
while(<FCM>) {
|
||||
last if /^0x$w pixel/;
|
||||
}
|
||||
select(undef,undef,undef,0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub ask {
|
||||
my($k,$c,$w, $mark);
|
||||
|
||||
# list up windows
|
||||
open( FCM, "FvwmCommand -i2 send_windowlist |" ) || die "$! FvwmCommand";
|
||||
while( <FCM> ) {
|
||||
if( /^0x(\S+) (id|window) +(.*)/ ) {
|
||||
$Config{$1}{$2} = $3;
|
||||
}elsif( /^0x(\S+) frame +x (\d+), y (\d+)/ ) {
|
||||
$Config{$1}{'x'} = $2;
|
||||
$Config{$1}{'y'} = $3;
|
||||
}
|
||||
}
|
||||
close( FCM );
|
||||
|
||||
$k = 'a';
|
||||
foreach $w (keys %Config) {
|
||||
$win{$k++} = $w;
|
||||
$Config{$w}{'grp'} = 0;
|
||||
}
|
||||
while(1) {
|
||||
print "\nWhich windwow to group (* for all, ENTER to Start)?\n";
|
||||
foreach $k (keys %win) {
|
||||
$mark = $Config{$win{$k}}{'grp'} ? 'X':' ';
|
||||
print "($k) ($mark) $Config{$win{$k}}{'window'}\n";
|
||||
}
|
||||
|
||||
system "stty -icanon min 1 time 0";
|
||||
$c = getc();
|
||||
system "stty icanon";
|
||||
|
||||
if( $c eq '*' ) {
|
||||
foreach(keys %win) {
|
||||
$Config{$_}{'grp'} = 1;
|
||||
}
|
||||
}elsif( $c eq "\n" ) {
|
||||
last;
|
||||
}elsif( !grep( /$c/,keys %win) ) {
|
||||
print "\aUndefine process\n";
|
||||
}else{
|
||||
$Config{$win{$c}}{'grp'} = ! $Config{$win{$c}}{'grp'};
|
||||
}
|
||||
}
|
||||
|
||||
print "Group move on effect\n";
|
||||
foreach $w (keys %Config) {
|
||||
delete $Config{$w} if $Config{$w}{'grp'}!=1;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Find fvwm commands from function.c struct functions
|
||||
# Written by Toshi Isogai
|
||||
|
||||
ff="FvwmCommand.sh";
|
||||
fc="../../fvwm/functions.c";
|
||||
|
||||
|
||||
echo "# $ff" > $ff;
|
||||
echo "# Collection of fvwm2 builtin commands for FvwmCommand" >> $ff
|
||||
echo "" >> $ff;
|
||||
|
||||
echo "alias FvwmCommand='$1/FvwmCommand'" >> $ff;
|
||||
echo 'AM () { ' >> $ff
|
||||
echo 'FvwmCommand "+ $*"' >> $ff
|
||||
echo '}' >> $ff;
|
||||
|
||||
|
||||
awk 'OFS="";
|
||||
/struct function/,/""/ {
|
||||
|
||||
if( $0 ~ /\{ *"[a-zA-Z_]/ ) {
|
||||
sub(/^ *\{ *"/,"",$0);
|
||||
sub(/".*/,"",$0);
|
||||
print $0," () {"
|
||||
print "FvwmCommand \"",$0," $*\""
|
||||
print "}" ;
|
||||
}
|
||||
}' $fc >> $ff;
|
||||
|
||||
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# Find fvwm commands from function.c struct functions
|
||||
# Written by Toshi Isogai
|
||||
|
||||
sub getcmd {
|
||||
$/ = "\n\n";
|
||||
while(<FF>) {
|
||||
#find "struct functions func_config[] =" in various spacing
|
||||
if (s/struct\s+functions.*\[\]\s+=(\s|\n)+\{// ) {
|
||||
return listcmd();
|
||||
}
|
||||
}
|
||||
print stderr "Can't find struct functions\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
sub listcmd {
|
||||
my($cmd,@cmd);
|
||||
while( /"(.*)"/g ) {
|
||||
$cmd = $1;
|
||||
next if $cmd =~ /^\+?$/;
|
||||
push @cmd, $cmd;
|
||||
}
|
||||
@cmd;
|
||||
}
|
||||
|
||||
sub create_pm {
|
||||
my(@cmd,$i,@ln);
|
||||
my( $fvwmdir ) = $ARGV[0];
|
||||
my( $fc);
|
||||
my( $pm ) = "FvwmCommand.pm";
|
||||
|
||||
$fc = "../../fvwm/functions.c";
|
||||
|
||||
open(FF, $fc) || die "$fc $!";
|
||||
@cmd = getcmd();
|
||||
close(FF);
|
||||
open(FPL,">$pm") || die "$pm: $!";
|
||||
|
||||
print FPL "# $pm\n";
|
||||
print FPL "# Collection of fvwm2 builtin commands for FvwmCommand\n";
|
||||
print FPL "package FvwmCommand;\nuse Exporter;\n";
|
||||
print FPL "\@ISA=qw(Exporter);\n\@EXPORT=qw(";
|
||||
for( $i=0; $i<=$#cmd; $i++) {
|
||||
if( $i % 5 == 0 ) {
|
||||
print FPL "\n $cmd[$i]";
|
||||
}else{
|
||||
print FPL " $cmd[$i]";
|
||||
}
|
||||
}
|
||||
print FPL "\n);\n";
|
||||
print FPL "\nsub FvwmCommand { system \"$fvwmdir/FvwmCommand '\@_'\"}\n\n";
|
||||
foreach $i (@cmd) {
|
||||
print FPL "sub $i { FvwmCommand \"$i \@_ \" }\n";
|
||||
}
|
||||
print FPL "sub AM { FvwmCommand \"+ \@_ \" }\n";
|
||||
print FPL "1;\n";
|
||||
print "$pm created\n";
|
||||
}
|
||||
|
||||
create_pm();
|
||||
@@ -1,89 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# FvwmCommand script
|
||||
# Written by Toshi Isogai
|
||||
#
|
||||
# 1. auto focus Netscape dialog when opened
|
||||
# 2. move download/upload window to right edge of the screen
|
||||
|
||||
# screen width
|
||||
if( `xwininfo -root` =~ /Width: (\d+)/ ) {
|
||||
$SW = $1;
|
||||
}else{
|
||||
# some resonable number if xwininfo doesn't work
|
||||
$SW = 1024;
|
||||
}
|
||||
|
||||
# start a dedicated server
|
||||
$fifo = "$ENV{'HOME'}/.FCMfocus";
|
||||
system( "FvwmCommand 'FvwmCommandS $fifo'");
|
||||
#for slow machine
|
||||
select(undef,undef,undef,1);
|
||||
|
||||
# we need this to run this script in background job
|
||||
$SIG{'TTIN'} = "IGNORE";
|
||||
|
||||
# start monitoring (-m option ) all fvwm transaction (-i3 option )
|
||||
open( FCM, "FvwmCommand -f $fifo -m -i3 |" ) || die "FCM $fifo";
|
||||
|
||||
# send command through the new fifo which is "$fifo" + "C"
|
||||
open( FCC, ">${fifo}C" ) || die "FCC $fifo" ;
|
||||
|
||||
# appearantly, it has be unbuffered
|
||||
select( FCC ); $| = 1;
|
||||
select( STDOUT ); $| = 1;
|
||||
|
||||
|
||||
LOOP1: while( <FCM> ) {
|
||||
if( /^(0x[\da-f]+) add/ ) {
|
||||
$id = $1;
|
||||
|
||||
while( <FCM> ) {
|
||||
|
||||
# keep window frame
|
||||
if( /^$id frame\s+x -?\d+, y (-?\d+), width (\d+)/ ) {
|
||||
$y = $1;
|
||||
$width = $2;
|
||||
|
||||
# search for class line
|
||||
}elsif( /^$id class/ ) {
|
||||
|
||||
if( !/\sNetscape/ ) {
|
||||
# not Netscape
|
||||
last;
|
||||
}
|
||||
|
||||
# the next line should be resource line
|
||||
$_ = <FCM>;
|
||||
|
||||
# resource line tells what the window is
|
||||
if( /^$id resource/ ) {
|
||||
|
||||
# search for Netscape popups
|
||||
if( /\s+\w+popup/ ) {
|
||||
|
||||
# fvwm doesn't like commands from modules too fast
|
||||
select(undef,undef,undef, 0.4 );
|
||||
|
||||
# focus it
|
||||
print FCC "windowid $id focus\n";
|
||||
|
||||
}
|
||||
# search for Netscape download or upload window
|
||||
elsif( /\s+(Down|Up)load/ ) {
|
||||
select(undef,undef,undef, 0.4 );
|
||||
|
||||
# move to the right edge, keep the whole window in screen
|
||||
$x = $SW - $width;
|
||||
print FCC "windowid $id move ${x}p ${y}p\n";
|
||||
}
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print "end\n";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,188 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# FvwmCommand script
|
||||
# Written by Toshi Isogai
|
||||
#
|
||||
# push-away
|
||||
# push other windows back when they overlap
|
||||
# usage: push-away <direction> <window name>
|
||||
# direction - direction (down,up,left,right) to push away
|
||||
# window name - windows to be protected, name can be regular expression
|
||||
# icons are ignored
|
||||
|
||||
|
||||
$Dir = shift;
|
||||
$Wn = shift;
|
||||
|
||||
if( $Dir =~ /down/i ) {
|
||||
$Dir = 1;
|
||||
}elsif( $Dir =~ /up/i ) {
|
||||
$Dir = 2;
|
||||
}elsif( $Dir =~ /left/i ) {
|
||||
$Dir = 3;
|
||||
}elsif( $Dir =~ /right/i ) {
|
||||
$Dir = 4;
|
||||
}
|
||||
|
||||
if( $Dir == 0 || $Wn eq '' ) {
|
||||
print STDERR "push other windows back when they overlap\n";
|
||||
print STDERR "usage: push-away <direction> <window name>\n";
|
||||
print STDERR " direction - direction (down,up,left,right) to push away\n";
|
||||
print STDERR " window name - windows to be protected\n";
|
||||
print STDERR " name can be regular expression\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
# start a dedicated server
|
||||
$fifo = "$ENV{'HOME'}/.FCMpb";
|
||||
system( "FvwmCommand 'FvwmCommandS $fifo'");
|
||||
|
||||
# larger number for slow machine
|
||||
select(undef,undef,undef,0.5);
|
||||
|
||||
# we need this to run this script in background job
|
||||
$SIG{'TTIN'} = "IGNORE";
|
||||
|
||||
# start monitoring (-m option ) all fvwm transaction (-i3 option )
|
||||
open( FCM, "FvwmCommand -f $fifo -m -i3 |" ) || die "FCM $fifo";
|
||||
|
||||
# send command through the new fifo which is "$fifo" + "C"
|
||||
open( FCC, ">${fifo}C" ) || die "FCC $fifo" ;
|
||||
|
||||
# non blocking outputs
|
||||
select( FCC ); $| = 1;
|
||||
select( STDOUT ); $| = 1;
|
||||
|
||||
|
||||
# some delay for slow one
|
||||
select(undef,undef,undef,0.1);
|
||||
print FCC "send_windowlist\n";
|
||||
# yet some more delay for slow one
|
||||
select(undef,undef,undef,0.1);
|
||||
|
||||
$endlist = 0;
|
||||
while( <FCM> ) {
|
||||
|
||||
if( /^(0x\S+) frame\s+x (-?\d+), y (-?\d+), width (\d+), height (\d+)/ ) {
|
||||
$id = $1;
|
||||
$Config{$id}{'x'} = $2;
|
||||
$Config{$id}{'y'} = $3;
|
||||
$Config{$id}{'w'} = $4;
|
||||
$Config{$id}{'h'} = $5;
|
||||
|
||||
next if ! $endlist ;
|
||||
|
||||
# move other windows if necessary
|
||||
if( $Config{$id}{'protect'} ) {
|
||||
foreach $w (keys %Config) {
|
||||
if( $id ne $w ) {
|
||||
move_if_overlap( $w, $id );
|
||||
}
|
||||
}
|
||||
}else{
|
||||
foreach $w (keys %Config) {
|
||||
if( $Config{$w}{'protect'} ) {
|
||||
move_if_overlap( $id, $w );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}elsif( /^(0x\S+) desktop +(-?\d+)/ ) {
|
||||
$Config{$1}{'desk'} = $2;
|
||||
|
||||
}elsif( /^(0x\S+) Iconified +(yes|no)/ ) {
|
||||
$Config{$1}{'Iconified'} = $2;
|
||||
|
||||
}elsif( /^(0x\S+) window +(.*)/ ) {
|
||||
$id = $1;
|
||||
$window = $2;
|
||||
|
||||
if( $window =~ /$Wn/ ) {
|
||||
$Config{$id}{'protect'} = 1;
|
||||
}
|
||||
|
||||
}elsif( /end windowlist/ ) {
|
||||
$endlist = 1;
|
||||
foreach $id (keys %Config) {
|
||||
if( $Config{$id}{'protect'} ) {
|
||||
foreach $w (keys %Config) {
|
||||
if( $id ne $w ) {
|
||||
move_if_overlap( $w, $id );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}elsif( /^(0x\S+) destroy/ ) {
|
||||
delete $Config{$1};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub move_if_overlap {
|
||||
my($id1, $id2) = @_;
|
||||
my($ov);
|
||||
my($c1xl,$c1xh,$c1yl,$c1yh);
|
||||
my($c2xl,$c2xh,$c2yl,$c2yh);
|
||||
|
||||
|
||||
|
||||
if( $Config{$id1}{'desk'} != $Config{$id2}{'desk'}
|
||||
|| $Config{$id1}{'Iconified'} eq 'yes'
|
||||
|| $Config{$id2}{'Iconified'} eq 'yes' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$ov = 0;
|
||||
|
||||
$c1xl = $Config{$id1}{'x'};
|
||||
$c1yl = $Config{$id1}{'y'};
|
||||
$c1xh = $Config{$id1}{'x'}+$Config{$id1}{'w'};
|
||||
$c1yh = $Config{$id1}{'y'}+$Config{$id1}{'h'};
|
||||
|
||||
$c2xl = $Config{$id2}{'x'};
|
||||
$c2yl = $Config{$id2}{'y'};
|
||||
$c2xh = $Config{$id2}{'x'}+$Config{$id2}{'w'};
|
||||
$c2yh = $Config{$id2}{'y'}+$Config{$id2}{'h'};
|
||||
|
||||
|
||||
if( $c2xl >= $c1xl && $c2xl <= $c1xh
|
||||
|| $c2xh >= $c1xl && $c2xh <= $c1xh ) {
|
||||
if($c2yl >= $c1yl && $c2yl <= $c1yh
|
||||
|| $c2yh >= $c1yl && $c2yh <= $c1yh ) {
|
||||
$ov = 1;
|
||||
}
|
||||
}elsif( $c1xl >= $c2xl && $c1xl <= $c2xh
|
||||
|| $c1xh >= $c2xl && $c1xh <= $c2xh ) {
|
||||
if($c1yl >= $c2yl && $c1yl <= $c2yh
|
||||
|| $c1yh >= $c2yl && $c1yh <= $c2yh ) {
|
||||
$ov = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if( $ov ) {
|
||||
$x = $c1xl;
|
||||
$y = $c1yl;
|
||||
if( $Dir==1 ) {
|
||||
$y = $c2yh+1;
|
||||
}elsif( $Dir==2 ) {
|
||||
$y = $c2yl-($c1yh-$c1yl)-1;
|
||||
}elsif( $Dir==3 ) {
|
||||
$x = $c2xl-($c1xh-$c1xl)-1;
|
||||
}elsif( $Dir==4 ) {
|
||||
$x = $c2xh+1;
|
||||
}
|
||||
|
||||
|
||||
print FCC "windowid $id1 move ${x}p ${y}p\n";
|
||||
|
||||
# ignore - pixel info is the last info for move
|
||||
while(<FCM>) {
|
||||
last if /^0x\S+ pixel/;
|
||||
}
|
||||
|
||||
select(undef,undef,undef,0.1);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# arg1 t to invoke FvwmTalk
|
||||
# td to kill FvwmTalk
|
||||
# none to move windows
|
||||
|
||||
use FvwmCommand;
|
||||
|
||||
|
||||
if( $ARGV[0] eq 't' ) {
|
||||
Desk ( 0,1);
|
||||
GotoPage (1, 1);
|
||||
Module (FvwmTalk);
|
||||
}elsif( $ARGV[0] eq 'td' ) {
|
||||
KillModule (FvwmTalk);
|
||||
}else {
|
||||
Move ;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/bin/sh
|
||||
# FvwmCommand test
|
||||
# arg1 b to invoke FvwmButtons
|
||||
# kb to kill FvwmButtons
|
||||
# r to change button rows
|
||||
# c to change button columns
|
||||
|
||||
. ./FvwmCommand.sh
|
||||
|
||||
if [ "$1" = 'b' ] ; then
|
||||
Module FvwmButtons;
|
||||
elif [ "$1" = 'kb' ] ; then
|
||||
KillModule FvwmButtons;
|
||||
elif [ "$1" = 'r' ] ; then
|
||||
n=$2
|
||||
DestroyModuleConfig '*FvwmButtonsRows'
|
||||
AddModuleConfig "*FvwmButtonsRows $n"
|
||||
elif [ "$1" = 'c' ] ; then
|
||||
n=$2
|
||||
DestroyModuleConfig '*FvwmButtonsColumns'
|
||||
AddModuleConfig "*FvwmButtonsColumns $n"
|
||||
else
|
||||
echo " arg1 b to invoke FvwmButtons"
|
||||
echo " kb to kill FvwmButtons"
|
||||
ehco " r to change button rows"
|
||||
echo " c to change button columns"
|
||||
|
||||
fi
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
.\" t
|
||||
.\" @(#)FvwmConfig.1 1/12/94
|
||||
.TH FvwmConfig 1.20 "Mar 16 1994"
|
||||
.UC
|
||||
.SH NAME
|
||||
FvwmConfig \- the FVWM Configuration Aid (Braindead)
|
||||
.SH SYNOPSIS
|
||||
FvwmConfig is spawned by fvwm, so no command line invocation will work.
|
||||
From within the .fvwmrc file, FvwmConfig is spawned as follows:
|
||||
.nf
|
||||
.sp
|
||||
Module FvwmConfig
|
||||
.sp
|
||||
.fi
|
||||
or from within an fvwm pop-up menu:
|
||||
.nf
|
||||
.sp
|
||||
AddToMenu Module-Popup "Modules" Title
|
||||
+ "Configure" Module FvwmConfig
|
||||
+ "FvwmIdentify" Module FvwmIdent
|
||||
+ "Banner" Module FvwmBanner
|
||||
+ "SaveDesktop" Module FvwmSave
|
||||
.sp
|
||||
.fi
|
||||
|
||||
.SH DESCRIPTION
|
||||
The FvwmConfig helps users make very simple, basic changes to the
|
||||
current fvwm configuration.
|
||||
|
||||
In order for FvwmConfig to make changes which will take effect for
|
||||
future X sessions, the user's or system's .fvwmrc file must
|
||||
end with the line "Read .fvwmrc-config". FvwmConfig will write its
|
||||
configuration out to the file $HOME/.fvwmrc-config, thus minimizing
|
||||
conflicts with other portions of the user's configuration.
|
||||
|
||||
Since FvwmConfig is used to edit the user's configuration, it doesn't
|
||||
make much sense for it to be very configurable itself. There are no
|
||||
user-specifiable configuration options for FvwmConfig.
|
||||
|
||||
Use of this module is discouraged, since the options it allows are
|
||||
far less in variety than fvwm itself can allow.
|
||||
|
||||
FvwmConfig will not work as intended if ANY styles other than the
|
||||
default styles are applied to it.
|
||||
|
||||
.SH COPYRIGHTS
|
||||
The FvwmConfig program, and the concept for interfacing this module to
|
||||
the Window Manager, are all original work by Robert Nation.
|
||||
|
||||
Copyright 1994, Robert Nation. No guarantees or warranties or anything
|
||||
are provided or implied in any way whatsoever. Use this program at your
|
||||
own risk. Permission to use this program for any purpose is given,
|
||||
as long as the copyright is kept intact.
|
||||
|
||||
|
||||
.SH AUTHOR
|
||||
Robert Nation
|
||||
|
||||
@@ -1,574 +0,0 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "WinBase.h"
|
||||
#include "WinButton.h"
|
||||
#include "WinButton.h"
|
||||
#include "WinInput.h"
|
||||
#include "WinColorSelector.h"
|
||||
|
||||
extern "C" {
|
||||
#include "fvwmlib.h"
|
||||
}
|
||||
#include "../../fvwm/module.h"
|
||||
|
||||
#define ClickToFocus (1<<10)
|
||||
#define SloppyFocus (1<<11)
|
||||
int fd[2];
|
||||
char *MyName;
|
||||
|
||||
extern "C" void SetupPipeHandler(void);
|
||||
|
||||
|
||||
WinInput *inwin;
|
||||
WinButton * cfocus, *cmouse,*fmouse, *fclick, *fsloppy, *nescroll, *escroll;
|
||||
WinColorSelector *hibackselwin, *hiforeselwin, *backselwin, *foreselwin;
|
||||
WinBase *base;
|
||||
Window pwin;
|
||||
|
||||
void finish(WinBase *which)
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void abortaction(int newstate, WinButton *which)
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
char tmp[2000];
|
||||
int focus = -1;
|
||||
int colormap = -1;
|
||||
int edgescroll = -1;
|
||||
float back_red = -1;
|
||||
float back_green = -1;
|
||||
float back_blue = -1;
|
||||
float fore_red = -1;
|
||||
float fore_green = -1;
|
||||
float fore_blue = -1;
|
||||
|
||||
float hi_back_red = -1;
|
||||
float hi_back_green = -1;
|
||||
float hi_back_blue = -1;
|
||||
float hi_fore_red = -1;
|
||||
float hi_fore_green = -1;
|
||||
float hi_fore_blue = -1;
|
||||
int size_read = -1;
|
||||
|
||||
|
||||
void testaction(int newstate, WinButton *which)
|
||||
{
|
||||
int i;
|
||||
char *t;
|
||||
|
||||
if(focus == 1)
|
||||
SendInfo(fd,"Style \"*\" ClickToFocus\n",0);
|
||||
else if(focus == 0)
|
||||
SendInfo(fd,"Style \"*\" MouseFocus\n",0);
|
||||
else if(focus == 2)
|
||||
SendInfo(fd,"Style \"*\" SloppyFocus\n",0);
|
||||
|
||||
if(colormap == 1)
|
||||
SendInfo(fd,"ColormapFocus FollowsFocus",0);
|
||||
else if (colormap == 0)
|
||||
SendInfo(fd,"ColormapFocus FollowsMouse",0);
|
||||
|
||||
t = inwin->GetLine();
|
||||
if(strlen(inwin->GetLine()) > 2)
|
||||
{
|
||||
if(sscanf(t,"%dx%d", &i, &i) == 2)
|
||||
{
|
||||
sprintf(tmp,"DeskTopSize %s\n",t);
|
||||
SendInfo(fd,tmp,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
inwin->SetLabel("");
|
||||
inwin->RedrawWindow(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
inwin->SetLabel("");
|
||||
inwin->RedrawWindow(1);
|
||||
}
|
||||
|
||||
if(fore_red >= 0)
|
||||
{
|
||||
sprintf(tmp,"Style \"*\" ForeColor #%04x%04x%04x",(int)fore_red,
|
||||
(int)fore_green, (int)fore_blue);
|
||||
SendInfo(fd,tmp,0);
|
||||
}
|
||||
if(back_red >= 0)
|
||||
{
|
||||
sprintf(tmp,"Style \"*\" BackColor #%04x%04x%04x",(int)back_red,
|
||||
(int)back_green, (int)back_blue);
|
||||
SendInfo(fd,tmp,0);
|
||||
}
|
||||
|
||||
if((hi_fore_red >= 0)||(hi_back_red >= 0))
|
||||
{
|
||||
sprintf(tmp,"HilightColor #%04x%04x%04x #%04x%04x%04x",(int)hi_fore_red,
|
||||
(int)hi_fore_green, (int)hi_fore_blue,(int)hi_back_red,
|
||||
(int)hi_back_green, (int)hi_back_blue);
|
||||
SendInfo(fd,tmp,0);
|
||||
}
|
||||
if(edgescroll == 1)
|
||||
SendInfo(fd,"EdgeScroll 100 100",0);
|
||||
else if (edgescroll == 0)
|
||||
SendInfo(fd,"EdgeScroll 0 0",0);
|
||||
|
||||
if((focus == 1)||(focus == 0)||(fore_red >= 0)||(back_red >=0))
|
||||
SendInfo(fd,"Recapture",0);
|
||||
}
|
||||
|
||||
void commitaction(int newstate, WinButton *which)
|
||||
{
|
||||
char fname[2000];
|
||||
char *homedir;
|
||||
FILE *nfd;
|
||||
char *t;
|
||||
int i;
|
||||
|
||||
testaction(newstate, which);
|
||||
homedir = getenv("HOME");
|
||||
if(homedir == NULL)
|
||||
fname[0] = 0;
|
||||
else
|
||||
strcpy(fname,homedir);
|
||||
strcat(fname,"/.fvwmrc-config");
|
||||
|
||||
nfd = fopen(fname,"w");
|
||||
if(nfd)
|
||||
{
|
||||
if(focus == 1)
|
||||
fprintf(nfd,"Style \"*\" ClickToFocus\n");
|
||||
else if(focus == 0)
|
||||
fprintf(nfd,"Style \"*\" MouseFocus\n");
|
||||
else if(focus == 2)
|
||||
fprintf(nfd,"Style \"*\" SloppyFocus\n");
|
||||
|
||||
if(colormap == 1)
|
||||
fprintf(nfd,"ColormapFocus FollowsFocus\n");
|
||||
else if (colormap == 0)
|
||||
fprintf(nfd,"ColormapFocus FollowsMouse\n");
|
||||
|
||||
t = inwin->GetLine();
|
||||
if(strlen(inwin->GetLine()) > 2)
|
||||
{
|
||||
if(sscanf(t,"%dx%d", &i, &i) == 2)
|
||||
fprintf(nfd,"DeskTopSize %s\n",inwin->GetLine());
|
||||
}
|
||||
|
||||
if(edgescroll == 1)
|
||||
fprintf(nfd,"EdgeScroll 100 100\n");
|
||||
else if (edgescroll == 0)
|
||||
fprintf(nfd,"EdgeScroll 0 0\n");
|
||||
if(fore_red >= 0)
|
||||
{
|
||||
fprintf(nfd,"Style \"*\" ForeColor #%04x%04x%04x\n",(int)fore_red,
|
||||
(int)fore_green, (int)fore_blue);
|
||||
}
|
||||
if(back_red >= 0)
|
||||
{
|
||||
fprintf(nfd,"Style \"*\" BackColor #%04x%04x%04x\n",(int)back_red,
|
||||
(int)back_green, (int)back_blue);
|
||||
}
|
||||
if((hi_fore_red >= 0)||(hi_back_red >= 0))
|
||||
{
|
||||
fprintf(nfd,"HilightColor #%04x%04x%04x #%04x%04x%04x\n",
|
||||
(int)hi_fore_red,(int)hi_fore_green, (int)hi_fore_blue,
|
||||
(int)hi_back_red, (int)hi_back_green, (int)hi_back_blue);
|
||||
}
|
||||
fclose(nfd);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void backcolorhandler(float red, float green, float blue,
|
||||
WinColorSelector *which)
|
||||
{
|
||||
back_red = red;
|
||||
back_green = green;
|
||||
back_blue = blue;
|
||||
}
|
||||
|
||||
void forecolorhandler(float red, float green, float blue,
|
||||
WinColorSelector *which)
|
||||
{
|
||||
fore_red = red;
|
||||
fore_green = green;
|
||||
fore_blue = blue;
|
||||
}
|
||||
|
||||
void hibackcolorhandler(float red, float green, float blue,
|
||||
WinColorSelector *which)
|
||||
{
|
||||
hi_back_red = red;
|
||||
hi_back_green = green;
|
||||
hi_back_blue = blue;
|
||||
}
|
||||
|
||||
void hiforecolorhandler(float red, float green, float blue,
|
||||
WinColorSelector *which)
|
||||
{
|
||||
hi_fore_red = red;
|
||||
hi_fore_green = green;
|
||||
hi_fore_blue = blue;
|
||||
}
|
||||
|
||||
void colormapmouseaction(int newstate, WinButton *which)
|
||||
{
|
||||
if(newstate == 1)
|
||||
{
|
||||
if(colormap == 0)
|
||||
colormap = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cfocus->PopOut();
|
||||
colormap = 0;
|
||||
cfocus->RedrawWindow(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Scrollaction(int newstate, WinButton *which)
|
||||
{
|
||||
if(newstate == 1)
|
||||
{
|
||||
if(edgescroll == 1)
|
||||
edgescroll = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
nescroll->PopOut();
|
||||
edgescroll = 1;
|
||||
nescroll->RedrawWindow(0);
|
||||
}
|
||||
}
|
||||
void Noscrollaction(int newstate, WinButton *which)
|
||||
{
|
||||
if(newstate == 1)
|
||||
{
|
||||
if(edgescroll == 0)
|
||||
edgescroll= -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
escroll->PopOut();
|
||||
edgescroll = 0;
|
||||
escroll->RedrawWindow(0);
|
||||
}
|
||||
}
|
||||
void colormapfocusaction(int newstate, WinButton *which)
|
||||
{
|
||||
if(newstate == 1)
|
||||
{
|
||||
if(colormap==1)
|
||||
colormap = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmouse->PopOut();
|
||||
colormap = 1;
|
||||
cmouse->RedrawWindow(0);
|
||||
}
|
||||
}
|
||||
|
||||
void focusmouseaction(int newstate, WinButton *which)
|
||||
{
|
||||
if(newstate == 1)
|
||||
{
|
||||
if(focus == 0)
|
||||
focus = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
fclick->PopOut();
|
||||
focus = 0;
|
||||
fclick->RedrawWindow(0);
|
||||
fsloppy->PopOut();
|
||||
fsloppy->RedrawWindow(0);
|
||||
}
|
||||
}
|
||||
void focusclickaction(int newstate, WinButton *which)
|
||||
{
|
||||
if(newstate == 1)
|
||||
{
|
||||
if(focus == 1)
|
||||
focus = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
fmouse->PopOut();
|
||||
focus = 1;
|
||||
fmouse->RedrawWindow(0);
|
||||
fsloppy->PopOut();
|
||||
fsloppy->RedrawWindow(0);
|
||||
}
|
||||
}
|
||||
void focussloppyaction(int newstate, WinButton *which)
|
||||
{
|
||||
if(newstate == 1)
|
||||
{
|
||||
if(focus == 2)
|
||||
focus = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
focus = 2;
|
||||
fmouse->PopOut();
|
||||
fmouse->RedrawWindow(0);
|
||||
fclick->PopOut();
|
||||
fclick->RedrawWindow(0);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadPacket(int fd)
|
||||
{
|
||||
unsigned long header[HEADER_SIZE];
|
||||
unsigned long *body;
|
||||
Pixel hipixel, hibackpixel;
|
||||
XColor colorcell;
|
||||
int n;
|
||||
|
||||
ReadFvwmPacket(fd, header, &body);
|
||||
|
||||
if(header[1] == M_FOCUS_CHANGE)
|
||||
{
|
||||
if(hi_fore_red < 0)
|
||||
{
|
||||
hipixel = body[3];
|
||||
hibackpixel = body[4];
|
||||
colorcell.pixel = hipixel;
|
||||
n = XQueryColor(hiforeselwin->dpy,
|
||||
DefaultColormap(hiforeselwin->dpy,
|
||||
hiforeselwin->Screen),
|
||||
&colorcell);
|
||||
hi_fore_red = colorcell.red & 0xffff;
|
||||
hi_fore_green = colorcell.green & 0xffff;
|
||||
hi_fore_blue = colorcell.blue & 0xffff;
|
||||
hiforeselwin->SetCurrentValue(hi_fore_red, hi_fore_green, hi_fore_blue);
|
||||
colorcell.pixel = hibackpixel;
|
||||
XQueryColor(hibackselwin->dpy,
|
||||
DefaultColormap(hiforeselwin->dpy,
|
||||
hiforeselwin->Screen),
|
||||
&colorcell);
|
||||
hi_back_red = colorcell.red & 0xffff;
|
||||
hi_back_green = colorcell.green & 0xffff;
|
||||
hi_back_blue = colorcell.blue & 0xffff;
|
||||
hibackselwin->SetCurrentValue(hi_back_red, hi_back_green, hi_back_blue);
|
||||
}
|
||||
}
|
||||
else if((header[1] == M_CONFIGURE_WINDOW)&&(body[0] == pwin))
|
||||
{
|
||||
if(fore_red < 0)
|
||||
{
|
||||
hipixel = body[22];
|
||||
hibackpixel = body[23];
|
||||
colorcell.pixel = hipixel;
|
||||
XQueryColor(foreselwin->dpy,
|
||||
DefaultColormap(hiforeselwin->dpy,
|
||||
hiforeselwin->Screen),
|
||||
&colorcell);
|
||||
fore_red = colorcell.red & 0xffff;
|
||||
fore_green = colorcell.green & 0xffff;
|
||||
fore_blue = colorcell.blue & 0xffff;
|
||||
foreselwin->SetCurrentValue(fore_red, fore_green, fore_blue);
|
||||
colorcell.pixel = hibackpixel;
|
||||
XQueryColor(backselwin->dpy,
|
||||
DefaultColormap(hiforeselwin->dpy,
|
||||
hiforeselwin->Screen),
|
||||
&colorcell);
|
||||
back_red = colorcell.red & 0xffff;
|
||||
back_green = colorcell.green & 0xffff;
|
||||
back_blue = colorcell.blue & 0xffff;
|
||||
backselwin->SetCurrentValue(back_red, back_green, back_blue);
|
||||
if(body[8] & ClickToFocus)
|
||||
focus = 1;
|
||||
if(body[8] & SloppyFocus)
|
||||
focus = 2;
|
||||
if(focus == 1)
|
||||
{
|
||||
fclick->PushIn();
|
||||
fclick->RedrawWindow(0);
|
||||
fmouse->PopOut();
|
||||
fmouse->RedrawWindow(0);
|
||||
fsloppy->PopOut();
|
||||
fsloppy->RedrawWindow(0);
|
||||
}
|
||||
else if (focus == 2)
|
||||
{
|
||||
fclick->PopOut();
|
||||
fclick->RedrawWindow(0);
|
||||
fmouse->PopOut();
|
||||
fmouse->RedrawWindow(0);
|
||||
fsloppy->PushIn();
|
||||
fsloppy->RedrawWindow(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
fclick->PopOut();
|
||||
fclick->RedrawWindow(0);
|
||||
fmouse->PushIn();
|
||||
fmouse->RedrawWindow(0);
|
||||
fsloppy->PopOut();
|
||||
fsloppy->RedrawWindow(0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if(header[1] == M_NEW_PAGE)
|
||||
{
|
||||
char size[100];
|
||||
int vxmax, vymax, sx,sy,nx,ny;
|
||||
|
||||
if(size_read < 0)
|
||||
{
|
||||
vxmax = body[3];
|
||||
vymax = body[4];
|
||||
sx = base->ScreenWidth();
|
||||
sy = base->ScreenHeight();
|
||||
nx = vxmax/sx + 1;
|
||||
ny = vymax/sy + 1;
|
||||
sprintf(size,"%dx%d",nx,ny);
|
||||
inwin->SetLabel(size);
|
||||
size_read = 1;
|
||||
}
|
||||
}
|
||||
free((char *)body);
|
||||
}
|
||||
|
||||
#define WINDOW_HEIGHT 400
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *temp, *s;
|
||||
|
||||
/* Save our program name - for error messages */
|
||||
temp = argv[0];
|
||||
s=strrchr(argv[0], '/');
|
||||
if (s != NULL)
|
||||
temp = s + 1;
|
||||
|
||||
MyName = safemalloc(strlen(temp)+2);
|
||||
strcpy(MyName, temp);
|
||||
|
||||
if(argc < 6)
|
||||
{
|
||||
fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",MyName,
|
||||
VERSION);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Dead pipe == Fvwm died */
|
||||
SetupPipeHandler();
|
||||
fd[0] = atoi(argv[1]);
|
||||
fd[1] = atoi(argv[2]);
|
||||
|
||||
WinInitialize(argv,argc);
|
||||
WinAddInput(fd[1],ReadPacket);
|
||||
SendInfo(fd,"Send_WindowList",0);
|
||||
WinBase a(NULL,300,WINDOW_HEIGHT,0,0);
|
||||
pwin = a.win;
|
||||
base = &a;
|
||||
a.SetWindowName("Braindead Fvwm Configuration Editor");
|
||||
a.SetIconName("Braindead");
|
||||
a.SetBevelWidth(3);
|
||||
a.SetGeometry((a.ScreenWidth() - 200)/2,(a.ScreenHeight()-200)/2,
|
||||
300,WINDOW_HEIGHT,
|
||||
1,1,500,500,1,1,1,1,CenterGravity);
|
||||
|
||||
WinText keyboard(&a,280,20,10,6,"Keyboard Focus");
|
||||
keyboard.SetBevelWidth(0);
|
||||
WinButton focusclick(&a,90,20,15,32,"Click");
|
||||
WinButton focusmouse(&a,90,20,105,32,"Follows Mouse");
|
||||
WinButton focussloppy(&a,90,20,195,32,"Trails Mouse");
|
||||
focusmouse.SetToggleAction(focusmouseaction);
|
||||
focusclick.SetToggleAction(focusclickaction);
|
||||
focussloppy.SetToggleAction(focussloppyaction);
|
||||
|
||||
WinBase divider1(&a,290,4,5,58);
|
||||
divider1.SetBevelWidth(2);
|
||||
WinText colormap(&a,280,20,10,62,"Colormap Focus");
|
||||
colormap.SetBevelWidth(0);
|
||||
WinButton colormapfocus(&a,100,20,50,88,"Follows Focus");
|
||||
WinButton colormapmouse(&a,100,20,150,88,"Follows Mouse");
|
||||
colormapmouse.SetToggleAction(colormapmouseaction);
|
||||
colormapfocus.SetToggleAction(colormapfocusaction);
|
||||
|
||||
WinBase divider2(&a,290,4,5,114);
|
||||
divider2.SetBevelWidth(2);
|
||||
WinText desktop(&a,280,20,10,120,"Desktop");
|
||||
desktop.SetBevelWidth(0);
|
||||
WinText desktopsize(&a,30,20,20,144,"Size");
|
||||
desktopsize.SetBevelWidth(0);
|
||||
WinInput deskinput(&a,40,20,50,144,NULL);
|
||||
deskinput.SetBevelWidth(2);
|
||||
|
||||
WinButton EdgeScroll(&a,80,20,110,144,"Edge Scroll");
|
||||
WinButton NoEdgeScroll(&a,100,20,190,144,"No Edge Scroll");
|
||||
EdgeScroll.SetToggleAction(Scrollaction);
|
||||
NoEdgeScroll.SetToggleAction(Noscrollaction);
|
||||
|
||||
WinBase divider3(&a,290,4,5,170);
|
||||
divider3.SetBevelWidth(2);
|
||||
WinText backcolorlabel(&a,140,20,5,176,"Default Back Color");
|
||||
WinText forecolorlabel(&a,140,20,155,176,"Default Fore Color");
|
||||
WinColorSelector defaultbackcolor(&a,140,70,5,196);
|
||||
WinColorSelector defaultforecolor(&a,140,70,155,196);
|
||||
backselwin = &defaultbackcolor;
|
||||
foreselwin = &defaultforecolor;
|
||||
defaultbackcolor.SetBevelWidth(0);
|
||||
defaultforecolor.SetBevelWidth(0);
|
||||
backcolorlabel.SetBevelWidth(0);
|
||||
forecolorlabel.SetBevelWidth(0);
|
||||
defaultbackcolor.SetMotionAction(backcolorhandler);
|
||||
defaultforecolor.SetMotionAction(forecolorhandler);
|
||||
|
||||
WinBase divider4(&a,290,4,5,272);
|
||||
divider4.SetBevelWidth(2);
|
||||
WinText hibackcolorlabel(&a,140,20,5,278,"Hilight Back Color");
|
||||
WinText hiforecolorlabel(&a,140,20,155,278,"Hilight Fore Color");
|
||||
|
||||
WinColorSelector hibackcolor(&a,140,70,5,298);
|
||||
WinColorSelector hiforecolor(&a,140,70,155,298);
|
||||
hibackselwin = &hibackcolor;
|
||||
hiforeselwin = &hiforecolor;
|
||||
hibackcolor.SetBevelWidth(0);
|
||||
hiforecolor.SetBevelWidth(0);
|
||||
hibackcolorlabel.SetBevelWidth(0);
|
||||
hiforecolorlabel.SetBevelWidth(0);
|
||||
hibackcolor.SetMotionAction(hibackcolorhandler);
|
||||
hiforecolor.SetMotionAction(hiforecolorhandler);
|
||||
|
||||
|
||||
WinButton testbutton(&a,60,20,30,WINDOW_HEIGHT-30,"Test");
|
||||
WinButton commitbutton(&a,60,20,120,WINDOW_HEIGHT-30,"Commit");
|
||||
testbutton.MakeMomentary();
|
||||
WinButton abortbutton(&a,60,20,210,WINDOW_HEIGHT-30,"Abort");
|
||||
|
||||
commitbutton.SetToggleAction(commitaction);
|
||||
testbutton.SetToggleAction(testaction);
|
||||
abortbutton.SetToggleAction(abortaction);
|
||||
fclick = &focusclick;
|
||||
fsloppy = &focussloppy;
|
||||
fmouse = &focusmouse;
|
||||
cmouse = &colormapmouse;
|
||||
cfocus = &colormapfocus;
|
||||
escroll = &EdgeScroll;
|
||||
nescroll = &NoEdgeScroll;
|
||||
inwin = &deskinput;
|
||||
a.Map();
|
||||
|
||||
while(1)
|
||||
{
|
||||
WinLoop();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,115 +0,0 @@
|
||||
#ifndef win_h
|
||||
#define win_h
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
/* let's define Pixel if it is not done yet */
|
||||
#if ! defined(_XtIntrinsic_h) && ! defined(PIXEL_ALREADY_TYPEDEFED)
|
||||
typedef unsigned long Pixel; /* Index into colormap */
|
||||
#define PIXEL_ALREADY_TYPEDEFED
|
||||
#endif
|
||||
|
||||
#define DEFAULT_BEVEL "2"
|
||||
#define DEFAULT_WIDTH 100
|
||||
#define DEFAULT_HEIGHT 100
|
||||
#define DEFAULT_X 0
|
||||
#define DEFAULT_Y 0
|
||||
#define DEFAULT_BACKCOLOR "#908090"
|
||||
#define DEFAULT_FORECOLOR "black"
|
||||
#define DEFAULT_FONT "fixed"
|
||||
|
||||
|
||||
|
||||
class WinBase
|
||||
{
|
||||
public:
|
||||
static Display *dpy;
|
||||
static Window Root;
|
||||
static int Screen;
|
||||
static Pixel DefaultBackColor;
|
||||
static Pixel DefaultReliefColor;
|
||||
static Pixel DefaultShadowColor;
|
||||
static Pixel DefaultForeColor;
|
||||
static GC DefaultReliefGC;
|
||||
static GC DefaultShadowGC;
|
||||
static GC DefaultForeGC;
|
||||
static XFontStruct *DefaultFont;
|
||||
static Colormap cmap;
|
||||
|
||||
Window win;
|
||||
WinBase *Parent;
|
||||
WinBase *main_window;
|
||||
int name_set;
|
||||
int icon_name_set;
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
int h;
|
||||
int bw;
|
||||
char popped_out;
|
||||
Pixel BackColor;
|
||||
Pixel ReliefColor;
|
||||
Pixel ShadowColor;
|
||||
Pixel ForeColor;
|
||||
GC ReliefGC;
|
||||
GC ShadowGC;
|
||||
GC ForeGC;
|
||||
XFontStruct *Font;
|
||||
void (*CloseWindowAction)(WinBase *which);
|
||||
|
||||
WinBase(WinBase *Parent = NULL,
|
||||
int width = DEFAULT_WIDTH,int height=DEFAULT_HEIGHT,
|
||||
int x_loc=DEFAULT_X, int y_loc=DEFAULT_Y);
|
||||
~WinBase();
|
||||
void Map();
|
||||
|
||||
/* These routines are called in response to X Events. */
|
||||
virtual void DrawCallback(XEvent *event = NULL);
|
||||
virtual void BPressCallback(XEvent *event = NULL);
|
||||
virtual void BReleaseCallback(XEvent *event = NULL);
|
||||
virtual void KPressCallback(XEvent *event = NULL);
|
||||
virtual void ResizeCallback(int new_w, int new_h, XEvent *event = NULL);
|
||||
virtual void MotionCallback(XEvent *event = NULL);
|
||||
|
||||
/* These are user-callable routines */
|
||||
void SetSize(int width = DEFAULT_WIDTH, int height = DEFAULT_HEIGHT);
|
||||
void SetPosition(int x = DEFAULT_X, int y = DEFAULT_Y);
|
||||
void SetGeometry(int new_x, int new_y, int new_w, int new_h,
|
||||
int min_width=1, int min_height=1,
|
||||
int max_width=32767, int max_height=32767,
|
||||
int resize_inc_w=1, int resize_inc_h=1,
|
||||
int base_width=1, int base_height=1,
|
||||
int gravity=NorthWestGravity);
|
||||
void SetCloseWindowAction(void (*CloseWindowAction)(WinBase *which));
|
||||
void SetBackColor(char *bcolor);
|
||||
void SetForeColor(char *fcolor);
|
||||
void SetBevelWidth(int bw);
|
||||
void SetFont(char *font);
|
||||
void PushIn(void);
|
||||
void PopOut(void);
|
||||
void MakeTransient(WinBase *TransientFor);
|
||||
void SetWindowName(char *name);
|
||||
void SetIconName(char *name);
|
||||
void SetWindowClass(char *resclass);
|
||||
void RedrawWindow(int clear);
|
||||
inline int ScreenWidth(){return XDisplayWidth(dpy,Screen);};
|
||||
inline int ScreenHeight(){return XDisplayHeight(dpy,Screen);};
|
||||
};
|
||||
|
||||
|
||||
void WinInitialize(char **argv, int argc);
|
||||
int WinAddInput(int fd, void (*readfunc)(int));
|
||||
int WinAddOutput(int fd, void (*writefunc)(int));
|
||||
void WinLoop(void);
|
||||
Pixel GetColor(char *name, Display *dpy, Colormap cmap,int Screen);
|
||||
void RegisterWindow(Window win, WinBase *a);
|
||||
void UnregisterWindow(WinBase *thing);
|
||||
Pixel GetShadow(Pixel background, Display *dpy, int Screen, Colormap cmap) ;
|
||||
Pixel GetHilite(Pixel background, Display *dpy, int Screen, Colormap cmap) ;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
#include <iostream.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "WinButton.h"
|
||||
|
||||
WinButton::WinButton(WinBase *Parent, int new_w,int new_h,
|
||||
int new_x, int new_y, char *new_label):
|
||||
WinText(Parent,new_w, new_h, new_x,new_y, new_label)
|
||||
{
|
||||
label = new_label;
|
||||
action = 0;
|
||||
momentary = 0;
|
||||
ToggleAction = NULL;
|
||||
}
|
||||
|
||||
WinButton::~WinButton()
|
||||
{
|
||||
}
|
||||
|
||||
void WinButton::SetToggleAction(void (*NewToggleAction)(int newstate,
|
||||
WinButton *which))
|
||||
{
|
||||
ToggleAction = NewToggleAction;
|
||||
}
|
||||
|
||||
void WinButton::MakeMomentary()
|
||||
{
|
||||
momentary = 1;
|
||||
}
|
||||
|
||||
void WinButton::BPressCallback(XEvent *event)
|
||||
{
|
||||
action = popped_out;
|
||||
popped_out = 0;
|
||||
RedrawWindow(0);
|
||||
}
|
||||
|
||||
|
||||
void WinButton::BReleaseCallback(XEvent *event)
|
||||
{
|
||||
if((event->xbutton.x > w)||(event->xbutton.x <0)||
|
||||
(event->xbutton.y > h)||(event->xbutton.y <0))
|
||||
{
|
||||
popped_out = action;
|
||||
action = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(momentary)
|
||||
{
|
||||
popped_out = 1;
|
||||
if(ToggleAction != NULL)
|
||||
ToggleAction(popped_out,this);
|
||||
}
|
||||
else
|
||||
{
|
||||
popped_out = 1-action;
|
||||
if(ToggleAction != NULL)
|
||||
ToggleAction(popped_out,this);
|
||||
}
|
||||
}
|
||||
RedrawWindow(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#ifndef winbutton_h
|
||||
#define winbutton_h
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include "WinText.h"
|
||||
|
||||
class WinButton: public WinText
|
||||
{
|
||||
public:
|
||||
char momentary;
|
||||
char action;
|
||||
void (*ToggleAction)(int newstate, WinButton *which);
|
||||
|
||||
WinButton(WinBase *Parent, int w, int h, int x, int y, char *label);
|
||||
~WinButton();
|
||||
|
||||
void SetToggleAction(void (*ToggleAction)(int newstate, WinButton *which));
|
||||
void MakeMomentary();
|
||||
void BPressCallback(XEvent *event = NULL);
|
||||
void BReleaseCallback(XEvent *event = NULL);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,148 +0,0 @@
|
||||
#include <iostream.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <X11/Intrinsic.h>
|
||||
#include "WinBase.h"
|
||||
#include "WinColorSelector.h"
|
||||
#include "WinSlider.h"
|
||||
|
||||
static void positioncallback(float loc, WinSlider *which);
|
||||
|
||||
WinColorSelector::WinColorSelector(WinBase *Parent, int new_w,int new_h,
|
||||
int new_x, int new_y)
|
||||
: WinBase(Parent,new_w, new_h, new_x,new_y)
|
||||
{
|
||||
int slider_width;
|
||||
int slider_height;
|
||||
XColor color;
|
||||
|
||||
|
||||
MotionAction = NULL;
|
||||
slider_width = new_w/2 - 5;
|
||||
slider_height = (new_h-5)/3 - 5;
|
||||
if(slider_height < 20)
|
||||
slider_height = 20;
|
||||
|
||||
red_value = 32000.0;
|
||||
green_value = 32000.0;
|
||||
blue_value = 32000.0;
|
||||
|
||||
red_slider = new WinSlider(this,slider_width,slider_height,
|
||||
5,5,0.0,65535.0,red_value);
|
||||
green_slider = new WinSlider(this,slider_width,slider_height,
|
||||
5,slider_height+10,0.0,65535.0,green_value);
|
||||
blue_slider = new WinSlider(this,slider_width,slider_height,
|
||||
5,2*slider_height+15,0.0,65535.0,blue_value);
|
||||
red_slider->SetMotionAction(positioncallback);
|
||||
green_slider->SetMotionAction(positioncallback);
|
||||
blue_slider->SetMotionAction(positioncallback);
|
||||
red_slider->SetBevelWidth(0);
|
||||
green_slider->SetBevelWidth(0);
|
||||
blue_slider->SetBevelWidth(0);
|
||||
colorpanel = new WinBase(this,new_w/2-20,new_h-20,new_w/2+10,10);
|
||||
colorpanel->PushIn();
|
||||
if(!XAllocColorCells(dpy,cmap,False,&private_planes,0,&private_pixel,1))
|
||||
{
|
||||
cerr <<"Couldn't alloc r/w color cell. Trying new map\n";
|
||||
cmap = XCopyColormapAndFree(dpy,cmap);
|
||||
if(!XAllocColorCells(dpy,cmap,False,&private_planes,0,&private_pixel,1))
|
||||
{
|
||||
cerr <<"Couldn't alloc r/w color cell. giving up\n";
|
||||
private_pixel = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
XSetWindowColormap(dpy,main_window->win,cmap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XSetWindowBackground(dpy,colorpanel->win,private_pixel);
|
||||
|
||||
if(private_pixel != 0)
|
||||
{
|
||||
color.pixel = private_pixel;
|
||||
color.red = (int)red_value;
|
||||
color.green = (int)green_value;
|
||||
color.blue = (int)blue_value;
|
||||
color.flags = DoRed | DoGreen| DoBlue;
|
||||
XStoreColor(dpy,cmap,&color);
|
||||
}
|
||||
colorpanel->Map();
|
||||
red_slider->Map();
|
||||
green_slider->Map();
|
||||
blue_slider->Map();
|
||||
}
|
||||
|
||||
WinColorSelector::~WinColorSelector()
|
||||
{
|
||||
delete red_slider;
|
||||
delete green_slider;
|
||||
delete blue_slider;
|
||||
XFreeColors(dpy,cmap,&private_pixel,1,private_planes);
|
||||
delete colorpanel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void WinColorSelector::SetCurrentValue(float new_red,
|
||||
float new_green,
|
||||
float new_blue)
|
||||
{
|
||||
red_value = new_red;
|
||||
green_value = new_green;
|
||||
blue_value = new_blue;
|
||||
positioncallback(red_value, red_slider);
|
||||
positioncallback(green_value, green_slider);
|
||||
positioncallback(blue_value, blue_slider);
|
||||
red_slider->SetCurrentValue(red_value);
|
||||
red_slider->RedrawWindow(1);
|
||||
green_slider->SetCurrentValue(green_value);
|
||||
green_slider->RedrawWindow(1);
|
||||
blue_slider->SetCurrentValue(blue_value);
|
||||
blue_slider->RedrawWindow(1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void WinColorSelector::SetMotionAction(void (*NewMotionAction)
|
||||
(float new_red, float new_green,
|
||||
float new_blue,
|
||||
WinColorSelector *which))
|
||||
{
|
||||
MotionAction = NewMotionAction;
|
||||
}
|
||||
|
||||
static void positioncallback(float loc, WinSlider *which)
|
||||
{
|
||||
XColor color;
|
||||
WinColorSelector *t;
|
||||
|
||||
t = (WinColorSelector *)(which->Parent);
|
||||
if(which == t->red_slider)
|
||||
{
|
||||
t->red_value = loc;
|
||||
}
|
||||
else if(which == t->blue_slider)
|
||||
{
|
||||
t->blue_value = loc;
|
||||
}
|
||||
else
|
||||
{
|
||||
t->green_value = loc;
|
||||
}
|
||||
if(t->private_pixel != 0)
|
||||
{
|
||||
color.pixel = t->private_pixel;
|
||||
color.red = (int)t->red_value;
|
||||
color.green = (int)t->green_value;
|
||||
color.blue = (int)t->blue_value;
|
||||
color.flags = DoRed | DoGreen| DoBlue;
|
||||
XStoreColor(which->dpy,which->cmap,&color);
|
||||
}
|
||||
if(t->MotionAction != NULL)
|
||||
t->MotionAction(t->red_value, t->green_value,
|
||||
t->blue_value,
|
||||
(WinColorSelector *)which->Parent);
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
#ifndef winColorSelector_h
|
||||
#define winColorSelector_h
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include "WinBase.h"
|
||||
#include "WinSlider.h"
|
||||
|
||||
class WinColorSelector: public WinBase
|
||||
{
|
||||
public:
|
||||
float red_value;
|
||||
float green_value;
|
||||
float blue_value;
|
||||
unsigned long private_planes;
|
||||
unsigned long private_pixel;
|
||||
WinSlider *red_slider;
|
||||
WinSlider *green_slider;
|
||||
WinSlider *blue_slider;
|
||||
WinBase *colorpanel;
|
||||
|
||||
void (*MotionAction)(float new_red, float new_green, float new_blue,
|
||||
WinColorSelector *which);
|
||||
|
||||
WinColorSelector(WinBase *Parent, int w, int h, int x, int y);
|
||||
~WinColorSelector();
|
||||
|
||||
void SetCurrentValue(float new_red, float new_green, float new_blue);
|
||||
void UpdatePosition(int newx, int newy);
|
||||
void SetMotionAction(void (*MotionAction)(float new_red, float new_green,
|
||||
float new_blue,
|
||||
WinColorSelector *which));
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,455 +0,0 @@
|
||||
#include <iostream.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "WinInput.h"
|
||||
|
||||
static char *lookup_key(XEvent *ev,int *pcount);
|
||||
void addchar(char c, char *buffer, int bufsize, int &ptr, int& endptr);
|
||||
#define KBUFSIZE 100
|
||||
|
||||
WinInput::WinInput(WinBase *Parent, int new_w,int new_h,
|
||||
int new_x, int new_y, char *initlabel):
|
||||
WinText(Parent,new_w, new_h, new_x,new_y, NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
text_offset = bw+4;
|
||||
NewLineAction = NULL;
|
||||
if(initlabel)
|
||||
{
|
||||
label_size = (int)((strlen(initlabel)+1)/100) + 100;
|
||||
label = new char[label_size];
|
||||
num_chars =strlen(initlabel);
|
||||
ptr = num_chars;
|
||||
endptr = num_chars;
|
||||
strcpy(label,initlabel);
|
||||
}
|
||||
else
|
||||
{
|
||||
num_chars = 0;
|
||||
label_size = 100;
|
||||
label = new char[label_size];
|
||||
label[0] = 0;
|
||||
|
||||
ptr = 0;
|
||||
endptr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
WinInput::~WinInput()
|
||||
{
|
||||
delete label;
|
||||
}
|
||||
|
||||
void WinInput::SetNewLineAction(void (*new_NewLineAction)(int numchars,
|
||||
char *newdata))
|
||||
{
|
||||
NewLineAction = new_NewLineAction;
|
||||
}
|
||||
|
||||
char * WinInput::GetLine()
|
||||
{
|
||||
return label;
|
||||
}
|
||||
|
||||
void WinInput::SetLabel(char *text)
|
||||
{
|
||||
if(!text)
|
||||
return;
|
||||
if(strlen(text) < label_size)
|
||||
{
|
||||
strcpy(label,text);
|
||||
ptr = strlen(text);
|
||||
endptr = ptr;
|
||||
num_chars = ptr;
|
||||
}
|
||||
}
|
||||
void WinInput::KPressCallback(XEvent *event)
|
||||
{
|
||||
int count;
|
||||
char *s;
|
||||
char *newlabel;
|
||||
int i;
|
||||
|
||||
s = lookup_key(event,&count);
|
||||
if(num_chars + count + 1>= label_size)
|
||||
{
|
||||
newlabel = new char [label_size + 100];
|
||||
if(newlabel == NULL)
|
||||
{
|
||||
cerr <<"Can't allocate buffer space\n";
|
||||
return;
|
||||
}
|
||||
strcpy(newlabel, label);
|
||||
label_size = label_size + 100;
|
||||
delete label;
|
||||
label = newlabel;
|
||||
}
|
||||
for(i=0;i<count;i++)
|
||||
addchar(s[i],label,label_size,ptr,endptr);
|
||||
|
||||
if((s[0] == '\n')||(s[0] == '\r'))
|
||||
{
|
||||
if(NewLineAction)
|
||||
NewLineAction(num_chars,label);
|
||||
}
|
||||
num_chars = strlen(label);
|
||||
RedrawWindow(1);
|
||||
}
|
||||
|
||||
void WinInput::DrawCallback(XEvent *event)
|
||||
{
|
||||
int xoff,yoff,twidth,twidth2;
|
||||
GC gc1;
|
||||
GC gc2;
|
||||
|
||||
WinBase::DrawCallback(event);
|
||||
|
||||
if(((!event)||(event->xexpose.count == 0))&&(label != NULL))
|
||||
{
|
||||
twidth = XTextWidth(Font,label,strlen(label));
|
||||
twidth2 = XTextWidth(Font,label,ptr);
|
||||
if(text_offset + twidth2 > w - bw - 4)
|
||||
{
|
||||
text_offset = w - bw - 4 - twidth2;
|
||||
}
|
||||
if(text_offset + twidth2 < bw+4)
|
||||
{
|
||||
text_offset += bw +4 - (text_offset + twidth2);
|
||||
}
|
||||
yoff = h - 1 - (h - Font->ascent - Font->descent)/2 -Font->descent;
|
||||
XDrawString(dpy,twin,ForeGC, text_offset-bw,yoff-bw,label,strlen(label));
|
||||
|
||||
xoff = text_offset + XTextWidth(Font,label,ptr)-1;
|
||||
XDrawLine(dpy,twin,ForeGC,xoff-bw,yoff-Font->ascent-bw,
|
||||
xoff-bw,yoff+Font->descent - bw);
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert the keypress event into a string.
|
||||
*/
|
||||
static char *lookup_key(XEvent *ev,int *pcount)
|
||||
{
|
||||
KeySym keysym;
|
||||
static XComposeStatus compose = {NULL,0};
|
||||
int count;
|
||||
static char kbuf[KBUFSIZE];
|
||||
char *s, *c;
|
||||
int meta;
|
||||
int app_cur_keys = 0;
|
||||
int app_kp_keys = 0;
|
||||
|
||||
count = XLookupString(&ev->xkey,kbuf,KBUFSIZE-1,&keysym,&compose);
|
||||
kbuf[count] = (unsigned char)0;
|
||||
meta = ev->xkey.state & Mod1Mask;
|
||||
s = NULL;
|
||||
|
||||
switch(keysym)
|
||||
{
|
||||
case XK_Up :
|
||||
strcpy(kbuf,(app_cur_keys ? "\033OA" : "\033[A"));
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_Down :
|
||||
strcpy(kbuf,app_cur_keys ? "\033OB" : "\033[B");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_Right :
|
||||
strcpy(kbuf,app_cur_keys ? "\033OC" : "\033[C");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_Left :
|
||||
strcpy(kbuf,app_cur_keys ? "\033OD" : "\033[D");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_F1 :
|
||||
strcpy(kbuf,"\033OP");
|
||||
count = 3;
|
||||
break;
|
||||
case XK_KP_F2 :
|
||||
strcpy(kbuf,"\033OQ");
|
||||
count = 3;
|
||||
break;
|
||||
case XK_KP_F3 :
|
||||
strcpy(kbuf,"\033OR");
|
||||
count = 3;
|
||||
break;
|
||||
case XK_KP_F4 :
|
||||
strcpy(kbuf,"\033OS");
|
||||
count = 3;
|
||||
break;
|
||||
case XK_KP_0 :
|
||||
strcpy(kbuf,app_kp_keys ? "\033Op" : "0");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_1 :
|
||||
strcpy(kbuf,app_kp_keys ? "\033Oq" : "1");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_2 :
|
||||
strcpy(kbuf,app_kp_keys ? "\033Or" : "2");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_3 :
|
||||
strcpy(kbuf,app_kp_keys ? "\033Os" : "3");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_4 :
|
||||
strcpy(kbuf,app_kp_keys ? "\033Ot" : "4");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_5 :
|
||||
strcpy(kbuf,app_kp_keys ? "\033Ou" : "5");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_6 :
|
||||
strcpy(kbuf,app_kp_keys ? "\033Ov" : "6");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_7 :
|
||||
strcpy(kbuf,app_kp_keys ? "\033Ow" : "7");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_8 :
|
||||
strcpy(kbuf,app_kp_keys ? "\033Ox" : "8");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_9 :
|
||||
strcpy(kbuf,app_kp_keys ? "\033Oy" : "9");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_Add:
|
||||
strcpy(kbuf,app_kp_keys ? "\033Ok" : "-");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_Subtract :
|
||||
strcpy(kbuf,app_kp_keys ? "\033Om" : "-");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_Multiply :
|
||||
strcpy(kbuf,app_kp_keys ? "\033Oj" : "-");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_Divide :
|
||||
strcpy(kbuf,app_kp_keys ? "\033Oo" : "-");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_Separator :
|
||||
strcpy(kbuf,app_kp_keys ? "\033Ol" : ",");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_Decimal :
|
||||
strcpy(kbuf,app_kp_keys ? "\033On" : ".");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_KP_Enter :
|
||||
strcpy(kbuf,app_kp_keys ? "\033OM" : "\r");
|
||||
count = strlen(kbuf);
|
||||
break;
|
||||
case XK_Home :
|
||||
strcpy(kbuf,"\033[H");
|
||||
count = 3;
|
||||
break;
|
||||
case XK_End :
|
||||
strcpy(kbuf,"\033Ow");
|
||||
count = 3;
|
||||
break;
|
||||
case XK_F1 :
|
||||
strcpy(kbuf,"\033[11~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F2 :
|
||||
strcpy(kbuf,"\033[12~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F3 :
|
||||
strcpy(kbuf,"\033[13~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F4 :
|
||||
strcpy(kbuf,"\033[14~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F5 :
|
||||
strcpy(kbuf,"\033[15~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F6 :
|
||||
strcpy(kbuf,"\033[17~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F7 :
|
||||
strcpy(kbuf,"\033[18~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F8 :
|
||||
strcpy(kbuf,"\033[19~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F9 :
|
||||
strcpy(kbuf,"\033[20~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F10 :
|
||||
strcpy(kbuf,"\033[21~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F11 :
|
||||
strcpy(kbuf,"\033[23~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F12 :
|
||||
strcpy(kbuf,"\033[24~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F13 :
|
||||
strcpy(kbuf,"\033[25~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F14 :
|
||||
strcpy(kbuf,"\033[26~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_Help:
|
||||
case XK_F15:
|
||||
strcpy(kbuf,"\033[28~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_Menu:
|
||||
case XK_F16:
|
||||
strcpy(kbuf,"\033[29~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F17 :
|
||||
strcpy(kbuf,"\033[31~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F18 :
|
||||
strcpy(kbuf,"\033[32~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F19 :
|
||||
strcpy(kbuf,"\033[33~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_F20 :
|
||||
strcpy(kbuf,"\033[34~");
|
||||
count = 5;
|
||||
break;
|
||||
case XK_Find :
|
||||
strcpy(kbuf,"\033[1~");
|
||||
count = 4;
|
||||
break;
|
||||
case XK_Insert :
|
||||
strcpy(kbuf,"\033[2~");
|
||||
count = 4;
|
||||
break;
|
||||
case XK_Execute :
|
||||
strcpy(kbuf,"\033[3~");
|
||||
count = 4;
|
||||
break;
|
||||
case XK_Select :
|
||||
strcpy(kbuf,"\033[4~");
|
||||
count = 4;
|
||||
break;
|
||||
case XK_Prior :
|
||||
strcpy(kbuf,"\033[5~");
|
||||
count = 4;
|
||||
break;
|
||||
case XK_Next:
|
||||
strcpy(kbuf,"\033[6~");
|
||||
count = 4;
|
||||
break;
|
||||
#ifdef BACKSPACE_SUCKS
|
||||
case XK_BackSpace:
|
||||
strcpy(kbuf,"\177");
|
||||
count = 1;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
*pcount = count;
|
||||
|
||||
if(meta &&(count > 0))
|
||||
{
|
||||
for(c = kbuf; c < kbuf+count ; c++)
|
||||
{
|
||||
*c = *c | 0x80 ;
|
||||
}
|
||||
*(kbuf+count)=0;
|
||||
}
|
||||
else
|
||||
*(kbuf+count) = 0;
|
||||
return (kbuf);
|
||||
}
|
||||
|
||||
|
||||
void addchar(char c, char *buffer, int bufsize, int &ptr, int& endptr)
|
||||
{
|
||||
int i;
|
||||
|
||||
if((c!= '\n')&&(c!='\r')&&(c!=0)&&(ptr < (bufsize-1)))
|
||||
{
|
||||
if(((c=='\b')||(c=='\177'))&&(ptr > 0))
|
||||
{
|
||||
ptr--;
|
||||
endptr--;
|
||||
for(i=ptr; i<endptr;i++)
|
||||
buffer[i] = buffer[i+1];
|
||||
}
|
||||
/* ctrl-b - go back one space*/
|
||||
else if((c=='b'-'a'+1)&&(ptr > 0))
|
||||
{
|
||||
ptr--;
|
||||
}
|
||||
/* ctrl-d - delete current char, or quit if ptr = endptr=0 */
|
||||
else if(c=='d'-'a'+1)
|
||||
{
|
||||
if((ptr==endptr)&&(endptr == 0))
|
||||
exit(0);
|
||||
if(endptr > 0)
|
||||
{
|
||||
endptr--;
|
||||
for(i=ptr; i<endptr;i++)
|
||||
buffer[i] = buffer[i+1];
|
||||
}
|
||||
}
|
||||
/* ctrl-k - delete current char, to end of line */
|
||||
else if(c=='k'-'a'+1)
|
||||
{
|
||||
buffer[ptr] = 0;
|
||||
endptr = ptr;
|
||||
}
|
||||
/* ctrl-f - go forward one space*/
|
||||
else if((c=='f'-'a'+1)&&(ptr < endptr))
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
/* ctrl-a - go to start of line */
|
||||
else if(c=='a'-'a'+1)
|
||||
{
|
||||
ptr=0;
|
||||
}
|
||||
/* ctrl-e - go to end of line */
|
||||
else if(c=='e'-'a'+1)
|
||||
{
|
||||
ptr=endptr;
|
||||
}
|
||||
else if((c >= ' ')&&(c <= '~'))/* Regular text */
|
||||
{
|
||||
endptr++;
|
||||
for(i=endptr; i>ptr;i--)
|
||||
{
|
||||
buffer[i] = buffer[i-1];
|
||||
}
|
||||
buffer[ptr] = c;
|
||||
ptr++;
|
||||
}
|
||||
if(ptr > endptr)endptr = ptr;
|
||||
}
|
||||
buffer[endptr] = 0;
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#ifndef wininput_h
|
||||
#define wininput_h
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include "WinText.h"
|
||||
|
||||
#define HISTORY_LENGTH 100
|
||||
|
||||
class WinInput: public WinText
|
||||
{
|
||||
public:
|
||||
int text_offset;
|
||||
int num_chars;
|
||||
int label_size;
|
||||
int ptr;
|
||||
int endptr;
|
||||
|
||||
void (*NewLineAction)(int numchars, char *newdata);
|
||||
|
||||
WinInput(WinBase *Parent, int w, int h, int x, int y, char *initlabel= NULL);
|
||||
~WinInput();
|
||||
|
||||
char *GetLine(void);
|
||||
void DrawCallback(XEvent *event);
|
||||
void KPressCallback(XEvent *event = NULL);
|
||||
void SetNewLineAction(void (*NewLineAction)(int numchars, char *newdata));
|
||||
void SetLabel(char *text);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,81 +0,0 @@
|
||||
#include <iostream.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "WinRadioButton.h"
|
||||
|
||||
WinRadioButton::WinRadioButton(WinBase *Parent, int new_w,int new_h,
|
||||
int new_x, int new_y, char *new_label):
|
||||
WinButton(Parent,new_w, new_h, new_x,new_y, new_label)
|
||||
{
|
||||
int xoff;
|
||||
|
||||
button_size = 10;
|
||||
if(button_size > w)
|
||||
button_size = w;
|
||||
if(button_size > h)
|
||||
button_size = h;
|
||||
xoff = button_size+4;
|
||||
XMoveResizeWindow(dpy,twin,xoff,0,w-xoff,h);
|
||||
}
|
||||
|
||||
void WinRadioButton::DrawCallback(XEvent *event)
|
||||
{
|
||||
int xoff,yoff,i;
|
||||
GC gc1;
|
||||
GC gc2;
|
||||
int y1,y2;
|
||||
|
||||
if((!event)||(event->xexpose.count == 0))
|
||||
{
|
||||
y1 = (h-button_size)/2-1;
|
||||
y2 = button_size + (h-button_size)/2-1;
|
||||
|
||||
if(popped_out)
|
||||
{
|
||||
gc1 = ShadowGC;
|
||||
gc2 = ReliefGC;
|
||||
}
|
||||
else
|
||||
{
|
||||
gc2 = ShadowGC;
|
||||
gc1 = ReliefGC;
|
||||
}
|
||||
for(i=0;i<bw;i++)
|
||||
{
|
||||
XDrawLine(dpy,win,gc1,i, y2-i,button_size-1-i,y2-i);
|
||||
XDrawLine(dpy,win,gc1,button_size-1-i,y1+i,button_size-1-i,y2-i);
|
||||
XDrawLine(dpy,win,gc2,i, y1+i,button_size-1-i,y1+i);
|
||||
XDrawLine(dpy,win,gc2,i, y1+i,i, y2-i);
|
||||
}
|
||||
if(label != NULL)
|
||||
{
|
||||
yoff = h -1 - (h - Font->ascent - Font->descent)/2 -Font->descent;
|
||||
XDrawString(dpy,twin,ForeGC, 0,yoff,label,strlen(label));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WinRadioButton::ResizeCallback(int new_w, int new_h, XEvent *event)
|
||||
{
|
||||
int xoff;
|
||||
w = new_w;
|
||||
h = new_h;
|
||||
|
||||
button_size = 10;
|
||||
if(button_size > w)
|
||||
button_size = w;
|
||||
if(button_size > h)
|
||||
button_size = h;
|
||||
|
||||
xoff = button_size+4;
|
||||
XMoveResizeWindow(dpy,twin,xoff,0,w-xoff,h);
|
||||
RedrawWindow(1);
|
||||
}
|
||||
|
||||
void WinRadioButton::SetBevelWidth(int new_bw)
|
||||
{
|
||||
bw = new_bw;
|
||||
RedrawWindow(1);
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef winradiobutton_h
|
||||
#define winradiobutton_h
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include "WinButton.h"
|
||||
|
||||
class WinRadioButton: public WinButton
|
||||
{
|
||||
int button_size;
|
||||
public:
|
||||
WinRadioButton(WinBase *Parent, int w, int h, int x, int y, char *label);
|
||||
void DrawCallback(XEvent *event = NULL);
|
||||
void ResizeCallback(int new_w, int new_h, XEvent *event);
|
||||
void SetBevelWidth(int new_bw);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,148 +0,0 @@
|
||||
#include <iostream.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <X11/Intrinsic.h>
|
||||
#include "WinBase.h"
|
||||
#include "WinSlider.h"
|
||||
|
||||
WinSlider::WinSlider(WinBase *Parent, int new_w,int new_h,
|
||||
int new_x, int new_y,
|
||||
float min_val, float max_val, float init_val)
|
||||
: WinBase(Parent,new_w, new_h, new_x,new_y)
|
||||
{
|
||||
min_value = min_val;
|
||||
max_value = max_val;
|
||||
MotionAction = NULL;
|
||||
current_value = init_val;
|
||||
|
||||
XSetWindowAttributes attributes; /* attributes for creating window */
|
||||
unsigned long mask;
|
||||
|
||||
mask = CWEventMask;
|
||||
attributes.event_mask = ButtonPressMask|ButtonReleaseMask|ButtonMotionMask|
|
||||
ExposureMask|KeyPressMask|StructureNotifyMask;
|
||||
XChangeWindowAttributes(dpy,win,mask,&attributes);
|
||||
}
|
||||
|
||||
WinSlider::~WinSlider()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void WinSlider::SetMinValue(float new_val)
|
||||
{
|
||||
min_value = new_val;
|
||||
}
|
||||
|
||||
|
||||
void WinSlider::SetMaxValue(float new_val)
|
||||
{
|
||||
max_value = new_val;
|
||||
}
|
||||
|
||||
|
||||
void WinSlider::SetCurrentValue(float new_val)
|
||||
{
|
||||
current_value = new_val;
|
||||
}
|
||||
|
||||
void WinSlider::SetMotionAction(void (*NewMotionAction)(float new_location,
|
||||
WinSlider *which))
|
||||
{
|
||||
MotionAction = NewMotionAction;
|
||||
}
|
||||
|
||||
void WinSlider::DrawCallback(XEvent *event)
|
||||
{
|
||||
int xoff,yoff,x1,x2,x3,x4,y1,y2,y3,y4;
|
||||
GC gc1;
|
||||
GC gc2;
|
||||
|
||||
WinBase::DrawCallback(event);
|
||||
if((!event)||(event->xexpose.count == 0))
|
||||
{
|
||||
x1 = (int)(w * 0.1);
|
||||
x2 = (int)(w * 0.9);
|
||||
y1 = h-15;
|
||||
y2 = h-11;
|
||||
XDrawLine(dpy,win,ShadowGC,x1+1,y1,x2-1,y1);
|
||||
XDrawLine(dpy,win,ShadowGC,x1,y1+1,x1,y2-1);
|
||||
XDrawLine(dpy,win,ReliefGC,x1+1,y2,x2-1,y2);
|
||||
XDrawLine(dpy,win,ReliefGC,x2,y1+1,x2,y2-1);
|
||||
|
||||
x3 = (int)((current_value - min_value)/(max_value - min_value) * w * 0.8 - 2 + x1);
|
||||
x4 = x3+5;
|
||||
y3 = h-20;
|
||||
y4 = h-6;
|
||||
XDrawLine(dpy,win,ShadowGC,x3+1,y3,x4-1,y3);
|
||||
XDrawLine(dpy,win,ShadowGC,x3,y3+1,x3,y4-1);
|
||||
XDrawLine(dpy,win,ReliefGC,x3+1,y4,x4-1,y4);
|
||||
XDrawLine(dpy,win,ReliefGC,x4,y3+1,x4,y4-1);
|
||||
|
||||
if(x3 > x1)
|
||||
{
|
||||
XDrawLine(dpy,win,ShadowGC,x1+1,y1+2,x3-1,y1+2);
|
||||
XDrawLine(dpy,win,ShadowGC,x1+1,y1+3,x3-1,y1+3);
|
||||
XDrawLine(dpy,win,ShadowGC,x1+1,y1+4,x3-1,y1+4);
|
||||
}
|
||||
XClearArea(dpy,win,x3+1,y3+1,x4-x3-1,y4-y3-1,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WinSlider::BPressCallback(XEvent *event)
|
||||
{
|
||||
int newx, newy;
|
||||
newx = event->xbutton.x;
|
||||
newy = event->xbutton.y;
|
||||
UpdatePosition(newx,newy);
|
||||
}
|
||||
|
||||
void WinSlider::BReleaseCallback(XEvent *event)
|
||||
{
|
||||
int newx, newy;
|
||||
|
||||
newx = event->xbutton.x;
|
||||
newy = event->xbutton.y;
|
||||
|
||||
UpdatePosition(newx,newy);
|
||||
}
|
||||
void WinSlider::MotionCallback(XEvent *event)
|
||||
{
|
||||
int newx, newy;
|
||||
newx = event->xmotion.x;
|
||||
newy = event->xmotion.y;
|
||||
|
||||
UpdatePosition(newx,newy);
|
||||
}
|
||||
|
||||
|
||||
void WinSlider::UpdatePosition(int newx,int newy)
|
||||
{
|
||||
int x3,x4,y3,y4,x1,y1;
|
||||
|
||||
x1 = (int)(w * 0.1);
|
||||
x3 = (int)((current_value - min_value)/(max_value - min_value) * w * 0.8
|
||||
- 2 + x1);
|
||||
x4 = x3+5;
|
||||
y3 = h-20;
|
||||
y4 = h-6;
|
||||
y1 = h-15;
|
||||
XClearArea(dpy,win,x3,y3,x4-x3+1,y4-y3+1,0);
|
||||
XClearArea(dpy,win,x1,y1+2,x3-x1,3,0);
|
||||
|
||||
|
||||
current_value = (max_value - min_value)*(newx - w*0.1)/(w*0.8) + min_value;
|
||||
if(current_value < min_value)
|
||||
current_value = min_value;
|
||||
if(current_value > max_value)
|
||||
current_value = max_value;
|
||||
|
||||
|
||||
DrawCallback(NULL);
|
||||
if(MotionAction != NULL)
|
||||
{
|
||||
MotionAction(current_value, this);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
#ifndef winslider_h
|
||||
#define winslider_h
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include "WinBase.h"
|
||||
|
||||
class WinSlider: public WinBase
|
||||
{
|
||||
public:
|
||||
float min_value;
|
||||
float max_value;
|
||||
float current_value;
|
||||
|
||||
void (*MotionAction)(float new_location, WinSlider *which);
|
||||
|
||||
WinSlider(WinBase *Parent, int w, int h, int x, int y,
|
||||
float min_val=0, float max_val=100,
|
||||
float init_val=50);
|
||||
~WinSlider();
|
||||
|
||||
void SetMinValue(float new_val);
|
||||
void SetMaxValue(float new_val);
|
||||
void SetCurrentValue(float new_val);
|
||||
void UpdatePosition(int newx, int newy);
|
||||
void SetMotionAction(void (*NewMotionAction)(float new_location,
|
||||
WinSlider *which));
|
||||
void DrawCallback(XEvent *event = NULL);
|
||||
void BPressCallback(XEvent *event = NULL);
|
||||
void BReleaseCallback(XEvent *event = NULL);
|
||||
void MotionCallback(XEvent *event = NULL);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,93 +0,0 @@
|
||||
#include <iostream.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "WinBase.h"
|
||||
#include "WinButton.h"
|
||||
|
||||
WinText::WinText(WinBase *Parent, int new_w,int new_h,
|
||||
int new_x, int new_y, char *new_label):
|
||||
WinBase(Parent,new_w, new_h, new_x,new_y)
|
||||
{
|
||||
XSetWindowAttributes attributes; /* attributes for creating window */
|
||||
unsigned long mask;
|
||||
|
||||
label = new_label;
|
||||
mask = CWBackPixel | CWEventMask;
|
||||
attributes.background_pixel = BackColor;
|
||||
attributes.event_mask = ExposureMask;
|
||||
twin = XCreateWindow(dpy,win,bw,bw,w-2*bw,h-2*bw,0,
|
||||
CopyFromParent,InputOutput,CopyFromParent,
|
||||
mask,&attributes);
|
||||
XMapWindow(dpy,twin);
|
||||
RegisterWindow(twin,this);
|
||||
}
|
||||
|
||||
WinText::~WinText()
|
||||
{
|
||||
}
|
||||
|
||||
void WinText::SetLabel(char *new_label)
|
||||
{
|
||||
label = new_label;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WinText::DrawCallback(XEvent *event)
|
||||
{
|
||||
int xoff,yoff;
|
||||
GC gc1;
|
||||
GC gc2;
|
||||
|
||||
WinBase::DrawCallback(event);
|
||||
if(((!event)||(event->xexpose.count == 0))&&(label != NULL))
|
||||
{
|
||||
xoff = (w - XTextWidth(Font,label,strlen(label)))/2;
|
||||
yoff = h - 1 - (h - Font->ascent - Font->descent)/2 -Font->descent;
|
||||
XDrawString(dpy,twin,ForeGC, xoff-bw,yoff-bw,label,strlen(label));
|
||||
}
|
||||
}
|
||||
|
||||
void WinText::ResizeCallback(int new_w, int new_h, XEvent *event)
|
||||
{
|
||||
w = new_w;
|
||||
h = new_h;
|
||||
XResizeWindow(dpy,twin,new_w-2*bw,new_h-2*bw);
|
||||
RedrawWindow(1);
|
||||
}
|
||||
|
||||
void WinText::SetBevelWidth(int new_bw)
|
||||
{
|
||||
bw = new_bw;
|
||||
XMoveResizeWindow(dpy,twin,bw,bw,w-2*bw,h-2*bw);
|
||||
RedrawWindow(1);
|
||||
}
|
||||
|
||||
|
||||
void WinText::SetBackColor(char *newcolor = DEFAULT_BACKCOLOR)
|
||||
{
|
||||
XSetWindowAttributes attributes; /* attributes for creating window */
|
||||
unsigned long mask;
|
||||
|
||||
mask = CWBackPixel;
|
||||
attributes.background_pixel = BackColor;
|
||||
XChangeWindowAttributes(dpy,twin, mask,&attributes);
|
||||
XClearWindow(dpy,twin);
|
||||
XChangeWindowAttributes(dpy,win, mask,&attributes);
|
||||
XClearWindow(dpy,win);
|
||||
}
|
||||
|
||||
void WinText::RedrawWindow(int clear)
|
||||
{
|
||||
if(clear)
|
||||
{
|
||||
XClearWindow(dpy,win);
|
||||
XClearWindow(dpy,twin);
|
||||
}
|
||||
DrawCallback(NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#ifndef wintext_h
|
||||
#define wintext_h
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include "WinBase.h"
|
||||
|
||||
class WinText: public WinBase
|
||||
{
|
||||
public:
|
||||
char *label;
|
||||
Window twin;
|
||||
|
||||
WinText(WinBase *Parent, int w, int h, int x, int y, char *label);
|
||||
~WinText();
|
||||
|
||||
void SetLabel(char *new_label);
|
||||
void SetBackColor(char *newcolor);
|
||||
void DrawCallback(XEvent *event = NULL);
|
||||
virtual void ResizeCallback(int new_w, int new_h, XEvent *event = NULL);
|
||||
void SetBevelWidth(int bw);
|
||||
void RedrawWindow(int clear);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,19 +0,0 @@
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* SIGPIPE handler - SIGPIPE means fvwm is dying
|
||||
*
|
||||
***********************************************************************/
|
||||
void DeadPipe(int nonsense)
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
void SetupPipeHandler(void)
|
||||
{
|
||||
signal(SIGPIPE,DeadPipe);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
# open big xterm
|
||||
*FvwmConsoleSubst '^bigx' 'Exec xterm -g 120x60+0+0 -fn 10x20 -fg black -bg lemonchiffon'
|
||||
|
||||
*FvwmConsoleSubst '^fb' 'FvwmButtons'
|
||||
|
||||
# jump to desk 0, page 0 <argument>, and focus
|
||||
*FvwmConsoleSubst '^g\s*(\d+)' 'Desk 0 0\nGotoPage 0 $1 \nFocus'
|
||||
|
||||
# open xterm with console
|
||||
*FvwmConsoleSubst '^XC' 'Exec xterm -g 40x6-0+200 -fn 7x14 -C &'
|
||||
|
||||
# open xterm with console and FvwmConsole - XCF at the begining
|
||||
*FvwmConsoleSubst '^XCF' 'FvwmConsole -C -e /usr/lib/X11/fvwm2/FvwmConsoleC.pl'
|
||||
|
||||
# list functions
|
||||
*FvwmConsoleKey \mc list_func
|
||||
|
||||
# execute last command - meta cntrol a
|
||||
*FvwmConsoleKey \m\ca 'prev_line(); enter();'
|
||||
|
||||
# some common style
|
||||
# substitute BARE with non-word char surrounding it to bare window style
|
||||
*FvwmConsoleSubst '(\W)BARE($|\W)' '$1NoTitle, NoHandles, Sticky, WindowListSkip, Borderwidth 0 '
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
Changes on 1.3
|
||||
-- 02/05/97 --
|
||||
-- 08/22/97 -- 1.3.1
|
||||
-- 08/28/97 -- 1.3.2
|
||||
|
||||
1. moved socket in home directory from /tmp in order to avoid
|
||||
remote chance of connecting to somebody else's fvwm (this
|
||||
could be interesting).
|
||||
2. command history is kept in a file from the previous session.
|
||||
3. The maximum command length is now 1000, up from 255.
|
||||
This should be used with fvwm2 with this limit (greater than
|
||||
but not equal to 2.0.45). Long module path and such can be
|
||||
input now.
|
||||
4. FvwmConsoleC.pl (1.2) looks slightly smoother. (08/22/97)
|
||||
|
||||
With patch from Paul D Smith
|
||||
|
||||
1. changed ADD_INCLUDE variable to EXTRA_INCLUDES in Imakefile.
|
||||
2. changed the man page. It makes sense now!
|
||||
3. added Tab key binding as tab insertion to make cut-and-
|
||||
paste easier.
|
||||
4. Handles backslashed command lines. Long lines are hard to
|
||||
type and hard to read.
|
||||
|
||||
With patch from Al Bolduc (08/28/97)
|
||||
|
||||
1. runs on BSD/OS which has another element in the sockaddr_un
|
||||
structure.
|
||||
|
||||
Changes on 1.2
|
||||
-- 08/22/96 ---
|
||||
|
||||
1. Deleted unneccessary defines and headers. The less, the better.
|
||||
2. Changed maximum command size to 255 to prevent module
|
||||
termination.
|
||||
3. One less process. The less , the better.
|
||||
|
||||
Changes on 1.1
|
||||
|
||||
1. Fixed the bug that didn't allocate enough memory for the child
|
||||
process arguments.
|
||||
|
||||
2. Get module configuration from Fvwm and pass them to the
|
||||
client.
|
||||
|
||||
Changes on FvwmConsoleC.pl 1.1
|
||||
|
||||
1. Added substitution and other editing functions.
|
||||
|
||||
2. Keybindings can be configured through module configuration.
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
.\" t
|
||||
.\" @(#)FvwmConsole.1x 7/16/96
|
||||
.TH FvwmConsole 1x "July 16 1996"
|
||||
.UC
|
||||
|
||||
.SH NAME
|
||||
FvwmConsole \- an FVWM command input interface
|
||||
|
||||
.SH SYNOPSIS
|
||||
FvwmConsole is spawned by fvwm, so no command line invocation will work.
|
||||
|
||||
.SH DESCRIPTION
|
||||
FvwmConsole allows the user to type fvwm configuration commands
|
||||
interactively, and have them executed immediately. This tool is
|
||||
particularly useful for testing new configuration ideas, or for
|
||||
implementing temporary changes to your environment.
|
||||
|
||||
.SH INVOCATION
|
||||
FvwmConsole must be spawned as a module by fvwm. FvwmConsole takes all
|
||||
\fIxterm\fP(1) options, except -name and -title.
|
||||
.PP
|
||||
FvwmConsole can be invoked by inserting the line 'Module FvwmConsole' in
|
||||
the .fvwm2rc file. This can be placed on a line by itself, if
|
||||
FvwmConsole is to be spawned during fvwm's initialization, or can be
|
||||
bound to a menu or mouse button or keystroke to invoke it later. Fvwm
|
||||
will search directory specified in the ModulePath configuration option
|
||||
to attempt to locate FvwmConsole.
|
||||
|
||||
.SH CONFIGURATION OPTIONS
|
||||
FvwmConsole uses \fIxterm\fP(1). All resources set for xterm are
|
||||
inherited unless overridden by command line options.
|
||||
|
||||
.RS
|
||||
Module FvwmConsole -g 40x10 -fg black -bg green3
|
||||
.RE
|
||||
|
||||
The option -e can be used to choose an alternate front-end:
|
||||
|
||||
.RS
|
||||
Module FvwmConsole -e /usr/X11/lib/fvwm2/FvwmConsoleC.pl
|
||||
.RE
|
||||
|
||||
(see \fIFvwmConsoleC.pl\fP(1)).
|
||||
.PP
|
||||
Also X resources can be set in your ~/.Xdefaults file:
|
||||
|
||||
.RS
|
||||
FvwmConsole*VT100*geometry: 40x4
|
||||
.br
|
||||
FvwmConsole*font: 7x14
|
||||
.RE
|
||||
|
||||
|
||||
.SH "COMMAND EDITING"
|
||||
|
||||
There are a few options. If the GNU readline library is available, it
|
||||
can be used.
|
||||
.PP
|
||||
If Perl5 is installed, FvwmConsoleC.pl can be used as a command editor.
|
||||
This can be accomplished by either copying FvwmConsoleC.pl
|
||||
to fvwmlib directory as FvwmConsoleC or
|
||||
invoking FvwmConsole with -e option.
|
||||
For example:
|
||||
|
||||
.RS
|
||||
Module FvwmConsole -e /usr/lib/X11/fvwm2/FvwmConsoleC.pl
|
||||
.RE
|
||||
|
||||
If neither one is installed, a simple input reading function which
|
||||
doesn't have editing capabilities is used.
|
||||
.P
|
||||
GNU readline and FvwmConsoleC.pl have some frequent used commands
|
||||
in common as default.
|
||||
These commands are similar to emacs.
|
||||
For more details, refer GNU readline man and info pages, and
|
||||
FvwmConsoleC.pl man page.
|
||||
|
||||
.RS
|
||||
.PD 0
|
||||
.TP 8
|
||||
Cntl-A
|
||||
- beginning of line
|
||||
.TP
|
||||
Cntl-B
|
||||
- previous char
|
||||
.TP
|
||||
Cntl-D
|
||||
- delete char
|
||||
.TP
|
||||
Cntl-E
|
||||
- end of line
|
||||
.TP
|
||||
Cntl-F
|
||||
- next char
|
||||
.TP
|
||||
Cntl-H
|
||||
- backspace
|
||||
.TP
|
||||
Cntl-K
|
||||
- erase to the end of line
|
||||
.TP
|
||||
Cntl-N
|
||||
- next line
|
||||
.TP
|
||||
Cntl-P
|
||||
- previous line
|
||||
.TP
|
||||
Cntl-R
|
||||
- search reverse
|
||||
.TP
|
||||
Cntl-U
|
||||
- delete line
|
||||
.TP
|
||||
Meta-B
|
||||
- previous word
|
||||
.TP
|
||||
Meta-F
|
||||
- next word
|
||||
.TP
|
||||
Esc <
|
||||
- beginning of history
|
||||
.TP
|
||||
Esc >
|
||||
- end of history
|
||||
.RE
|
||||
.PD
|
||||
|
||||
.SH EXITING
|
||||
|
||||
FvwmConsole can be stopped by entering the command "killme" at the command
|
||||
line, or the EOF character (usually CTRL-D).
|
||||
.PP
|
||||
\fBNote!\fP Do not use the "quit" command, as this is an fvwm builtin:
|
||||
typing "quit" at the FvwmConsole command line will cause fvwm to exit.
|
||||
|
||||
.SH COPYRIGHTS
|
||||
Copyright 1996, Toshi Isogai. No guarantees or warranties are provided.
|
||||
Use this program at your own risk. Permission to use this program for
|
||||
any purpose is given, as long as the copyright is kept intact.
|
||||
|
||||
.SH SEE ALSO
|
||||
\fIxterm\fP(1), \fIFvwmConsoleC.pl\fP(1), GNU Readline library
|
||||
|
||||
.SH AUTHOR
|
||||
Toshi Isogai
|
||||
@@ -1,246 +0,0 @@
|
||||
/*
|
||||
Fvwm command input interface.
|
||||
|
||||
Copyright 1996, Toshi Isogai. No guarantees or warantees or anything
|
||||
are provided. Use this program at your own risk. Permission to use
|
||||
this program for any purpose is given,
|
||||
as long as the copyright is kept intact.
|
||||
*/
|
||||
|
||||
#include "FvwmConsole.h"
|
||||
|
||||
#define MYVERSION "1.3"
|
||||
|
||||
char *MyName;
|
||||
|
||||
int Fd[2]; /* pipe to fvwm */
|
||||
int Ns; /* socket handles */
|
||||
char Name[80]; /* name of this program in executable format */
|
||||
char *S_name; /* socket name */
|
||||
|
||||
void server( void );
|
||||
void DeadPipe( int );
|
||||
void CloseSocket();
|
||||
void ErrMsg( char *msg );
|
||||
void SigHandler( int );
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
char *tmp, *s;
|
||||
char client[120];
|
||||
char **eargv;
|
||||
int i,j,k;
|
||||
char *xterm_a[] = { "-title", Name, "-name", Name, "-e", NULL, NULL };
|
||||
int clpid;
|
||||
|
||||
/* Why is this not just put in the initializer of xterm_a?
|
||||
Apparently, it is a non-standard extension to use a non-constant address (of client)
|
||||
in an initializer (of xterm_a). */
|
||||
xterm_a[5] = client;
|
||||
|
||||
/* Save the program name - its used for error messages and option parsing */
|
||||
tmp = argv[0];
|
||||
|
||||
s=strrchr(argv[0], '/');
|
||||
if (s != NULL)
|
||||
tmp = s + 1;
|
||||
|
||||
strcpy( Name, tmp );
|
||||
|
||||
MyName = safemalloc(strlen(tmp)+2);
|
||||
strcpy(MyName,"*");
|
||||
strcat(MyName, tmp);
|
||||
|
||||
/* construct client's name */
|
||||
strcpy( client, argv[0] );
|
||||
strcat( client, "C" );
|
||||
|
||||
if(argc < FARGS) {
|
||||
fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",MyName,
|
||||
MYVERSION);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if( ( eargv =(char **)safemalloc((argc+12)*sizeof(char *)) ) == NULL ) {
|
||||
ErrMsg( "allocation" );
|
||||
}
|
||||
|
||||
/* copy arguments */
|
||||
eargv[0] = XTERM;
|
||||
j = 1;
|
||||
for ( i=FARGS ; i<argc; i++ ) {
|
||||
if( !strcmp ( argv[i], "-e" ) ) {
|
||||
i++;
|
||||
break;
|
||||
} else {
|
||||
eargv[j++] = argv[i];
|
||||
}
|
||||
}
|
||||
|
||||
for ( k=0 ; xterm_a[k] != NULL ; j++, k++ ) {
|
||||
eargv[j] = xterm_a[k];
|
||||
}
|
||||
|
||||
/* copy rest of -e args */
|
||||
for( ; i<argc; i++, j++ ) {
|
||||
eargv[j-1] = argv[i];
|
||||
}
|
||||
|
||||
eargv[j] = NULL;
|
||||
|
||||
/* Dead pipes mean fvwm died */
|
||||
signal (SIGPIPE, DeadPipe);
|
||||
signal (SIGINT, SigHandler);
|
||||
signal (SIGQUIT, SigHandler);
|
||||
|
||||
Fd[0] = atoi(argv[1]);
|
||||
Fd[1] = atoi(argv[2]);
|
||||
|
||||
/* launch xterm with client */
|
||||
clpid = fork();
|
||||
if( clpid < 0) {
|
||||
ErrMsg("client forking");
|
||||
}else if(clpid == 0 ) {
|
||||
execvp( *eargv, eargv );
|
||||
ErrMsg("exec");
|
||||
}
|
||||
|
||||
server();
|
||||
return (0);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* signal handler
|
||||
***********************************************************************/
|
||||
void DeadPipe( int dummy ) {
|
||||
fprintf(stderr,"%s: dead pipe\n", Name);
|
||||
CloseSocket();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void SigHandler(int dummy) {
|
||||
CloseSocket();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*********************************************************/
|
||||
/* close sockets and spawned process */
|
||||
/*********************************************************/
|
||||
void CloseSocket() {
|
||||
send(Ns, C_CLOSE, strlen(C_CLOSE), 0);
|
||||
close(Ns); /* remove the socket */
|
||||
unlink( S_name );
|
||||
|
||||
}
|
||||
|
||||
/*********************************************************/
|
||||
/* setup server and communicate with fvwm and the client */
|
||||
/*********************************************************/
|
||||
void server ( void ) {
|
||||
struct sockaddr_un sas, csas;
|
||||
int len, clen; /* length of sockaddr */
|
||||
char buf[MAX_COMMAND_SIZE]; /* command line buffer */
|
||||
char *tline;
|
||||
char ver[40];
|
||||
fd_set fdset;
|
||||
unsigned long *body;
|
||||
unsigned long header[HEADER_SIZE];
|
||||
char *home;
|
||||
int s;
|
||||
int msglen;
|
||||
|
||||
/* make a socket */
|
||||
if( (s = socket(AF_UNIX, SOCK_STREAM, 0 )) < 0 ) {
|
||||
ErrMsg( "socket");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* name the socket */
|
||||
home = getenv("HOME");
|
||||
S_name = safemalloc( strlen(home)+ 16);
|
||||
strcpy(S_name,home);
|
||||
strcat(S_name,S_NAME);
|
||||
|
||||
sas.sun_family = AF_UNIX;
|
||||
strcpy( sas.sun_path, S_name );
|
||||
|
||||
/* bind the above name to the socket */
|
||||
/* first, erase the old socket */
|
||||
unlink( S_name );
|
||||
len = sizeof(sas) - sizeof( sas.sun_path) + strlen( sas.sun_path );
|
||||
|
||||
if( bind(s, (struct sockaddr *)&sas,len) < 0 ) {
|
||||
ErrMsg( "bind" );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* listen to the socket */
|
||||
/* set backlog to 5 */
|
||||
if ( listen(s,5) < 0 ) {
|
||||
ErrMsg( "listen" );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* accept connections */
|
||||
clen = sizeof(csas);
|
||||
if(( Ns = accept(s, (struct sockaddr *)&csas, &clen)) < 0 ) {
|
||||
ErrMsg( "accept");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* send config lines to Client */
|
||||
tline = NULL;
|
||||
send(Ns, C_BEG, strlen(C_BEG), 0);
|
||||
GetConfigLine(Fd,&tline);
|
||||
while(tline != NULL) {
|
||||
if(strlen(tline)>1) {
|
||||
send(Ns, tline, strlen(tline),0);
|
||||
}
|
||||
GetConfigLine(Fd,&tline);
|
||||
}
|
||||
send(Ns, C_END, strlen(C_END), 0);
|
||||
strcpy( ver, MyName);
|
||||
strcat( ver, " Ver. " );
|
||||
strcat( ver, MYVERSION);
|
||||
strcat( ver, "\n" );
|
||||
send(Ns, ver, strlen(ver), 0 );
|
||||
|
||||
while (1){
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(Ns, &fdset);
|
||||
FD_SET(Fd[1], &fdset);
|
||||
|
||||
select(FD_SETSIZE,SELECT_TYPE_ARG234 &fdset, 0, 0, NULL);
|
||||
if (FD_ISSET(Fd[1], &fdset)){
|
||||
if( ReadFvwmPacket(Fd[1],header,&body) > 0) {
|
||||
if(header[1] == M_PASS) {
|
||||
msglen = strlen((char *)&body[3]);
|
||||
if( msglen > MAX_MESSAGE_SIZE-2 ) {
|
||||
msglen = MAX_MESSAGE_SIZE-2;
|
||||
}
|
||||
send( Ns, (char *)&body[3], msglen, 0 );
|
||||
}
|
||||
free(body);
|
||||
}
|
||||
}
|
||||
if (FD_ISSET(Ns, &fdset)){
|
||||
if( recv( Ns, buf, MAX_COMMAND_SIZE,0 ) == 0 ) {
|
||||
/* client is terminated */
|
||||
break;
|
||||
}
|
||||
|
||||
/* process the own unique commands */
|
||||
SendText(Fd,buf,0); /* send command */
|
||||
}
|
||||
}
|
||||
CloseSocket();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/******************************************/
|
||||
/* print error message on stderr and exit */
|
||||
/******************************************/
|
||||
void ErrMsg( char *msg ) {
|
||||
fprintf( stderr, "%s server error in %s, errno %d\n", Name, msg, errno );
|
||||
CloseSocket();
|
||||
exit(1);
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if HAVE_SYS_BSDTYPES_H
|
||||
#include <sys/bsdtypes.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "fvwmlib.h"
|
||||
#include "../../fvwm/module.h"
|
||||
|
||||
#define S_NAME "/.FvConSocket"
|
||||
/* Prompts for readline support */
|
||||
#define PS1 ""
|
||||
#define PS2 ">"
|
||||
|
||||
#define HISTSIZE 50 /* readline history file size */
|
||||
#define HISTFILE "/.FvConHist"
|
||||
|
||||
/* #define M_PASS M_ERROR */
|
||||
#define M_PASS M_ERROR
|
||||
|
||||
/* number of default arguments when invoked from fvwm */
|
||||
#define FARGS 6
|
||||
|
||||
#define XTERM "xterm"
|
||||
|
||||
/* message to client */
|
||||
#define C_BEG "_C_Config_Line_Begin_\n"
|
||||
#define C_END "_C_Config_Line_End_\n"
|
||||
#define C_CLOSE "_C_Socket_Close_\n"
|
||||
|
||||
#define MAX_COMMAND_SIZE 1000
|
||||
#define MAX_MESSAGE_SIZE 260
|
||||
@@ -1,114 +0,0 @@
|
||||
#include "FvwmConsole.h"
|
||||
|
||||
int s; /* socket handle */
|
||||
FILE *sp;
|
||||
char *name; /* name of this program at executing time */
|
||||
char *get_line();
|
||||
|
||||
|
||||
/******************************************/
|
||||
/* close socket and exit */
|
||||
/******************************************/
|
||||
void sclose () {
|
||||
fclose(sp);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/************************************/
|
||||
/* print error message on stderr */
|
||||
/************************************/
|
||||
void ErrMsg( char *msg ) {
|
||||
fprintf( stderr, "%s error in %s\n", name , msg );
|
||||
fclose(sp);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************/
|
||||
/* setup socket. */
|
||||
/* send command to and receive message from the server */
|
||||
/*******************************************************/
|
||||
int main ( int argc, char *argv[]) {
|
||||
char *cmd;
|
||||
unsigned char data[MAX_MESSAGE_SIZE];
|
||||
int len; /* length of socket address */
|
||||
struct sockaddr_un sas;
|
||||
int clen; /* command length */
|
||||
int pid; /* child process id */
|
||||
char *home;
|
||||
char *s_name;
|
||||
|
||||
signal (SIGINT, sclose);
|
||||
signal (SIGQUIT, sclose);
|
||||
|
||||
name=strrchr(argv[0], '/');
|
||||
if (name != NULL) {
|
||||
name++;
|
||||
}
|
||||
|
||||
/* make a socket */
|
||||
home = getenv("HOME");
|
||||
s_name = safemalloc( strlen(home)+ 14);
|
||||
strcpy(s_name,home);
|
||||
strcat(s_name,S_NAME);
|
||||
if( (s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0 ) {
|
||||
ErrMsg ("socket");
|
||||
}
|
||||
|
||||
/* name the socket and obtain the size of it*/
|
||||
sas.sun_family = AF_UNIX;
|
||||
strcpy( sas.sun_path, s_name );
|
||||
len = sizeof(sas) - sizeof( sas.sun_path) + strlen( sas.sun_path );
|
||||
|
||||
if( connect( s, (struct sockaddr *)&sas, len )< 0 ) {
|
||||
ErrMsg( "connect" );
|
||||
}
|
||||
|
||||
sp = fdopen( s, "r" );
|
||||
|
||||
pid = fork();
|
||||
if( pid == -1 ) {
|
||||
ErrMsg( "fork");
|
||||
}
|
||||
if( pid == 0 ) {
|
||||
/* loop of get user's command and send it to server */
|
||||
while( 1 ) {
|
||||
|
||||
cmd = get_line();
|
||||
if (cmd == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
clen = strlen(cmd);
|
||||
if( clen == 1 ) {
|
||||
continue; /* empty line */
|
||||
}
|
||||
|
||||
/* send the command including null to the server */
|
||||
send( s, cmd, strlen(cmd)+1, 0 );
|
||||
|
||||
}
|
||||
kill( getppid(), SIGKILL );
|
||||
sclose();
|
||||
}
|
||||
while( fgets( data, MAX_MESSAGE_SIZE, sp ) ) {
|
||||
/* get the response */
|
||||
/* ignore config lines */
|
||||
if( !strcmp( data, C_BEG ) ) {
|
||||
while( fgets( data, MAX_MESSAGE_SIZE, sp) ) {
|
||||
if( *data == '\0' || !strcmp(data,C_END) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( *data != '\0' ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if( *data == '\0' ) {
|
||||
break;
|
||||
}
|
||||
printf( "%s",data );
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -1,869 +0,0 @@
|
||||
#!/usr/local/bin/perl
|
||||
# $0 - Front end of FvwmConsole
|
||||
# FvwmConsole server must be running
|
||||
|
||||
# Copyright 1997, Toshi Isogai
|
||||
# You may use this code for any purpose, as long as the original
|
||||
# copyright remains in the source code and all documentation
|
||||
|
||||
require 5.002;
|
||||
use Socket;
|
||||
|
||||
$ESC = "\e";
|
||||
$HISTFILE = "$ENV{HOME}/.FvConHist0";
|
||||
$SOCKET_NAME = "$ENV{HOME}/.FvConSocket";
|
||||
$VERSION = '1.2';
|
||||
|
||||
|
||||
|
||||
if( -c "/dev/console" ) {
|
||||
close STDERR;
|
||||
open (STDERR,">/dev/console") || die "/dev/console: ",$!;
|
||||
}
|
||||
|
||||
($Filename = $0) =~ s@.*/@@;
|
||||
($Sname = $Filename) =~ s/C(\.pl)?$//;
|
||||
|
||||
|
||||
$tty = `tty`;
|
||||
$tty =~ s/\n//;
|
||||
$org_stty = &stty('-g');
|
||||
|
||||
@Hist = ();
|
||||
@Histall = ();
|
||||
$HIST_SIZE = 50;
|
||||
$MAX_COMMAND_SIZE = 1000;
|
||||
|
||||
main();
|
||||
exit;
|
||||
|
||||
|
||||
sub main::default_key {
|
||||
#------------ default key bindings ----------
|
||||
# these can be overidden by config lines
|
||||
#
|
||||
# It may need these lines in .Xdefault to make home and end key work
|
||||
# FvwmConsole*VT100*Translations: #override \n \
|
||||
# <Key> Home: string(0x1b) string("[1~" ) \n \
|
||||
# <Key> Delete: string(0x1b) string("[3~" ) \n
|
||||
# <Key> End: string(0x1b) string("[4~" ) \n
|
||||
|
||||
package User;
|
||||
|
||||
$ESC = $main::ESC;
|
||||
$Key{"$ESC\[1~"} = 'bol'; #home Key
|
||||
$Key{"$ESC\[3~"} = 'del_char';
|
||||
$Key{"$ESC\[4~"} = 'eol'; #end key
|
||||
$Key{"$ESC\[A"}= 'prev_line'; #up
|
||||
$Key{"$ESC\[B"}= 'next_line'; #down
|
||||
$Key{"$ESC\[C"}= 'next_char'; #right
|
||||
$Key{"$ESC\[D"}= 'prev_char'; #left
|
||||
$Key{"${ESC}f"}= 'next_word';
|
||||
$Key{"${ESC}b"} = 'prev_word';
|
||||
|
||||
$Key{"$ESC"} = 'prefix';
|
||||
$Key{"\cD"} = 'del_char';
|
||||
$Key{"\c?"} = 'del_char';
|
||||
$Key{"\cH"} = 'bs';
|
||||
$Key{"\cq"} = 'quote';
|
||||
$Key{"\cU"} = 'del_line';
|
||||
$Key{"\cs"} = 'search';
|
||||
$Key{"\cR"} = 'search_rev';
|
||||
$Key{"\cK"} = 'del_forw_line';
|
||||
$Key{"\ca"} = 'bol';
|
||||
$Key{"\ce"} = 'eol';
|
||||
$Key{"\cp"} = 'prev_line';
|
||||
$Key{"\cn"} = 'next_line';
|
||||
$Key{"\cf"} = 'next_char';
|
||||
$Key{"\cb"} = 'prev_char';
|
||||
$Key{"\cx"} = 'prefix';
|
||||
$Key{"\cx\cb"} = 'bind';
|
||||
$Key{"\cx\ck"} = 'cancel';
|
||||
$Key{"\cw"} = 'del_back_word';
|
||||
$Key{"\x8d"} = 'enter_wo_subst'; # alt enter
|
||||
$Key{"\n"} = 'enter';
|
||||
$Key{"\ci"} = 'ins_char (" ")';
|
||||
$Key{"\xE4"} = 'del_forw_word'; # alt_d
|
||||
$Key{"\xE6"} = 'next_word'; # alt_f
|
||||
$Key{"\xEB"} = 'bind'; # alt_k
|
||||
$Key{"\xEC"} = 'list_func'; # alt_k
|
||||
$Key{"\xF3"} = 'subst'; # alt_s
|
||||
$Key{"\xF4"} = 'termsize'; # alt_t
|
||||
$Key{"\xE2"} = 'prev_word'; # alt_b
|
||||
$Key{"\xb1"} = 'ins_nth_word(1)';
|
||||
$Key{"\xb2"} = 'ins_nth_word(2)';
|
||||
$Key{"\xb3"} = 'ins_nth_word(3)';
|
||||
$Key{"\xb4"} = 'ins_nth_word(4)';
|
||||
$Key{"\xb5"} = 'ins_nth_word(5)';
|
||||
$Key{"\xb6"} = 'ins_nth_word(6)';
|
||||
$Key{"\xb7"} = 'ins_nth_word(7)';
|
||||
$Key{"\xb8"} = 'ins_nth_word(8)';
|
||||
$Key{"\xb9"} = 'ins_nth_word(9)';
|
||||
$Key{"${ESC}b"} = 'prev_word'; # esc_b
|
||||
$Key{"${ESC}f"} = 'next_word'; # esc_f
|
||||
$Key{"${ESC}>"} = 'eoh_ign_mode'; # end of history, ignore mode
|
||||
$Key{"${ESC}<"} = 'boh_ign_mode'; # begining of history, ignore mode
|
||||
$Key{"${ESC}."} = 'ins_last_word';
|
||||
|
||||
$Key{EOF} = "\cD"; #eof work only when line is empty
|
||||
$Subst{'^#.*'} = ''; # ignore comments
|
||||
#---------------- end of key binding -----------------
|
||||
|
||||
#---------------- Terminal control -------------------
|
||||
$TERM_EEOL = "$ESC\[K"; # erase to end of line
|
||||
$TERM_RIGHT = "$ESC\[C"; # move cursor right
|
||||
$TERM_LEFT = "$ESC\[D"; # move cursor left
|
||||
$TERM_DOWN = "$ESC\[B"; # move cursor up
|
||||
$TERM_UP = "$ESC\[A"; # move cursor up
|
||||
}
|
||||
|
||||
sub read_config {
|
||||
my( $hash,@keys,$key,@vals,$val);
|
||||
while(<SH>) {
|
||||
last if $_ eq "_C_Config_Line_End_\n";
|
||||
next if !s/^\*${Sname}//;
|
||||
($hash,@keys[0..3],@vals) =
|
||||
(/
|
||||
^(\w+)\s+ #hash name
|
||||
('([^\']*)'|"([^\"]*)"|(\S+)) #key quoted or bare word
|
||||
(\s+('([^\']*)'|"([^\"]*)"|(\S+)))? #value
|
||||
/x);
|
||||
$key = $keys[1].$keys[2].$keys[3];
|
||||
$val = $vals[2].$vals[3].$vals[4];
|
||||
|
||||
if( defined %{$User::{$hash}} ) {
|
||||
User::bind( $hash, $key, $val );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub main {
|
||||
my($sin, $cmd);
|
||||
my($name, $ppid, $cpid);
|
||||
|
||||
socket(SH, PF_UNIX, SOCK_STREAM, 0) || die "$! ";
|
||||
$sun = sockaddr_un($SOCKET_NAME);
|
||||
connect(SH,$sun) || die "$sun:", $!;
|
||||
print "$Filename $VERSION\n";
|
||||
default_key();
|
||||
read_config(); #must be done before forking
|
||||
|
||||
$ppid = $$;
|
||||
if( $cpid = fork() ) {
|
||||
&input_open($tty,$tty,$HISTFILE,1);
|
||||
while( $cmd = &input('','',1) ) {
|
||||
next if $cmd =~/^\s*$/;
|
||||
last if $cmd eq "\0";
|
||||
if( length($cmd) > $MAX_COMMMAND_SIZE ) {
|
||||
print User::OUT "\a";
|
||||
}
|
||||
send( SH, $cmd."\0", 0 );
|
||||
}
|
||||
dokill( $cpid );
|
||||
} else {
|
||||
#child handles output
|
||||
while(<SH>) {
|
||||
last if $_ eq '';
|
||||
if( $_ eq "_C_Socket_Close_\n" ) {
|
||||
dokill( $ppid );
|
||||
}
|
||||
print;
|
||||
}
|
||||
dokill( $ppid );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub dokill {
|
||||
my($pid) = @_;
|
||||
unlink SH;
|
||||
kill -9,$pid if $pid;
|
||||
exit;
|
||||
}
|
||||
|
||||
sub input_open {
|
||||
# arg0 input device
|
||||
# arg1 output device
|
||||
# arg2 history file
|
||||
# arg3 key selection - bit0
|
||||
# bit1
|
||||
# bit2 return undef esc code as it is
|
||||
|
||||
($Dev_in,$Dev_out,$File,$Ksel) = @_;
|
||||
if( !$Dev_in ) {$Dev_in = $tty;}
|
||||
elsif( $Dev_in eq "not a tty" ) { $Dev_in = $ENV{'TTY'};}
|
||||
if( !$Dev_out ) {$Dev_out = $tty;}
|
||||
if( !$File ) { $File = '/tmp/input.tmp';}
|
||||
open(User::IN,"<$Dev_in") || die "open in at input_open '$Dev_in' $!\n";
|
||||
open(User::OUT,">$Dev_out") || die "can't open input at 'input_open' $!\n";
|
||||
select((select(User::OUT), $| = 1)[0]); # unbuffer pipe
|
||||
if( defined $File ) {
|
||||
if( open(INITF,"$File") ) {
|
||||
do "$File";
|
||||
@Histall=<INITF>; close(INITF); $#Histall--;
|
||||
}else{
|
||||
print STDERR "Can't open history file $File\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub input_close {
|
||||
close(User::IN);
|
||||
close(User::OUT);
|
||||
}
|
||||
|
||||
sub getchar {
|
||||
# get char from input
|
||||
# if esc , check for more char
|
||||
my($c,$s,$rin,$rout);
|
||||
sysread(User::IN, $c, 1);
|
||||
if( $c ne $ESC ) {
|
||||
$s = $c;
|
||||
}else {
|
||||
$rin = '';
|
||||
vec( $rin, fileno(User::IN),1) = 1;
|
||||
$n= select( $rout=$rin, undef, undef, 0.1 );
|
||||
$s = $ESC;
|
||||
if($n) {
|
||||
while($n= select( $rout=$rin, undef, undef, 0.1 ) ) {
|
||||
sysread( User::IN, $c, 1 );
|
||||
$s .= $c;
|
||||
last if $c =~ /[A-Dz~]/; # end of escape seq
|
||||
}
|
||||
}
|
||||
}
|
||||
$s;
|
||||
}
|
||||
|
||||
sub insert_char {
|
||||
local($c,*len,*ix,*hist) =@_;
|
||||
local($clen);
|
||||
$clen = length $c;
|
||||
if( $init_in ) {
|
||||
$len = $ix = $clen; # new hist - clear old one
|
||||
$hist[$#hist] = $c;
|
||||
}else{
|
||||
substr($hist[$#hist],$ix,0) = $c; #insert char
|
||||
$len += $clen;
|
||||
$ix += $clen;
|
||||
}
|
||||
}
|
||||
sub stty {
|
||||
my($arg) = @_;
|
||||
`/bin/stty $arg <$tty 2>&1`;
|
||||
# if( -x "/usr/5bin/stty" ) {
|
||||
# `/usr/5bin/stty $arg <$tty`;
|
||||
# }elsif( -x "/usr/bin/stty" ) {
|
||||
# `/usr/bin/stty $arg `;
|
||||
# }else {
|
||||
# `/bin/stty $arg `;
|
||||
# }
|
||||
}
|
||||
|
||||
sub add_hist {
|
||||
# add input into history file
|
||||
local($type,*cmd) = @_; #not my
|
||||
my( $t )= sprintf("%s",$type);
|
||||
my($h) = $cmd[$#cmd];
|
||||
return if !defined $File;
|
||||
if( $#cmd ==0 || $h ne $cmd[$#cmd-1] ) {
|
||||
$h =~ s/([\"@\$\\])/\\$1/g;
|
||||
$t =~ s/^\*//;
|
||||
push(@Histall, "push (\@$t, \"$h\");\n" );
|
||||
@Histall = splice( @Histall, -$HIST_SIZE, $HIST_SIZE ); # take last HIST_SIZE commands
|
||||
if( open( FILE, ">$File" ) ){
|
||||
print FILE @Histall;
|
||||
print FILE "1;\n";
|
||||
close(FILE);
|
||||
}
|
||||
}else {
|
||||
$#cmd--;
|
||||
}
|
||||
}
|
||||
|
||||
#----------------
|
||||
# print mini help
|
||||
#----------------
|
||||
sub usage_error {
|
||||
open( THIS, "$0");
|
||||
while(<THIS>) {
|
||||
s/\$0/$Filename/;
|
||||
if( /^\#/ ) {
|
||||
print STDERR $_;
|
||||
}else{
|
||||
last;
|
||||
}
|
||||
}
|
||||
close THIS;
|
||||
sleep 3;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
sub search_mode {
|
||||
local(*c, *s, *prompt, *mode, *isp, *hist ) =@_;
|
||||
my($p_save, $isp_cur);
|
||||
if($c eq "\n"){
|
||||
$prompt = $p_save;
|
||||
$mode = 'normal';
|
||||
last IN_STACK;
|
||||
}
|
||||
$isp_cur = $isp;
|
||||
if( $User::Key{$c} =~ /^search/ ) {
|
||||
#search furthur
|
||||
$mode = $User::Key{$c};
|
||||
while(1) {
|
||||
if( $mode eq 'search_rev' && --$isp<0 ||
|
||||
$mode eq 'search' && ++$isp>$#hist-1 ) {
|
||||
print User::OUT "\a"; # couldn't find one
|
||||
$isp = $isp_cur;
|
||||
last;
|
||||
}
|
||||
last if( index($hist[$isp],$s) >=0);
|
||||
}
|
||||
}elsif( $User::Key{$c} eq 'bs' ) {
|
||||
$s =~ s/.$//;
|
||||
}elsif( ord($c) < 32 ) {
|
||||
#non-printable char, get back to normal mode
|
||||
print User::OUT "\a";
|
||||
$prompt = $p_save;
|
||||
$mode = 'normal';
|
||||
return;
|
||||
}else{
|
||||
$s .= $c;
|
||||
while(1) {
|
||||
last if (index($hist[$isp],$s) >=0);
|
||||
if( $mode eq 'search_rev' && --$isp<0 ||
|
||||
$mode eq 'search' && ++$isp>$#hist ) {
|
||||
print User::OUT "\a"; #couldn't find one
|
||||
chop($s);
|
||||
$isp = $isp_cur;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
$prompt = "($mode)'$s':";
|
||||
}
|
||||
|
||||
sub calcxy {
|
||||
my( $mode, $prompt, $len, $ix, $off, $wd ) = @_;
|
||||
my($plen);
|
||||
my( $y_len, $y_ix, $col);
|
||||
my($adjust); # 1 when the last char is on right edge
|
||||
|
||||
$plen = length($prompt);
|
||||
$y_len = int (($plen+$len+$off) / $wd );
|
||||
$adjust = ( (($plen+$len+$off) % $wd == 0) && ($y_len > 0 )) ? 1:0;
|
||||
if( $mode =~ /^search/ ) {
|
||||
#move cursor to search string
|
||||
$y_ix = int (($plen-2+$off) / $wd );
|
||||
$col = ($plen-2+$off) % $wd;
|
||||
}else{
|
||||
#normal mode - move cursor back to $ix
|
||||
$y_ix = int (($plen+$ix+$off) / $wd );
|
||||
$col = ($plen+$ix+$off) % $wd;
|
||||
}
|
||||
($y_len, $y_ix, $col, $adjust);
|
||||
}
|
||||
|
||||
package User;
|
||||
|
||||
sub move_cursor {
|
||||
my($x,$y, $x_prev,$y_prev) = @_;
|
||||
my($termcode);
|
||||
|
||||
$termcode = '';
|
||||
if($y > $y_prev ) {
|
||||
$termcode = $TERM_DOWN x ($y-$y_prev);
|
||||
}elsif( $y < $y_prev ) {
|
||||
$termcode = $TERM_UP x ($y_prev-$y);
|
||||
}
|
||||
if( $x > $x_prev ) {
|
||||
$termcode .= $TERM_RIGHT x ($x-$x_prev);
|
||||
}elsif( $x < $x_prev ) {
|
||||
$termcode .= $TERM_LEFT x ($x_prev-$x);
|
||||
}
|
||||
print OUT $termcode;
|
||||
}
|
||||
|
||||
sub another_line {
|
||||
$init_in = 1-$app;
|
||||
($hist[$#hist] = $hist[$isp]) =~ s/\n//;
|
||||
$ix = length($hist[$#hist]);
|
||||
}
|
||||
|
||||
sub main::input {
|
||||
# arg0 - prompt
|
||||
# arg1 - input stack
|
||||
# arg2 - append input to command if 1
|
||||
# arg3 - # of column offset
|
||||
local($prompt,*hist,$app,$off) = @_;
|
||||
local($len,$ix);
|
||||
local($c,$isp,$s,$wisp);
|
||||
local($mode);
|
||||
local(%lastop);
|
||||
|
||||
local($init_in);
|
||||
local($print_line); #0-none, 1-whole, 2-from cursor
|
||||
my($y_ix,$y_ix0,$y_len,$wd,$ht,$col,$col0);
|
||||
my($term);
|
||||
my($init_in,$op);
|
||||
|
||||
$off = 0 if( !defined $off );
|
||||
*hist = *main::Hist if( ! defined @hist );
|
||||
$isp = ++$#hist ;
|
||||
$wisp = $isp;
|
||||
if( -f "/vmunix" ) {
|
||||
&main::stty("-echo -icanon min 1 time 0 stop ''");
|
||||
}else {
|
||||
&main::stty(" -echo -icanon eol \001 stop ''");
|
||||
}
|
||||
($ht,$wd) = &termsize();
|
||||
$y_ix = $y_len = 0;
|
||||
$mode = 'normal';
|
||||
another_line();
|
||||
$print_line = 1;
|
||||
|
||||
IN_STACK:while(1){
|
||||
|
||||
if( $print_line==0 ) {
|
||||
#just move cursor
|
||||
($y_len,$y_ix,$col,$adjust) =
|
||||
&main::calcxy($mode,$prompt,$len,$ix,$off,$wd);
|
||||
move_cursor( $col,$y_ix, $col0,$y_ix0);
|
||||
|
||||
}elsif($print_line==2 || $print_line==3 ) {
|
||||
# delete - print cursor to eol
|
||||
$len = length($hist[$#hist]);
|
||||
($y_len,$y_ix,$col,$adjust) =
|
||||
&main::calcxy($mode,$prompt,$len,$ix,$off,$wd);
|
||||
|
||||
if( $print_line==3 ) {
|
||||
# delete backward
|
||||
move_cursor( $col,$y_ix, $col0,$y_ix0);
|
||||
}
|
||||
|
||||
if( $y_len0 > $y_ix && ($adjust || $y_len0 > $y_len) ) {
|
||||
print( OUT "\n$TERM_EEOL" x ($y_len0-$y_ix),
|
||||
$TERM_UP x ($y_len0-$y_ix),
|
||||
"\r", $TERM_RIGHT x $col, );
|
||||
}
|
||||
print( OUT substr("$prompt$hist[$#hist]", $ix),
|
||||
$adjust ? '':$TERM_EEOL,
|
||||
"\r", $TERM_RIGHT x $col,
|
||||
$TERM_UP x ($y_len-$y_ix) ,
|
||||
($adjust && $ix!=$len)? $TERM_DOWN : '' );
|
||||
|
||||
|
||||
}elsif($print_line==4) {
|
||||
# insert
|
||||
$len = length($hist[$#hist]);
|
||||
($y_len,$y_ix,$col,$adjust) =
|
||||
&main::calcxy($mode,$prompt,$len,$ix,$off,$wd);
|
||||
|
||||
print( OUT substr("$prompt$hist[$#hist]", $ix),
|
||||
$TERM_UP x ($y_len-$y_ix) ,"\r", $TERM_RIGHT x $col,
|
||||
$TERM_DOWN x $adjust );
|
||||
|
||||
}else{
|
||||
# print whole line
|
||||
$len = length($hist[$#hist]);
|
||||
#move cursor to bol on screen, erase prev printout
|
||||
print (OUT $TERM_DOWN x ($y_len-$y_ix),
|
||||
"\r$TERM_EEOL$TERM_UP" x ($y_len),
|
||||
"\r$TERM_EEOL\r",
|
||||
$TERM_RIGHT x $off,"$prompt$hist[$#hist]");
|
||||
($y_len,$y_ix,$col,$adjust) =
|
||||
&main::calcxy($mode,$prompt,$len,$ix,$off,$wd);
|
||||
|
||||
#mv cursor to cur pos
|
||||
print( OUT $TERM_UP x ($y_len-$y_ix) ,"\r", $TERM_RIGHT x $col,
|
||||
$TERM_DOWN x $adjust);
|
||||
}
|
||||
|
||||
|
||||
GETC:{
|
||||
($col0, $y_ix0, $y_len0) = ($col, $y_ix, $y_len);
|
||||
$print_line=1;
|
||||
|
||||
$c = main::getchar();
|
||||
while($Key{$c} eq "prefix" ) {
|
||||
$c .= main::getchar();
|
||||
}
|
||||
|
||||
($op = $Key{$c}) =~ s/(.*)\s*[\(;].*/$1/;
|
||||
$op =~ /(\w+)$/;
|
||||
$op = $1;
|
||||
|
||||
if( $Key{$c} =~ /ign_mode/ ) {
|
||||
# ignore mode and execute command
|
||||
eval "&{$Key{$c}}";
|
||||
}elsif( $mode =~ /^search/ ) {
|
||||
main::search_mode(*c,*s,*prompt,*mode,*isp, *hist);
|
||||
another_line();
|
||||
}elsif( $c eq $Key{EOF} && $len==0 ) {
|
||||
return ''; # eof return null
|
||||
}elsif( defined $Key{$c} ) {
|
||||
eval "&{$Key{$c}}";
|
||||
$lastop{op} = $op;
|
||||
}elsif( ord ($c) < 32 ) {
|
||||
#undefined control char
|
||||
print OUT "\a";
|
||||
$print_line = 0;
|
||||
}else {
|
||||
$lastop{op} = 'ins_char';
|
||||
&ins_char( $c );
|
||||
print OUT $c;
|
||||
}
|
||||
$init_in = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if( $y_ix != $y_len ) {
|
||||
print OUT "\n" x ($y_len-$y_ix);
|
||||
}
|
||||
&main::stty($org_stty);
|
||||
|
||||
print OUT "\n";
|
||||
if( $hist[$#hist] eq '' ) {
|
||||
pop(@hist);
|
||||
return "\n";
|
||||
}
|
||||
if( $#hist>0 && $hist[$#hist] eq $hist[$#hist-1] ) {
|
||||
pop(@hist); # if it is the same, delete
|
||||
}else{
|
||||
&main::add_hist( *hist, *hist );
|
||||
}
|
||||
$hist[$#hist]."\n";
|
||||
}
|
||||
|
||||
#-----------------------------
|
||||
# editinig command functions
|
||||
#
|
||||
# functions must be below here to be listed by list_func
|
||||
#
|
||||
# the variables below are local to sub input
|
||||
# $prompt,$hist,$app,$off
|
||||
# $len,$ix
|
||||
# $c,$isp,$wisp,$s
|
||||
# $mode
|
||||
#-----------------------------
|
||||
sub prefix { } # it's only here to be listed by list_func
|
||||
sub boh {
|
||||
$isp = 0;
|
||||
another_line();
|
||||
}
|
||||
sub boh_ign_mode {
|
||||
boh();
|
||||
}
|
||||
sub bol {
|
||||
$ix = 0 ;
|
||||
$print_line=0;
|
||||
}
|
||||
sub bs {
|
||||
my($l) = @_;
|
||||
$l = 1 if $l eq '';
|
||||
if( $len && $ix ) {
|
||||
$ix-=$l; # mv left
|
||||
substr($hist[$#hist],$ix,$l) = ""; # del char
|
||||
}
|
||||
$print_line = 3;
|
||||
}
|
||||
sub del_back_line {
|
||||
substr($hist[$#hist],0,$ix) = "";
|
||||
$ix = 0;
|
||||
$print_line = 3;
|
||||
}
|
||||
sub del_forw_line {
|
||||
substr($hist[$#hist],$ix) = "";
|
||||
$print_line = 2;
|
||||
}
|
||||
sub del_char {
|
||||
my($l) = @_;
|
||||
$l = 1 if $l eq '';
|
||||
if( $len > $ix ) {
|
||||
substr($hist[$#hist],$ix,$l) = ""; # del char
|
||||
}
|
||||
$print_line = 2;
|
||||
}
|
||||
sub del_line {
|
||||
$ix = 0;
|
||||
$hist[$#hist] = "";
|
||||
$print_line = 3;
|
||||
}
|
||||
sub del_back_word {
|
||||
my($tmp);
|
||||
$tmp = substr($hist[$#hist],0,$ix);
|
||||
$tmp =~ s/(^|\S+)\s*$//;
|
||||
$tmp = length $tmp;
|
||||
substr($hist[$#hist],$tmp,$ix-$tmp) = "";
|
||||
$ix = $tmp;
|
||||
$print_line = 3;
|
||||
}
|
||||
sub del_forw_word {
|
||||
$hist[$#hist] =~ s/^(.{$ix})\s*\S+/$1/;
|
||||
$print_line = 2;
|
||||
}
|
||||
sub enter {
|
||||
subst();
|
||||
enter_wo_subst();
|
||||
}
|
||||
sub eoh {
|
||||
if( $isp==$#hist ) {
|
||||
print OUT "\a";
|
||||
}else{
|
||||
$hist[$#hist] = ''
|
||||
}
|
||||
$isp = $#hist;
|
||||
another_line();
|
||||
$print_line = 1;
|
||||
}
|
||||
sub eoh_ign_mode {
|
||||
eoh();
|
||||
$print_line = 1;
|
||||
}
|
||||
sub eol {
|
||||
$ix = $len;
|
||||
$print_line=0;
|
||||
}
|
||||
sub execute {
|
||||
eval "$hist[$#hist]";
|
||||
if( $#hist>0 && $hist[$#hist] eq $hist[$#hist-1] ) {
|
||||
pop(@hist); # if it is the same, delete
|
||||
}else{
|
||||
&main::add_hist( *hist, *hist );
|
||||
}
|
||||
push( @hist, ''); # deceive 'input' it is an empty line
|
||||
last IN_STACK;
|
||||
}
|
||||
sub ins_char {
|
||||
my($c) = @_;
|
||||
&main::insert_char($c,*len,*ix,*hist);
|
||||
$print_line = 4;
|
||||
}
|
||||
sub ins_last_word {
|
||||
if( $lastop{op} =~ /^ins_(nth|last)_word/ ) {
|
||||
return if $wisp < 1;
|
||||
#delete last last_word
|
||||
bs(length $lastop{word});
|
||||
}else {
|
||||
$wisp = $#hist;
|
||||
return if $wisp < 1;
|
||||
}
|
||||
$hist[--$wisp] =~ /(\S+)\s*$/;
|
||||
$lastop{word} = $1;
|
||||
ins_char($lastop{word});
|
||||
}
|
||||
sub ins_nth_word {
|
||||
my($n) = @_;
|
||||
if( $lastop{op} =~ /^ins_(nth|last)_word/ ) {
|
||||
return if $wisp < 1;
|
||||
#delete last last_word
|
||||
bs(length $lastop{word});
|
||||
}else {
|
||||
$wisp = $#hist;
|
||||
return if $wisp < 1;
|
||||
}
|
||||
$hist[--$wisp] =~ /((\S+)\s*){1,$n}/;
|
||||
$lastop{word} = $2;
|
||||
ins_char($lastop{word});
|
||||
}
|
||||
sub list_func {
|
||||
my( $s, @cmds, $cmd, $func);
|
||||
$func = 0;
|
||||
open( THIS, "$0" ) || return; #shouldn't occur
|
||||
while( $s = <THIS> ) {
|
||||
if( $s =~ /^\s*sub\s+main::input\s*\{/ ) {
|
||||
$func = 1;
|
||||
next;
|
||||
}
|
||||
next if !$func;
|
||||
if( $s =~ s/^\s*sub\s+// ) {
|
||||
$s =~ s/\s*[\{].*//;
|
||||
push @cmds,$s;
|
||||
}
|
||||
}
|
||||
close THIS;
|
||||
foreach $cmd (sort @cmds) {
|
||||
print OUT $cmd;
|
||||
}
|
||||
}
|
||||
|
||||
sub bind {
|
||||
# bind Key or Subst
|
||||
# if there is no arguments, then list them
|
||||
my($hash,$key,$val) = @_;
|
||||
my( $mod,$chr,$v2,$k,$cnt );
|
||||
if( defined %{$hash} ) {
|
||||
$k = $key;
|
||||
if( $hash eq "Key" ) {
|
||||
($v2 = $val) =~ s/\s*[\(;].*//;
|
||||
if( !defined &{$v2} ) {
|
||||
print STDERR "Unknown function $v2\n";
|
||||
return;
|
||||
}
|
||||
$mod = 0; $cnt =0; $k = '';
|
||||
for( $i=0; $i<length $key; $i++ ) {
|
||||
$chr = substr($key,$i,1);
|
||||
if( $chr eq "\\" ) {
|
||||
$chr = substr($key,++$i,1);
|
||||
if( $chr=~/m/i ) {
|
||||
$mod = 0x80;
|
||||
}elsif( $chr=~/c/i ) {
|
||||
$cnt = 1;
|
||||
}elsif( $chr=~/e/i ) {
|
||||
$chr = $ESC;
|
||||
$chr = pack("c",ord($chr)+$mod);
|
||||
$mod = 0 ; $cnt = 0;
|
||||
$k .= $chr;
|
||||
}else {
|
||||
print "Unknown char $key\n";
|
||||
}
|
||||
}else {
|
||||
if( $cnt ) {
|
||||
eval "\$chr = \"\\c$chr\" ";
|
||||
}
|
||||
$chr = pack("c",ord($chr)+$mod);
|
||||
$mod = 0 ; $cnt = 0;
|
||||
$k .= $chr;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( $val eq '' ) {
|
||||
delete ${$hash}{$k};
|
||||
}else {
|
||||
${$hash}{$k} = $val;
|
||||
}
|
||||
|
||||
|
||||
}else {
|
||||
foreach $key (sort(keys(%Key) )){
|
||||
$val = $Key{$key};
|
||||
$mod = '';
|
||||
while( $key =~ s/(.|\s)// ) {
|
||||
$chr = $1;
|
||||
if( ord($chr) >= 0x80 ) {
|
||||
$mod .= '\M';
|
||||
$chr = pack("c", ord($chr)-0x80);
|
||||
}
|
||||
if( $chr eq $ESC ) {
|
||||
$chr = '\E';
|
||||
}elsif( ord($chr) < 0x20 ) {
|
||||
$mod .= '\C';
|
||||
$chr = pack("c", ord($chr)+0x40);
|
||||
}elsif( ord($chr) == 0x7f ) {
|
||||
$chr = '\C?';
|
||||
}
|
||||
$mod .= $chr;
|
||||
}
|
||||
if( ord($val) < 0x20 ) {
|
||||
$val = '\C'.pack("c", ord($val)+0x40);
|
||||
}
|
||||
print OUT "Key $mod $val\n";
|
||||
}
|
||||
while( ($key,$val) = each(%Subst) ) {
|
||||
print OUT "Subst $key $val\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
sub next_char {
|
||||
$ix++ if ($ix<$len);
|
||||
$print_line=0;
|
||||
}
|
||||
|
||||
sub next_line {
|
||||
if($isp<$#hist) {
|
||||
$isp++;
|
||||
if( $isp==$#hist ) {
|
||||
$hist[$isp] = '';
|
||||
}
|
||||
}else {
|
||||
$isp = $#hist;
|
||||
print OUT "\a";
|
||||
}
|
||||
another_line();
|
||||
}
|
||||
|
||||
sub next_word {
|
||||
$hist[$#hist] =~ /^(.{$ix}\S*(\s+|$))/;
|
||||
$ix = length($1);
|
||||
$print_line=0;
|
||||
}
|
||||
|
||||
sub enter_wo_subst {
|
||||
last IN_STACK;
|
||||
}
|
||||
|
||||
sub prev_char {
|
||||
$ix-- if $ix>0;
|
||||
$print_line=0;
|
||||
}
|
||||
|
||||
sub prev_line {
|
||||
if($isp>0) {
|
||||
$isp--;
|
||||
}else {
|
||||
$isp = 0;
|
||||
print OUT "\a";
|
||||
}
|
||||
another_line();
|
||||
}
|
||||
|
||||
sub prev_word {
|
||||
my($tmp);
|
||||
$tmp = substr($hist[$#hist],0,$ix);
|
||||
$tmp =~ s/(^|\S+)\s*$//;
|
||||
$ix = length($tmp);
|
||||
$print_line=0;
|
||||
}
|
||||
|
||||
sub cancel {
|
||||
$hist[$#hist] = "";
|
||||
$len = 0;
|
||||
last IN_STACK;
|
||||
}
|
||||
sub quote {
|
||||
my($c);
|
||||
sysread(IN, $c, 1);
|
||||
# $c = getc(IN);
|
||||
ins_char($c);
|
||||
}
|
||||
|
||||
sub search_rev {
|
||||
$s = '';
|
||||
$mode = 'search_rev';
|
||||
$p_save = $prompt;
|
||||
$prompt = "($mode)'$s':";
|
||||
$hist[$#hist] = $hist[$isp];
|
||||
another_line();
|
||||
}
|
||||
|
||||
sub search {
|
||||
$s = '';
|
||||
$mode = 'search';
|
||||
$p_save = $prompt;
|
||||
$prompt = "($mode)'$s':";
|
||||
$hist[$#hist] = $hist[$isp];
|
||||
another_line();
|
||||
}
|
||||
|
||||
sub subst {
|
||||
my($key,$val);
|
||||
$done = 0;
|
||||
while( ($key,$val) = each(%Subst) ) {
|
||||
last if( eval "\$hist[\$#hist] =~ s\$key$val" ) ;
|
||||
}
|
||||
$ix = $len = length($hist[$#hist]);
|
||||
}
|
||||
|
||||
sub termsize {
|
||||
my($row, $col,$s);
|
||||
if( -f "/vmunix" ) {
|
||||
$s =&main::stty ("everything");
|
||||
($row,$col) = ($s =~ /(\d+)\s+rows[,\s]+(\d+)\s+columns/ );
|
||||
} else {
|
||||
$s =&main::stty ("-a");
|
||||
($row,$col) = ($s =~ /rows[=\s]+(\d+)[,;\s]+columns[=\s]+(\d+)/ );
|
||||
}
|
||||
($row,$col);
|
||||
}
|
||||
|
||||
@@ -1,188 +0,0 @@
|
||||
.\" t
|
||||
.\" @(#)FvwmConsoleC.pl.1x 7/16/96
|
||||
.TH FvwmConsoleC.pl 1x "July 16 1996"
|
||||
.UC
|
||||
|
||||
.SH NAME
|
||||
FvwmConsoleC.pl \- Command editor for FVWM command input interface
|
||||
.SH SYNOPSIS
|
||||
FvwmConsole -e /usr/X11/lib/fvwm2/FvwmConsoleC.pl
|
||||
|
||||
.SH COPYRIGHT
|
||||
Copyright 1996, Toshi Isogai. No guarantees or warranties are provided.
|
||||
Use this program at your own risk. Permission to use this program for
|
||||
any purpose is given, as long as the copyright is kept intact.
|
||||
|
||||
|
||||
.SH DESCRIPTION
|
||||
FvwmConsoleC.pl offers editing capabilities while the user is
|
||||
entering the line. By default, the line editing commands
|
||||
are similar to those of emacs. It also offers
|
||||
.B substitution
|
||||
, which replaces a pattern to a string before it sends the command.
|
||||
|
||||
.SH FUNCTIONS
|
||||
Functions are bound to a key or key combination to be
|
||||
invoked. The followings are functions available and their
|
||||
default key bindings.
|
||||
.RS
|
||||
.IP \fBbind\fP
|
||||
\fIMeta-k, Cntl-x Cntl-b\fP
|
||||
.br
|
||||
.\"Bind key to function or bind pattern to string for substitution.
|
||||
List up key bindings and substitutions.
|
||||
.IP \fBboh\fP
|
||||
.br
|
||||
Move to the beginning of history.
|
||||
.IP "\fBboh_ign_mode\fP \fIEsc-<\fP"
|
||||
.br
|
||||
Move to the beginning of history. If it is in search mode,
|
||||
continue.
|
||||
.IP \fBbol\fP
|
||||
\fIHome, Cntl-a\fP
|
||||
.br
|
||||
Move cursor to the beginning of the line.
|
||||
.IP "\fBbs[(n)]\fP \fIBackSpace, Cntl-h\fP"
|
||||
.br
|
||||
Backspace n times. default of n is 1.
|
||||
.IP \fBcancel\fP
|
||||
\fICntl-x Cntl-k\fP
|
||||
.br
|
||||
Cancel the current input.
|
||||
.IP \fBdel_back_line\fP
|
||||
.br
|
||||
Delete the line from the beginning to the cursor.
|
||||
.IP "\fBdel_back_word\fP \fICntl-w\fP"
|
||||
.br
|
||||
Delete the word from the beginning to the cursor.
|
||||
.IP "\fBdel_char [(n)]\fP \fIDelete, Cntl-d\fP"
|
||||
Delete n characters from the cursor to the right. Default of n
|
||||
is 1.
|
||||
.IP "\fBdel_forw_line\fP \fICntl-k\fP"
|
||||
.br
|
||||
Delete the line from the cursor to the end.
|
||||
.IP "\fBdel_forw_word\fP \fIMeta-d\fP"
|
||||
.br
|
||||
Delete the word from the cursor to the end.
|
||||
.IP "\fBdel_line\fP \fICntl-u\fP"
|
||||
.br
|
||||
Delete the entire line.
|
||||
.IP \fBenter\fP
|
||||
\fIEnter, Cntl-j, Cntl-m\fP
|
||||
.br
|
||||
Perform substitution if applicable and send the line to Fvwm.
|
||||
.IP "\fBenter_wo_subst\fP \fIMeta-Enter\fP"
|
||||
.br
|
||||
Send the line to Fvwm without any substitution.
|
||||
.IP \fBeoh\fP
|
||||
.br
|
||||
Move to the end of history.
|
||||
.IP "\fBeoh_ign_mode\fP \fIEsc->\fP"
|
||||
.br
|
||||
Move to the end of history. If it is in search mode, continue.
|
||||
.IP \fBeol\fP
|
||||
\fIEnd, Cntl-e\fP
|
||||
.br
|
||||
Move the cursor to the end of line.
|
||||
.IP "\fBins_char (str)\fP"
|
||||
.br
|
||||
Insert string at the cursor.
|
||||
.IP "\fBins_last_word\fP \fIEsc-.\fP"
|
||||
.br
|
||||
Insert the last argument of the previous command at the cursor.
|
||||
.IP "\fBins_nth_word\fP \fIMeta-[1..9]\fP"
|
||||
.br
|
||||
Insert the n-th argument of the previous command at the cursor.
|
||||
.IP "\fBlist_func\fP \fIMeta-l\fP"
|
||||
.br
|
||||
List up available editing functions.
|
||||
.IP "\fBnext_char\fP \fIRight, Cntl-f\fP"
|
||||
.br
|
||||
Move the cursor to the next character.
|
||||
.IP "\fBnext_line\fP \fIDown, Cntl-n\fP"
|
||||
.br
|
||||
Move to the next line in history.
|
||||
.IP "\fBnext_word\fP \fIMeta-f\fP"
|
||||
.br
|
||||
Move the cursor to the next word.
|
||||
.IP \fBprefix\fP
|
||||
.br
|
||||
Wait for the next character typed in for multi-key binding.
|
||||
.IP "\fBprev_char\fP \fILeft, Cntl-b\fP"
|
||||
.br
|
||||
Move the cursor to the previous character.
|
||||
.IP "\fBprev_line\fP \fIUp, Cntl-p\fP"
|
||||
.br
|
||||
Move to the previous line in history.
|
||||
.IP "\fBprev_word\fP \fIMeta-b\fP"
|
||||
.br
|
||||
Move the cursor to the previous word.
|
||||
.IP \fBquote\fP
|
||||
\fICntl-q\fP
|
||||
.br
|
||||
Insert the next character typed into the buffer literally.
|
||||
.IP \fBsearch\fP
|
||||
\fICntl-s\fP
|
||||
.br
|
||||
Search pattern in history.
|
||||
.IP "\fBsearch_rev\fP \fICntl-r\fP"
|
||||
.br
|
||||
Search pattern in history in reverse order.
|
||||
.IP \fBsubst\fP
|
||||
\fIMeta-s\fP
|
||||
.br
|
||||
Substitute all patterns to strings and reprint the line.
|
||||
The substitutions are not nested and performed in the order
|
||||
that they are defined.
|
||||
.RE
|
||||
|
||||
.SH CONFIGURATION
|
||||
The key binding can be overridden or defined
|
||||
in fvwm module configuration.
|
||||
|
||||
.RS
|
||||
*FvwmConsoleKey \\ck prev_line
|
||||
.RE
|
||||
|
||||
Non-space character sequence need not be quoted.
|
||||
In order to undefine, omit the last argument.
|
||||
|
||||
.RS
|
||||
*FvwmConsoleKey \ck
|
||||
.RE
|
||||
|
||||
Note that non-meta character is case sensitive.
|
||||
\\c means control key, \\e means escape, and \\m is alt key.
|
||||
.br
|
||||
It also accepts Subst configuration. Users often input long fvwm command
|
||||
repeatedly. Subst will replace particular input sequence to user defined
|
||||
string. Example:
|
||||
|
||||
.RS
|
||||
*FvwmConsoleSubst '^bigx' 'Exec xterm -g 120x60+0+0 -fn 10x20 -fg black -bg lemonchiffon'
|
||||
.RE
|
||||
|
||||
Typing 'bigx<return>' in FvwmConsole will launch xterm. '^' denotes
|
||||
the beginning of line in
|
||||
.B regular expression.
|
||||
\'pl\' in the middle
|
||||
of the command will not be replaced. Although the format looks different,
|
||||
it takes Perl regular expression.
|
||||
It just uses single or double quote as the delimiter.
|
||||
Single or double quotes have no difference, although they have to match,
|
||||
and cannot include itself in the string.
|
||||
|
||||
.RS
|
||||
*FvwmConsoleSubst '^g\\s*(\\d+)' 'Desk 0 0\\nGotoPage 0 $1\\nFocus'
|
||||
.RE
|
||||
|
||||
Entering 'g4' or 'g 4' will jump to desk 0 page 0 4 and focus.
|
||||
|
||||
.SH INVOCATION
|
||||
FvwmConsoleC.pl should be invoked by FvwmConsole.
|
||||
|
||||
.SH SEE ALSO
|
||||
FvwmConsole(1x), perlre(1)
|
||||
|
||||
.SH AUTHOR
|
||||
Toshi Isogai
|
||||
@@ -1,17 +0,0 @@
|
||||
0. Restore the files under fvwm/modules
|
||||
|
||||
1. Change the current directory to FvwmConsole
|
||||
|
||||
2. Modify your Imakefile
|
||||
|
||||
Comment out the line, '#define HAVE_READLINE', if you don't
|
||||
have GNU readline library.
|
||||
|
||||
If you have Perl 5.002 or later and want to use FvwmConsoleC.pl
|
||||
editor, insert '#define HAVE_PERL5.002
|
||||
|
||||
3. Run 'xmkmf;make'.
|
||||
|
||||
4. Run 'make install'.
|
||||
|
||||
5. Run 'make install.man' to install man pages.
|
||||
@@ -1,24 +0,0 @@
|
||||
FvwmConsole allows the user to type fvwm commands into
|
||||
xterm, and have them executed immediately. These commands
|
||||
are usually specfified in the .fvwmrc file, or are bound to
|
||||
menu/mouse items as specified in that file. This tools is
|
||||
particularly useful for testing new configuration ideas, or
|
||||
for implementing temporary changes to your environment.
|
||||
|
||||
GNU readline library is called to edit command line.
|
||||
A perl script is supplied as an alternative command editor
|
||||
for those who don't have the readline library.
|
||||
|
||||
Any comments will be appreciated.
|
||||
|
||||
Feb '97
|
||||
|
||||
|
||||
|
||||
Thanks to Makoto `MAR_kun' MATSUSHITA for advice and testing
|
||||
Paul D Smith for fixes
|
||||
|
||||
Toshi Isogai isogai@kentek.com
|
||||
|
||||
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
#include "FvwmConsole.h"
|
||||
|
||||
#ifndef HAVE_READLINE
|
||||
static char cmd[MAX_COMMAND_SIZE];
|
||||
|
||||
/* no readline - starts here */
|
||||
char *get_line() {
|
||||
if( fgets(cmd,MAX_COMMAND_SIZE,stdin) == NULL ) {
|
||||
return(NULL);
|
||||
}
|
||||
return(cmd);
|
||||
}
|
||||
|
||||
#else
|
||||
/* readline - starts here */
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
|
||||
extern int rl_bind_key();
|
||||
|
||||
|
||||
static char cmd[MAX_COMMAND_SIZE];
|
||||
static char *line = (char *)NULL;
|
||||
static int done_init = 0;
|
||||
static char *h_file;
|
||||
|
||||
char *get_line()
|
||||
{
|
||||
char *prompt;
|
||||
int len;
|
||||
char *home;
|
||||
int fdh;
|
||||
|
||||
/* If initialization hasn't been done, do it now:
|
||||
* - We don't want TAB completion
|
||||
*/
|
||||
if (!done_init) {
|
||||
rl_bind_key('\t', rl_insert);
|
||||
|
||||
/* get history from file */
|
||||
home = getenv("HOME");
|
||||
h_file = safemalloc( strlen(home)+ 14);
|
||||
strcpy(h_file,home);
|
||||
strcat(h_file,HISTFILE);
|
||||
if( access( h_file, F_OK) < 0) {
|
||||
/* if it doesn't exist create it */
|
||||
fdh = creat( h_file, S_IRUSR | S_IWUSR );
|
||||
if( fdh != -1 ) {
|
||||
close( fdh );
|
||||
}
|
||||
} else {
|
||||
read_history_range( h_file, 0, HISTSIZE );
|
||||
}
|
||||
done_init = 1;
|
||||
}
|
||||
|
||||
/* Empty out the previous info */
|
||||
len = 0;
|
||||
*cmd = '\0';
|
||||
prompt = PS1;
|
||||
|
||||
while (1) {
|
||||
int linelen = 0;
|
||||
|
||||
/* If the buffer has already been allocated, free the memory. */
|
||||
if (line != (char *)NULL)
|
||||
free(line);
|
||||
|
||||
/* Get a line from the user. */
|
||||
line = readline(prompt);
|
||||
if (line == NULL)
|
||||
return (NULL);
|
||||
|
||||
/* Make sure we have enough space for the new line */
|
||||
linelen = strlen(line);
|
||||
if (len + linelen > MAX_COMMAND_SIZE-2 ) {
|
||||
fprintf( stderr, "line too long %d chars max %d \a\n",
|
||||
len+linelen, MAX_COMMAND_SIZE-2 );
|
||||
strncat(cmd, line, MAX_COMMAND_SIZE-len-2);
|
||||
add_history(cmd);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Copy the new line onto the end of the current line */
|
||||
strcat(cmd, line);
|
||||
|
||||
/* If the current line doesn't end with a backslash, we're done */
|
||||
len = strlen(cmd);
|
||||
if (cmd[len-1] != '\\')
|
||||
break;
|
||||
|
||||
/* Otherwise, remove it and wait for more (add a space if needed) */
|
||||
prompt = PS2;
|
||||
cmd[len-1] = (cmd[len-2]==' ' || cmd[len-2]=='\t') ? '\0' : ' ';
|
||||
}
|
||||
|
||||
/* If the command has any text in it, save it on the history. */
|
||||
if (*cmd != '\0') {
|
||||
add_history(cmd);
|
||||
append_history( 1,h_file );
|
||||
history_truncate_file( h_file, HISTSIZE );
|
||||
}
|
||||
|
||||
cmd[len] = '\n';
|
||||
cmd[len+1] = '\0';
|
||||
|
||||
return (cmd);
|
||||
}
|
||||
/* readline - end here */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
.\" t
|
||||
.\" @(#)FvwmDebug.1 1/28/94
|
||||
.TH FvwmDebug 1.20 "Jan 28 1994"
|
||||
.UC
|
||||
.SH NAME
|
||||
FvwmDebug \- the FVWM module debugger
|
||||
.SH SYNOPSIS
|
||||
FvwmDebug is spawned by fvwm, so no command line invocation will work.
|
||||
|
||||
.SH DESCRIPTION
|
||||
The FvwmDebug captures the stream of module packets coming from
|
||||
fvwm, and displays them on stderr.
|
||||
|
||||
.SH COPYRIGHTS
|
||||
The FvwmDebug program, and the concept for
|
||||
interfacing this module to the Window Manager, are all original work
|
||||
by Robert Nation
|
||||
|
||||
Copyright 1994, Robert Nation. No guarantees or warranties or anything
|
||||
are provided or implied in any way whatsoever. Use this program at your
|
||||
own risk. Permission to use this program for any purpose is given,
|
||||
as long as the copyright is kept intact.
|
||||
|
||||
|
||||
.SH INITIALIZATION
|
||||
During initialization, the FvwmDebug requests that fvwm dump a
|
||||
complete window list into its pipe. These packets are terminated with
|
||||
and "end Send_WindowList" message.
|
||||
|
||||
.SH INVOCATION
|
||||
FvwmDebug can be invoked by inserting the line 'Module FvwmDebug' in
|
||||
the .fvwmrc file. This can be placed on a line by itself, if FvwmDebug
|
||||
is to be spawned during fvwm's initialization, or can be bound to a
|
||||
menu or mouse button or keystroke to invoke it later. Fvwm will search
|
||||
directory specified in the ModulePath configuration option to attempt
|
||||
to locate FvwmDebug.
|
||||
|
||||
.SH CONFIGURATION OPTIONS
|
||||
There are no configuration options.
|
||||
|
||||
|
||||
.SH AUTHOR
|
||||
Robert Nation
|
||||
|
||||
@@ -1,539 +0,0 @@
|
||||
/* This module, and the entire FvwmDebug program, and the concept for
|
||||
* interfacing this module to the Window Manager, are all original work
|
||||
* by Robert Nation
|
||||
*
|
||||
* Copyright 1994, Robert Nation. No guarantees or warantees or anything
|
||||
* are provided or implied in any way whatsoever. Use this program at your
|
||||
* own risk. Permission to use this program for any purpose is given,
|
||||
* as long as the copyright is kept intact. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include "../../fvwm/module.h"
|
||||
|
||||
#include "FvwmDebug.h"
|
||||
|
||||
char *MyName;
|
||||
int fd_width;
|
||||
int fd[2];
|
||||
|
||||
/*
|
||||
** spawn_xtee - code to execute xtee from a running executable &
|
||||
** redirect stdout & stderr to it. Currently sends both to same xtee,
|
||||
** but you rewrite this to spawn off 2 xtee's - one for each stream.
|
||||
*/
|
||||
|
||||
pid_t spawn_xtee(void)
|
||||
{
|
||||
pid_t pid;
|
||||
int PIPE[2];
|
||||
char *argarray[256];
|
||||
|
||||
setvbuf(stdout,NULL,_IOLBF,0); /* line buffered */
|
||||
|
||||
if (pipe(PIPE))
|
||||
{
|
||||
perror("spawn_xtee");
|
||||
fprintf(stderr, "ERROR ERRATA -- Failed to create pipe for xtee.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
argarray[0] = "xtee";
|
||||
argarray[1] = "-nostdout";
|
||||
argarray[2] = NULL;
|
||||
|
||||
if (!(pid = fork())) /* child */
|
||||
{
|
||||
dup2(PIPE[0], STDIN_FILENO);
|
||||
close(PIPE[0]);
|
||||
close(PIPE[1]);
|
||||
execvp("xtee",argarray);
|
||||
exit(1); /* shouldn't get here... */
|
||||
}
|
||||
else /* parent */
|
||||
{
|
||||
if (ReapChildrenPid(pid) != pid)
|
||||
{
|
||||
dup2(PIPE[1], STDOUT_FILENO);
|
||||
dup2(PIPE[1], STDERR_FILENO);
|
||||
close(PIPE[0]);
|
||||
close(PIPE[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return pid;
|
||||
} /* spawn_xtee */
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* main - start of module
|
||||
*
|
||||
***********************************************************************/
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *temp, *s;
|
||||
|
||||
/* Save our program name - for error messages */
|
||||
temp = argv[0];
|
||||
s=strrchr(argv[0], '/');
|
||||
if (s != NULL)
|
||||
temp = s + 1;
|
||||
|
||||
MyName = safemalloc(strlen(temp)+2);
|
||||
strcpy(MyName,"*");
|
||||
strcat(MyName, temp);
|
||||
|
||||
if((argc != 6)&&(argc != 7))
|
||||
{
|
||||
fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",MyName,
|
||||
VERSION);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Dead pipe == Fvwm died */
|
||||
signal (SIGPIPE, DeadPipe);
|
||||
|
||||
fd[0] = atoi(argv[1]);
|
||||
fd[1] = atoi(argv[2]);
|
||||
|
||||
#if 0
|
||||
spawn_xtee();
|
||||
#endif
|
||||
|
||||
/* Data passed in command line */
|
||||
fprintf(stderr,"Application Window 0x%s\n",argv[4]);
|
||||
fprintf(stderr,"Application Context %s\n",argv[5]);
|
||||
|
||||
fd_width = GetFdWidth();
|
||||
|
||||
/* Create a list of all windows */
|
||||
/* Request a list of all windows,
|
||||
* wait for ConfigureWindow packets */
|
||||
SendInfo(fd,"Send_WindowList",0);
|
||||
|
||||
Loop(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* Loop - wait for data to process
|
||||
*
|
||||
***********************************************************************/
|
||||
void Loop(int *fd)
|
||||
{
|
||||
unsigned long header[3], *body;
|
||||
|
||||
while(1)
|
||||
{
|
||||
if(ReadFvwmPacket(fd[1],header,&body) > 0)
|
||||
{
|
||||
process_message(header[1],body);
|
||||
free(body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* Process message - examines packet types, and takes appropriate action
|
||||
*
|
||||
***********************************************************************/
|
||||
void process_message(unsigned long type,unsigned long *body)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case M_ADD_WINDOW:
|
||||
list_add(body);
|
||||
case M_CONFIGURE_WINDOW:
|
||||
list_configure(body);
|
||||
break;
|
||||
case M_DESTROY_WINDOW:
|
||||
list_destroy(body);
|
||||
break;
|
||||
case M_FOCUS_CHANGE:
|
||||
list_focus(body);
|
||||
break;
|
||||
case M_NEW_PAGE:
|
||||
list_new_page(body);
|
||||
break;
|
||||
case M_NEW_DESK:
|
||||
list_new_desk(body);
|
||||
break;
|
||||
case M_RAISE_WINDOW:
|
||||
list_raise(body);
|
||||
break;
|
||||
case M_LOWER_WINDOW:
|
||||
list_lower(body);
|
||||
break;
|
||||
case M_ICONIFY:
|
||||
list_iconify(body);
|
||||
break;
|
||||
case M_MAP:
|
||||
list_map(body);
|
||||
break;
|
||||
case M_ICON_LOCATION:
|
||||
list_icon_loc(body);
|
||||
break;
|
||||
case M_DEICONIFY:
|
||||
list_deiconify(body);
|
||||
break;
|
||||
case M_WINDOW_NAME:
|
||||
list_window_name(body);
|
||||
break;
|
||||
case M_ICON_NAME:
|
||||
list_icon_name(body);
|
||||
break;
|
||||
case M_RES_CLASS:
|
||||
list_class(body);
|
||||
break;
|
||||
case M_RES_NAME:
|
||||
list_res_name(body);
|
||||
break;
|
||||
case M_END_WINDOWLIST:
|
||||
list_end();
|
||||
break;
|
||||
case M_DEFAULTICON:
|
||||
case M_ICON_FILE:
|
||||
default:
|
||||
list_unknown(body);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* SIGPIPE handler - SIGPIPE means fvwm is dying
|
||||
*
|
||||
***********************************************************************/
|
||||
void DeadPipe(int nonsense)
|
||||
{
|
||||
fprintf(stderr,"FvwmDebug: DeadPipe\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_add - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_add(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"Add Window\n");
|
||||
fprintf(stderr,"\t ID %lx\n",body[0]);
|
||||
fprintf(stderr,"\t frame ID %lx\n",body[1]);
|
||||
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
|
||||
fprintf(stderr,"\t frame x %ld\n",(long)body[3]);
|
||||
fprintf(stderr,"\t frame y %ld\n",(long)body[4]);
|
||||
fprintf(stderr,"\t frame w %ld\n",(long)body[5]);
|
||||
fprintf(stderr,"\t frame h %ld\n",(long)body[6]);
|
||||
fprintf(stderr,"\t desk %ld\n",(long)body[7]);
|
||||
fprintf(stderr,"\t flags %lx\n",body[8]);
|
||||
fprintf(stderr,"\t title height %ld\n",(long)body[9]);
|
||||
fprintf(stderr,"\t border width %ld\n",(long)body[10]);
|
||||
fprintf(stderr,"\t window base width %ld\n",(long)body[11]);
|
||||
fprintf(stderr,"\t window base height %ld\n",(long)body[12]);
|
||||
fprintf(stderr,"\t window resize width increment %ld\n",(long)body[13]);
|
||||
fprintf(stderr,"\t window resize height increment %ld\n",(long)body[14]);
|
||||
fprintf(stderr,"\t window min width %ld\n",(long)body[15]);
|
||||
fprintf(stderr,"\t window min height %ld\n",(long)body[16]);
|
||||
fprintf(stderr,"\t window max %ld\n",(long)body[17]);
|
||||
fprintf(stderr,"\t window max %ld\n",(long)body[18]);
|
||||
fprintf(stderr,"\t icon label window %lx\n",body[19]);
|
||||
fprintf(stderr,"\t icon pixmap window %lx\n",body[20]);
|
||||
fprintf(stderr,"\t window gravity %lx\n",body[21]);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_configure - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_configure(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"Configure Window\n");
|
||||
fprintf(stderr,"\t ID %lx\n",body[0]);
|
||||
fprintf(stderr,"\t frame ID %lx\n",body[1]);
|
||||
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
|
||||
fprintf(stderr,"\t frame x %ld\n",(long)body[3]);
|
||||
fprintf(stderr,"\t frame y %ld\n",(long)body[4]);
|
||||
fprintf(stderr,"\t frame w %ld\n",(long)body[5]);
|
||||
fprintf(stderr,"\t frame h %ld\n",(long)body[6]);
|
||||
fprintf(stderr,"\t desk %ld\n",(long)body[7]);
|
||||
fprintf(stderr,"\t flags %lx\n",body[8]);
|
||||
fprintf(stderr,"\t title height %ld\n",(long)body[9]);
|
||||
fprintf(stderr,"\t border width %ld\n",(long)body[10]);
|
||||
fprintf(stderr,"\t window base width %ld\n",(long)body[11]);
|
||||
fprintf(stderr,"\t window base height %ld\n",(long)body[12]);
|
||||
fprintf(stderr,"\t window resize width increment %ld\n",(long)body[13]);
|
||||
fprintf(stderr,"\t window resize height increment %ld\n",(long)body[14]);
|
||||
fprintf(stderr,"\t window min width %ld\n",(long)body[15]);
|
||||
fprintf(stderr,"\t window min height %ld\n",(long)body[16]);
|
||||
fprintf(stderr,"\t window max %ld\n",(long)body[17]);
|
||||
fprintf(stderr,"\t window max %ld\n",(long)body[18]);
|
||||
fprintf(stderr,"\t icon label window %lx\n",body[19]);
|
||||
fprintf(stderr,"\t icon pixmap window %lx\n",body[20]);
|
||||
fprintf(stderr,"\t window gravity %lx\n",body[21]);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_destroy - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_destroy(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"destroy\n");
|
||||
fprintf(stderr,"\t ID %lx\n",body[0]);
|
||||
fprintf(stderr,"\t frame ID %lx\n",body[1]);
|
||||
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_focus - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_focus(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"focus\n");
|
||||
fprintf(stderr,"\t ID %lx\n",body[0]);
|
||||
fprintf(stderr,"\t frame ID %lx\n",body[1]);
|
||||
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_new_page - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_new_page(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"new page\n");
|
||||
fprintf(stderr,"\t x %ld\n",(long)body[0]);
|
||||
fprintf(stderr,"\t y %ld\n",(long)body[1]);
|
||||
fprintf(stderr,"\t desk %ld\n",(long)body[2]);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_new_desk - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_new_desk(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"new desk\n");
|
||||
fprintf(stderr,"\t desk %ld\n",(long)body[0]);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_raise - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_raise(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"raise\n");
|
||||
fprintf(stderr,"\t ID %lx\n",body[0]);
|
||||
fprintf(stderr,"\t frame ID %lx\n",body[1]);
|
||||
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_lower - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_lower(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"lower\n");
|
||||
fprintf(stderr,"\t ID %lx\n",body[0]);
|
||||
fprintf(stderr,"\t frame ID %lx\n",body[1]);
|
||||
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_unknow - handles an unrecognized packet.
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_unknown(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"Unknown packet type\n");
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_iconify - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_iconify(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"iconify\n");
|
||||
fprintf(stderr,"\t ID %lx\n",body[0]);
|
||||
fprintf(stderr,"\t frame ID %lx\n",body[1]);
|
||||
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
|
||||
fprintf(stderr,"\t icon x %ld\n",(long)body[3]);
|
||||
fprintf(stderr,"\t icon y %ld\n",(long)body[4]);
|
||||
fprintf(stderr,"\t icon w %ld\n",(long)body[5]);
|
||||
fprintf(stderr,"\t icon h %ld\n",(long)body[6]);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_map - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_map(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"map\n");
|
||||
fprintf(stderr,"\t ID %lx\n",body[0]);
|
||||
fprintf(stderr,"\t frame ID %lx\n",body[1]);
|
||||
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_icon_loc - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_icon_loc(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"icon location\n");
|
||||
fprintf(stderr,"\t ID %lx\n",body[0]);
|
||||
fprintf(stderr,"\t frame ID %lx\n",body[1]);
|
||||
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
|
||||
fprintf(stderr,"\t icon x %ld\n",(long)body[3]);
|
||||
fprintf(stderr,"\t icon y %ld\n",(long)body[4]);
|
||||
fprintf(stderr,"\t icon w %ld\n",(long)body[5]);
|
||||
fprintf(stderr,"\t icon h %ld\n",(long)body[6]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_deiconify - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
void list_deiconify(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"de-iconify\n");
|
||||
fprintf(stderr,"\t ID %lx\n",body[0]);
|
||||
fprintf(stderr,"\t frame ID %lx\n",body[1]);
|
||||
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_window_name - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
void list_window_name(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"window name\n");
|
||||
fprintf(stderr,"\t ID %lx\n",body[0]);
|
||||
fprintf(stderr,"\t frame ID %lx\n",body[1]);
|
||||
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
|
||||
fprintf(stderr,"\t window name %s\n",(char *)(&body[3]));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_icon_name - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_icon_name(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"icon name\n");
|
||||
fprintf(stderr,"\t ID %lx\n",body[0]);
|
||||
fprintf(stderr,"\t frame ID %lx\n",body[1]);
|
||||
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
|
||||
fprintf(stderr,"\t icon name %s\n",(char *)(&body[3]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_class - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_class(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"window class\n");
|
||||
fprintf(stderr,"\t ID %lx\n",body[0]);
|
||||
fprintf(stderr,"\t frame ID %lx\n",body[1]);
|
||||
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
|
||||
fprintf(stderr,"\t window class %s\n",(char *)(&body[3]));
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_res_name - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_res_name(unsigned long *body)
|
||||
{
|
||||
fprintf(stderr,"class resource name\n");
|
||||
fprintf(stderr,"\t ID %lx\n",body[0]);
|
||||
fprintf(stderr,"\t frame ID %lx\n",body[1]);
|
||||
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
|
||||
fprintf(stderr,"\t resource name %s\n",(char *)(&body[3]));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* list_end - displays packet contents to stderr
|
||||
*
|
||||
***********************************************************************/
|
||||
void list_end(void)
|
||||
{
|
||||
fprintf(stderr,"Send_WindowList End\n");
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
#include "config.h"
|
||||
#include "fvwmlib.h"
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* Subroutine Prototypes
|
||||
*
|
||||
*************************************************************************/
|
||||
void Loop(int *fd);
|
||||
void SendInfo(int *fd,char *message,unsigned long window);
|
||||
char *safemalloc(int length);
|
||||
void DeadPipe(int nonsense);
|
||||
void process_message(unsigned long type,unsigned long *body);
|
||||
|
||||
void list_add(unsigned long *body);
|
||||
void list_configure(unsigned long *body);
|
||||
void list_destroy(unsigned long *body);
|
||||
void list_focus(unsigned long *body);
|
||||
void list_toggle(unsigned long *body);
|
||||
void list_new_page(unsigned long *body);
|
||||
void list_new_desk(unsigned long *body);
|
||||
void list_raise(unsigned long *body);
|
||||
void list_lower(unsigned long *body);
|
||||
void list_unknown(unsigned long *body);
|
||||
void list_iconify(unsigned long *body);
|
||||
void list_icon_loc(unsigned long *body);
|
||||
void list_deiconify(unsigned long *body);
|
||||
void list_map(unsigned long *body);
|
||||
void list_window_name(unsigned long *body);
|
||||
void list_icon_name(unsigned long *body);
|
||||
void list_class(unsigned long *body);
|
||||
void list_res_name(unsigned long *body);
|
||||
void list_end(void);
|
||||
|
||||
|
||||
#ifdef HAVE_WAITPID
|
||||
# define ReapChildrenPid(pid) waitpid(pid, NULL, WNOHANG)
|
||||
#elif HAVE_WAIT4
|
||||
# define ReapChildrenPid(pid) wait4(pid, NULL, WNOHANG, NULL)
|
||||
#else
|
||||
# error One of waitpid or wait4 is needed.
|
||||
#endif
|
||||
|
||||
#if HAVE_SETVBUF
|
||||
# if SETVBUF_REVERSED
|
||||
# define setvbuf(stream,buf,mode,size) setvbuf(stream,mode,buf,size)
|
||||
# endif
|
||||
#else
|
||||
# define setvbuf(a,b,c,d) setlinebuf(a)
|
||||
#endif
|
||||
@@ -1,172 +0,0 @@
|
||||
.\" t
|
||||
.\" @(#)FvwmGoodStuff.1 1/28/94
|
||||
.TH FvwmGoodStuff 1.20 "Jan 28 1994"
|
||||
.UC
|
||||
.SH NAME
|
||||
FvwmGoodStuff \- the FVWM button panel module
|
||||
.SH SYNOPSIS
|
||||
FvwmGoodStuff is spawned by fvwm, so no command line invocation will work.
|
||||
|
||||
.SH DESCRIPTION
|
||||
The FvwmGoodStuff module provides a button panel which sits on the X
|
||||
terminal's root window. The user can press the buttons at any time,
|
||||
and trigger invocation of a user-specified command by the window
|
||||
manager. FvwmGoodStuff only works when fvwm is used as the window
|
||||
manager.
|
||||
|
||||
The button panel can be of any configuration or geometry, and can have
|
||||
monochrome or color icons to represent the actions which would be
|
||||
invoked.
|
||||
|
||||
Note that this is the older version of FvwmButtons (decended from fvwm
|
||||
1.xx GoodStuff module), which was rewritten as of fvwm beta 2.0.42 to
|
||||
have more powerful configuration capabilities (see it's man page). If
|
||||
you don't want to exploit these new capabilities, or the new version
|
||||
gives you troubles, you may want to use this older module instead.
|
||||
|
||||
.SH COPYRIGHTS
|
||||
The FvwmGoodStuff program, and the concept for interfacing this module
|
||||
to the Window Manager, are all original work by Robert Nation
|
||||
|
||||
Copyright 1993, Robert Nation. No guarantees or warranties or anything
|
||||
are provided or implied in any way whatsoever. Use this program at
|
||||
your own risk. Permission to use this program for any purpose is
|
||||
given, as long as the copyright is kept intact.
|
||||
|
||||
|
||||
.SH INITIALIZATION
|
||||
During initialization, \fIFvwmGoodStuff\fP will search for a
|
||||
configuration file which describes the button panel geometry, color,
|
||||
icons, and actions. The format of this files will be described
|
||||
later. The configuration file will be the one which fvwm used during
|
||||
its initialization.
|
||||
|
||||
If the FvwmGoodStuff executable is linked to another name, ie ln -s
|
||||
FvwmGoodStuff TermStuff, or if FvwmGoodStuff is invoked with a
|
||||
parameter, ie Module FvwmGoodStuff TermStuff, then another module
|
||||
called TermStuff can be started with a completely different
|
||||
configuration than FvwmGoodStuff, simply by changing the keywords
|
||||
FvwmGoodStuff??? to TermStuff???. This way multiple button-bars can
|
||||
be used.
|
||||
|
||||
.SH INVOCATION
|
||||
FvwmGoodStuff can be invoked by inserting the line 'Module FvwmGoodStuff'
|
||||
in the .fvwmrc file. This can be placed on a line by itself, if
|
||||
FvwmGoodStuff is to be spawned during fvwm's initialization, or can be
|
||||
bound to a menu or mouse button or keystroke to invoke it later. Fvwm
|
||||
will search directory specified in the ModulePath configuration option
|
||||
to attempt to locate FvwmGoodStuff.
|
||||
|
||||
.SH CONFIGURATION OPTIONS
|
||||
The following options can be placed in the .fvwmrc file
|
||||
|
||||
.IP "*FvwmGoodStuffGeometry \fIgeometry\fP"
|
||||
Specifies the FvwmGoodStuff window location and/or size. If the size is
|
||||
not specified, FvwmGoodStuff will auto-size itself in a reasonable
|
||||
manner. The geometry is a standard X11 window geometry specification.
|
||||
|
||||
.IP "*FvwmGoodStuffFont \fIfont\fP"
|
||||
Specifies the font to be used for labeling the buttons.
|
||||
|
||||
.IP "*FvwmGoodStuffRows \fIrows\fP"
|
||||
Specifies the number of rows of buttons to be created. If unspecified,
|
||||
2 rows will be used.
|
||||
|
||||
.IP "*FvwmGoodStuffColumns \fIcolumns\fP"
|
||||
Specifies the number of columns of buttons to be created. If
|
||||
unspecified, the number of columns will be set to the number of
|
||||
buttons requested, divided by the number of rows. If both the rows and
|
||||
columns are specified, but do not specify as many buttons as are
|
||||
defined, then the users columns specification will be ignored.
|
||||
|
||||
.IP "*FvwmGoodStuffFore \fIcolor\fP"
|
||||
Specifies the color for button label text and monochrome icons.
|
||||
|
||||
.IP "*FvwmGoodStuffBack \fIcolor\fP"
|
||||
Specifies the color for the buttons.
|
||||
|
||||
.IP "*FvwmGoodStuff\fI[(w x h)]\fP \fIlabel icon command\fP"
|
||||
Specifies a window manager built-in command, as described in the fvwm
|
||||
man page, which should be executed when a button is pressed. The
|
||||
label field is the text which will be written on the button. The icon
|
||||
field specifies an X11 bitmap file or XPM color icon file, containing
|
||||
the icon to display on the button. FvwmGoodStuff will search through
|
||||
the path specified in the fvwm IconPath or PixmapPath configuration
|
||||
items to find the icon file. If the optional \fI(w x h)\fP is
|
||||
specified, then this button will be \fIw\fP times the normal button
|
||||
width and \fIh\fP times the normal button height. If label is "-"
|
||||
then the button label will not be displayed.
|
||||
|
||||
If \fIcommand\fP is an fvwm Exec command, then the button will remain
|
||||
pushed in until a window whose name or class matches the qouted
|
||||
portion of the command is encountered. This is intended to provide
|
||||
visual feedback to the user that the action he has requested will be
|
||||
performed. If the qouted portion contains no characters, then the
|
||||
button will pop out immediately. Note that users can continue
|
||||
pressing the button, and re-executing the command, even when it looks
|
||||
"pressed in."
|
||||
|
||||
A single extension to the fvwm built-in command set is provided. A
|
||||
command of the form: '*FvwmGoodStuff junk clock.xpm Swallow "Clock" Exec
|
||||
rclock' will cause FvwmGoodStuff to spawn an rclock process, and capture
|
||||
the first window whose name or resource is "Clock", and display it in
|
||||
the button-bar. This is handy for applications like xclock, xbiff,
|
||||
and xload. Modules can be swallowed by specifying the module instead
|
||||
of 'Exec whatever', like: '*FvwmGoodStuff - foobar Swallow "FvwmPager"
|
||||
FvwmPager 0 0'.
|
||||
|
||||
NOTE: if you use xclock for this application, you will want to specify
|
||||
xclock -padding 0.
|
||||
|
||||
|
||||
.SH SAMPLE CONFIGURATION
|
||||
The following are excepts from a .fvwmrc file which describe
|
||||
FvwmGoodStuff initialization commands:
|
||||
|
||||
.nf
|
||||
.sp
|
||||
##############################################################
|
||||
# Load any modules which should be started during
|
||||
# fvwm initialization
|
||||
ModulePath /usr/lib/X11/fvwm:/usr/bin/X11
|
||||
Module FvwmGoodStuff
|
||||
|
||||
# Make FvwmGoodStuff title-bar-less, sticky, and give it an icon
|
||||
NoTitle FvwmGoodStuff
|
||||
Sticky FvwmGoodStuff
|
||||
Icon "FvwmGoodStuff" toolbox.xpm
|
||||
|
||||
##############################################################
|
||||
##############################################################
|
||||
#Definitions used by the modules
|
||||
*FvwmGoodStuffFore Black
|
||||
*FvwmGoodStuffBack #908090
|
||||
|
||||
*FvwmGoodStuffGeometry -135-5
|
||||
*FvwmGoodStuffRows 1
|
||||
*FvwmGoodStuffFont -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*
|
||||
|
||||
*FvwmGoodStuff Resize resize.xpm Resize
|
||||
*FvwmGoodStuff Move arrows2.xpm Move
|
||||
*FvwmGoodStuff Lower Down Lower
|
||||
*FvwmGoodStuff Raise Up Raise
|
||||
*FvwmGoodStuff Kill bomb.xpm Destroy
|
||||
|
||||
*FvwmGoodStuff Dopey rterm.xpm Exec "big_win" xterm -T big_win -geometry 80x50
|
||||
*FvwmGoodStuff Snoopy rterm.xpm Exec "small_win" xterm -T small_wi
|
||||
*FvwmGoodStuff Xcalc rcalc.xpm Exec "Calculator" xcalc
|
||||
*FvwmGoodStuff XMag magnifying_glass2.xpm Exec "xmag" xmag
|
||||
*FvwmGoodStuff Mail mail2.xpm Exec "xmh" xmh
|
||||
*FvwmGoodStuff(4x1) - whatever SwallowModule "Fvwm Pager" FvwmPager 0 3
|
||||
.sp
|
||||
.fi
|
||||
|
||||
The last line is a little tricky - it spawns an FvwmPager module, and
|
||||
captures it to display in a quadruple width button. Since "-" is used
|
||||
for the button label, the Pager will be resized to be as big as
|
||||
possible within the button's borders. "whatever", of course, is a
|
||||
non-existent icon file, and will be ignored by FvwmGoodStuff.
|
||||
|
||||
.SH AUTHOR
|
||||
Robert Nation
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,70 +0,0 @@
|
||||
#include "fvwmlib.h"
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* Subroutine Prototypes
|
||||
*
|
||||
*************************************************************************/
|
||||
extern void CreateWindow(void);
|
||||
extern Pixel GetColor(char *name);
|
||||
extern Pixel GetHilite(Pixel background);
|
||||
extern Pixel GetShadow(Pixel background);
|
||||
extern void nocolor(char *a, char *b);
|
||||
extern void RedrawWindow(int);
|
||||
extern void match_string(char *tline);
|
||||
extern void Loop(void);
|
||||
extern void ParseOptions(void);
|
||||
extern char *safemalloc(int length);
|
||||
extern void change_window_name(char *str);
|
||||
extern int My_XNextEvent(Display *dpy, XEvent *event);
|
||||
extern void RelieveWindow(Window win,int x,int y,int w,int h,GC rGC,GC sGC);
|
||||
extern void DeadPipe(int nonsense);
|
||||
extern void LoadIconFile(int button);
|
||||
extern void CreateIconWindow(int button);
|
||||
extern void ConfigureIconWindow(int button,int row, int column);
|
||||
extern void DrawIconWindow(int button);
|
||||
extern void GetBitmapFile(int button);
|
||||
extern void GetXPMFile(int button);
|
||||
void process_message(unsigned long type,unsigned long *body);
|
||||
extern void send_clientmessage (Display *disp, Window w, Atom a, Time timestamp);
|
||||
void swallow(unsigned long *body);
|
||||
void ConstrainSize (XSizeHints *hints, int *widthp, int *height);
|
||||
|
||||
extern Display *dpy; /* which display are we talking to */
|
||||
extern Window Root;
|
||||
extern Window main_win;
|
||||
extern int screen;
|
||||
extern int d_depth;
|
||||
extern Pixel back_pix, fore_pix;
|
||||
extern GC NormalGC;
|
||||
extern GC ReliefGC;
|
||||
extern int ButtonWidth,ButtonHeight;
|
||||
extern XFontStruct *font;
|
||||
#define MAX_BUTTONS 100
|
||||
|
||||
struct button_info
|
||||
{
|
||||
char *action;
|
||||
char *title;
|
||||
char *icon_file;
|
||||
int BWidth; /* Width of this button in "buttons" */
|
||||
int BHeight;
|
||||
int icon_w;
|
||||
int icon_h;
|
||||
Pixmap iconPixmap; /* pixmap for the icon */
|
||||
Pixmap icon_maskPixmap; /* pixmap for the icon mask */
|
||||
Window IconWin;
|
||||
XSizeHints hints;
|
||||
int icon_depth;
|
||||
char *hangon;
|
||||
char up;
|
||||
char swallow;
|
||||
char module;
|
||||
char used;
|
||||
};
|
||||
|
||||
extern struct button_info Buttons[MAX_BUTTONS];
|
||||
|
||||
extern char *iconPath;
|
||||
extern char *pixmapPath;
|
||||
|
||||
@@ -1,242 +0,0 @@
|
||||
/* This module, and the entire GoodStuff program, and the concept for
|
||||
* interfacing this module to the Window Manager, are all original work
|
||||
* by Robert Nation
|
||||
*
|
||||
* Copyright 1993, Robert Nation. No guarantees or warantees or anything
|
||||
* are provided or implied in any way whatsoever. Use this program at your
|
||||
* own risk. Permission to use this program for any purpose is given,
|
||||
* as long as the copyright is kept intact. */
|
||||
/***********************************************************************
|
||||
*
|
||||
* Derived from fvwm icon code
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Intrinsic.h>
|
||||
|
||||
#ifdef HAVE_FNCTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include "FvwmGoodStuff.h"
|
||||
|
||||
#ifdef XPM
|
||||
#include <X11/xpm.h>
|
||||
#endif /* XPM */
|
||||
#ifdef SHAPE
|
||||
#include <X11/extensions/shape.h>
|
||||
#endif /* SHAPE */
|
||||
|
||||
extern int xpad;
|
||||
extern int ypad;
|
||||
extern int framew;
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Loads an icon file into a pixmap
|
||||
*
|
||||
****************************************************************************/
|
||||
void LoadIconFile(int button)
|
||||
{
|
||||
#ifndef NO_ICONS
|
||||
/* First, check for a monochrome bitmap */
|
||||
if(Buttons[button].icon_file != NULL)
|
||||
GetBitmapFile(button);
|
||||
|
||||
/* Next, check for a color pixmap */
|
||||
if((Buttons[button].icon_file != NULL)&&
|
||||
(Buttons[button].icon_w == 0)&&(Buttons[button].icon_h == 0))
|
||||
GetXPMFile(button);
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Creates an Icon Window
|
||||
*
|
||||
****************************************************************************/
|
||||
void CreateIconWindow(int button)
|
||||
{
|
||||
#ifndef NO_ICONS
|
||||
unsigned long valuemask; /* mask for create windows */
|
||||
XSetWindowAttributes attributes; /* attributes for create windows */
|
||||
|
||||
if((Buttons[button].icon_w == 0)&&(Buttons[button].icon_h == 0))
|
||||
return;
|
||||
|
||||
attributes.background_pixel = back_pix;
|
||||
attributes.event_mask = ExposureMask;
|
||||
valuemask = CWEventMask | CWBackPixel;
|
||||
|
||||
Buttons[button].IconWin =
|
||||
XCreateWindow(dpy, main_win, 0, 0, Buttons[button].icon_w,
|
||||
Buttons[button].icon_w, 0, CopyFromParent,
|
||||
CopyFromParent,CopyFromParent,valuemask,&attributes);
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Combines icon shape masks after a resize
|
||||
*
|
||||
****************************************************************************/
|
||||
void ConfigureIconWindow(int button,int row, int column)
|
||||
{
|
||||
#ifndef NO_ICONS
|
||||
int x,y,w,h;
|
||||
int xoff,yoff;
|
||||
Pixmap temp;
|
||||
|
||||
if((Buttons[button].icon_w == 0)&&(Buttons[button].icon_h == 0))
|
||||
return;
|
||||
|
||||
if(Buttons[button].swallow != 0)
|
||||
return;
|
||||
|
||||
w = Buttons[button].icon_w;
|
||||
h = Buttons[button].icon_h;
|
||||
if(w > Buttons[button].BWidth*ButtonWidth - 2*(xpad+framew))
|
||||
w = Buttons[button].BWidth*ButtonWidth - 2*(xpad+framew);
|
||||
if(strcmp(Buttons[button].title,"-")==0 || font==NULL)
|
||||
{
|
||||
if(h>Buttons[button].BHeight*ButtonHeight-2*(ypad+framew))
|
||||
h= Buttons[button].BHeight*ButtonHeight-2*(ypad+framew);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(h>Buttons[button].BHeight*ButtonHeight-2*(ypad+framew)-font->ascent-font->descent)
|
||||
h= Buttons[button].BHeight*ButtonHeight-2*(ypad+framew)-font->ascent-font->descent;
|
||||
}
|
||||
|
||||
if(w < 1)
|
||||
w = 1;
|
||||
if(h < 1)
|
||||
h = 1;
|
||||
|
||||
x = column*ButtonWidth;
|
||||
y = row*ButtonHeight;
|
||||
xoff = (Buttons[button].BWidth*ButtonWidth - w)>>1;
|
||||
if(strcmp(Buttons[button].title,"-")==0 || font==NULL)
|
||||
{
|
||||
yoff = (Buttons[button].BHeight*ButtonHeight - h)>>1;
|
||||
}
|
||||
else
|
||||
{
|
||||
yoff = (Buttons[button].BHeight*ButtonHeight - (h + font->ascent + font->descent))>>1;
|
||||
}
|
||||
|
||||
if(xoff < 2)
|
||||
xoff = 2;
|
||||
if(yoff < 2)
|
||||
yoff = 2;
|
||||
x += xoff;
|
||||
y += yoff;
|
||||
|
||||
XMoveResizeWindow(dpy, Buttons[button].IconWin, x,y,w,h);
|
||||
|
||||
#ifdef XPM
|
||||
#ifdef SHAPE
|
||||
if (Buttons[button].icon_maskPixmap != None)
|
||||
{
|
||||
xoff = (w - Buttons[button].icon_w)>>1;
|
||||
yoff = (h - Buttons[button].icon_h)>>1;
|
||||
XShapeCombineMask(dpy, Buttons[button].IconWin, ShapeBounding, 0, 0,
|
||||
Buttons[button].icon_maskPixmap, ShapeSet);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if(Buttons[button].icon_depth == -1)
|
||||
{
|
||||
temp = Buttons[button].iconPixmap;
|
||||
Buttons[button].iconPixmap =
|
||||
XCreatePixmap(dpy,Root, Buttons[button].icon_w,
|
||||
Buttons[button].icon_h,d_depth);
|
||||
XCopyPlane(dpy,temp,Buttons[button].iconPixmap,NormalGC,
|
||||
0,0,Buttons[button].icon_w,Buttons[button].icon_h,
|
||||
0,0,1);
|
||||
}
|
||||
XSetWindowBackgroundPixmap(dpy, Buttons[button].IconWin,Buttons[button].iconPixmap);
|
||||
|
||||
XClearWindow(dpy,Buttons[button].IconWin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* Looks for a monochrome icon bitmap file
|
||||
*
|
||||
**************************************************************************/
|
||||
void GetBitmapFile(int button)
|
||||
{
|
||||
#ifndef NO_ICONS
|
||||
char *path = NULL;
|
||||
int HotX,HotY;
|
||||
|
||||
path = findIconFile(Buttons[button].icon_file, iconPath,R_OK);
|
||||
if(path == NULL)return;
|
||||
|
||||
if(XReadBitmapFile (dpy, Root,path,(unsigned int *)&Buttons[button].icon_w,
|
||||
(unsigned int *)&Buttons[button].icon_h,
|
||||
&Buttons[button].iconPixmap,
|
||||
(int *)&HotX,
|
||||
(int *)&HotY) != BitmapSuccess)
|
||||
{
|
||||
Buttons[button].icon_w = 0;
|
||||
Buttons[button].icon_h = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buttons[button].icon_depth = -1;
|
||||
}
|
||||
Buttons[button].icon_maskPixmap = None;
|
||||
free(path);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Looks for a color XPM icon file
|
||||
*
|
||||
****************************************************************************/
|
||||
void GetXPMFile(int button)
|
||||
{
|
||||
#ifndef NO_ICONS
|
||||
#ifdef XPM
|
||||
XWindowAttributes root_attr;
|
||||
XpmAttributes xpm_attributes;
|
||||
char *path = NULL;
|
||||
|
||||
path = findIconFile(Buttons[button].icon_file, pixmapPath,R_OK);
|
||||
if(path == NULL)return;
|
||||
|
||||
XGetWindowAttributes(dpy,Root,&root_attr);
|
||||
xpm_attributes.colormap = root_attr.colormap;
|
||||
xpm_attributes.valuemask = XpmSize | XpmReturnPixels|XpmColormap;
|
||||
if(XpmReadFileToPixmap(dpy, Root, path,
|
||||
&Buttons[button].iconPixmap,
|
||||
&Buttons[button].icon_maskPixmap,
|
||||
&xpm_attributes) == XpmSuccess)
|
||||
{
|
||||
Buttons[button].icon_w = xpm_attributes.width;
|
||||
Buttons[button].icon_h = xpm_attributes.height;
|
||||
Buttons[button].icon_depth = d_depth;
|
||||
}
|
||||
free(path);
|
||||
#endif /* XPM */
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
/*
|
||||
FvwmPipe v0.1 Copyright 1996 Matthias Ettrich
|
||||
(ettrich@informatik.uni-tuebingen.de)
|
||||
Permission is granted to distribute this software freely
|
||||
for any purpose as long as the copyright and this
|
||||
copyright notice remain intact.
|
||||
|
||||
Simple hacked module to control fvwm from outside.
|
||||
When invoked this module creates a pipe "$HOME/.fvwmpipe.in".
|
||||
Whatever you write to this pipe will be passed through to fvwm.
|
||||
For example:
|
||||
echo "restart" > $HOME/.fvwmpipe.in
|
||||
(restarts fvwm)
|
||||
or
|
||||
echo "AddtoMenu \"StartMenu\" \"Emacs\" Exec emacs " > $HOME/.fvwmpipe.in
|
||||
(adds emacs to the StartMenu)
|
||||
or
|
||||
echo "DestroyMenu \"StartMenu\" " > $HOME/.fvwmpipe.in
|
||||
(destroys the StartMenu)
|
||||
|
||||
The module makes it possible to write config-tools for fvwm
|
||||
in any language, for example TCL/TK.
|
||||
|
||||
The code is somewhat based on the FvwmTalk module.
|
||||
*/
|
||||
|
||||
/* This module, and the entire NoClutter program, and the concept for
|
||||
* interfacing this module to the Window Manager, are all original work
|
||||
* by Robert Nation
|
||||
*
|
||||
* Copyright 1994, Robert Nation. No guarantees or warantees or anything
|
||||
* are provided or implied in any way whatsoever. Use this program at your
|
||||
* own risk. Permission to use this program for any purpose is given,
|
||||
* as long as the copyright is kept intact. */
|
||||
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE
|
||||
|
||||
#define UPDATE_ONLY 1
|
||||
#define ALL 2
|
||||
#define PROP_SIZE 1024
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if HAVE_SYS_BSDTYPES
|
||||
#include <sys/bsdtypes.h> /* Saul */
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#if HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "fvwmlib.h"
|
||||
#include "../../fvwm/module.h"
|
||||
|
||||
char *MyName;
|
||||
int fd_width;
|
||||
int fd[2];
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Procedure:
|
||||
* SIGPIPE handler - SIGPIPE means fvwm is dying
|
||||
*
|
||||
***********************************************************************/
|
||||
void DeadPipe(int nonsense)
|
||||
{
|
||||
fprintf(stderr,"FvwmPipe: dead pipe\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
void Loop(int *fvwmfd){
|
||||
int fd;
|
||||
int res;
|
||||
char s[256];
|
||||
int a,i;
|
||||
char* Home;
|
||||
int HomeLen;
|
||||
char* inpipename;
|
||||
fd_set fdset;
|
||||
|
||||
Home = getenv("HOME");
|
||||
if (Home == NULL)
|
||||
Home = "./";
|
||||
HomeLen = strlen(Home);
|
||||
inpipename = safemalloc(HomeLen + 17);
|
||||
strcpy(inpipename,Home);
|
||||
strcat(inpipename,"/.fvwmpipe.in");
|
||||
|
||||
fd = open(inpipename, O_RDWR|O_NONBLOCK);
|
||||
if (fd){
|
||||
/* send an empty message to end elder FvwmPipes */
|
||||
write (fd, "\n", 1);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
mkfifo(inpipename, 0600);
|
||||
fd = open(inpipename, O_RDONLY|O_NONBLOCK);
|
||||
if (fd<0){
|
||||
fprintf(stderr,"FvwmPipe: cannot create %s\n", inpipename);
|
||||
exit(0);
|
||||
}
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(fd, &fdset);
|
||||
FD_SET(fvwmfd[1], &fdset);
|
||||
while (1){
|
||||
select(fd_width,SELECT_TYPE_ARG234 &fdset, 0, 0, NULL);
|
||||
if (FD_ISSET(fd, &fdset)){
|
||||
/* read from the fvwmpipe.in and send the stuff to fvwm */
|
||||
res = read(fd, s, 255);
|
||||
if(res>=0) {
|
||||
s[res] = '\0';
|
||||
a = 0;
|
||||
for (i=0; i<res;i++)
|
||||
if (s[i] == '\n'){
|
||||
s[i] = '\0';
|
||||
SendText(fvwmfd,(s+a),0);
|
||||
a = i+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* ignore what comes from fvwm but empty the pipe */
|
||||
do {
|
||||
res = read(fvwmfd[1], s, 99);
|
||||
} while (res >= 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *temp, *s;
|
||||
|
||||
/* Save the program name - its used for error messages and option parsing */
|
||||
temp = argv[0];
|
||||
|
||||
s=strrchr(argv[0], '/');
|
||||
if (s != NULL)
|
||||
temp = s + 1;
|
||||
|
||||
MyName = safemalloc(strlen(temp)+2);
|
||||
strcpy(MyName,"*");
|
||||
strcat(MyName, temp);
|
||||
|
||||
if((argc != 6)&&(argc != 7))
|
||||
{
|
||||
fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",MyName,
|
||||
VERSION);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Save the program name - its used for error messages and option parsing */
|
||||
temp = argv[0];
|
||||
|
||||
s=strrchr(argv[0], '/');
|
||||
if (s != NULL)
|
||||
temp = s + 1;
|
||||
|
||||
MyName = safemalloc(strlen(temp)+2);
|
||||
strcpy(MyName,"*");
|
||||
strcat(MyName, temp);
|
||||
|
||||
/* Dead pipes mean fvwm died */
|
||||
signal (SIGPIPE, DeadPipe);
|
||||
|
||||
fd[0] = atoi(argv[1]);
|
||||
fd[1] = atoi(argv[2]);
|
||||
|
||||
fd_width = GetFdWidth();
|
||||
Loop(fd);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
Bugs detected with Bounds Checking:
|
||||
|
||||
FvwmScript.c:146 XOpenDisplay
|
||||
FvwmScript.c:231 XAllocNamedColor, XParseColor
|
||||
Only works with colors named "#??????"
|
||||
FvwmScript.c:315 XSetWMProtocols
|
||||
PushButton.c:31 XCreateFontCursor
|
||||
@@ -1,373 +0,0 @@
|
||||
.\" t
|
||||
.\" @(#)fvwm.1 17/2/97
|
||||
.de EX \"Begin example
|
||||
.ne 5
|
||||
.if n .sp 1
|
||||
.if t .sp .5
|
||||
.nf
|
||||
.in +.5i
|
||||
..
|
||||
.de EE
|
||||
.fi
|
||||
.in -.5i
|
||||
.if n .sp 1
|
||||
.if t .sp .5
|
||||
..
|
||||
.ta .3i .6i .9i 1.2i 1.5i 1.8i
|
||||
.TH FVWM 2.xx "late 20th century"
|
||||
.UC
|
||||
.TH FvwmScript 3.1
|
||||
.SH NAME
|
||||
FvwmScript - module to build graphic user interface
|
||||
.SH SYNOPSIS
|
||||
FvwmScript must be spawned by Fvwm.
|
||||
It will not work from the command line.
|
||||
.SH DESCRIPTION
|
||||
FvwmScript is a module which allows to build many graphical
|
||||
applications such as desktop accessories, button panel with popup
|
||||
menu, modal dialog... At the startup, FvwmScript reads
|
||||
the file which is specified in the command line. This file contains the script.
|
||||
This script is not included in the configuration file of Fvwm.
|
||||
|
||||
.SH INVOCATION
|
||||
FvwmScript can be invoked by inserting the line `Module
|
||||
FvwmScript name_of_script' in the .fvwmrc file. All scripts used by FvwmScript are
|
||||
located in a directory whom is specified in .fvwmrc by the
|
||||
command line `*FvwmScriptPath path_of_the_script_directory'.
|
||||
This can be placed on a line by itself, if FvwmScript is to be spawned during
|
||||
fvwm's initialization, or can be bound to a menu or mouse
|
||||
button or keystroke to invoke it later. Fvwm will search
|
||||
directory specified in the ModulePath configuration option
|
||||
to attempt to locate FvwmScript.
|
||||
|
||||
Be sure to set ModulePath in your .fvwmrc file to include FvwmScript's path.
|
||||
.SH ANATOMY OF A SCRIPT
|
||||
FvwmScript uses a particular programming langage. A script is composed of four
|
||||
parts. Heading contains general characteristics of the window and default properties
|
||||
for all widgets. The second part contains instructions whom are executed at the
|
||||
startup of the script. The third part contains periodic tasks whom is executed every 1
|
||||
second. And the last one contains the description of widgets.
|
||||
A widget consists of eleven types of items: text labels, single-line text inputs,
|
||||
radio buttons, checkbox, push buttons, horizontal and vertical scrollbars, rectangles,
|
||||
popup-menus, swallowexecs and mini scrollbars.
|
||||
.SH HEADING OF A SCRIPT
|
||||
The syntaxe is as follow:
|
||||
|
||||
.IP "WindowTitle \fIstring\fP"
|
||||
This option sets the window title.
|
||||
|
||||
.IP "WindowSize \fIwidth height\fP"
|
||||
This option sets window size. \fIwidth\fP and \fIheight\fP are numerical value.
|
||||
|
||||
.IP "WindowPosition \fIx y\fP"
|
||||
This option sets window position. \fIx\fP and \fIy\fP are numerical value.
|
||||
|
||||
.IP "ForeColor {\fIcolor\fP}"
|
||||
This option sets the default foreground color for all widgets.
|
||||
|
||||
.IP "BackColor {\fIcolor\fP}"
|
||||
This option sets the default background color for all widgets.
|
||||
|
||||
.IP "HilightColor {\fIcolor\fP}"
|
||||
This option sets the default hilight color for all widgets.
|
||||
|
||||
.IP "ShadowColor {\fIcolor\fP}"
|
||||
This option sets the default shadow color for all widgets.
|
||||
|
||||
.IP "Font {\fIfont\fP}"
|
||||
This option sets the default font color for all widgets.
|
||||
|
||||
.SH INITIALISATION
|
||||
This part contains instructions which will be executed at the startup.
|
||||
For example:
|
||||
.EX
|
||||
Init
|
||||
Begin
|
||||
Do "Exec cat tada.voc > /dev/dsp"
|
||||
WarpPointer 1
|
||||
Set $ToDo=Restart
|
||||
End
|
||||
.EE
|
||||
These instructions are used to play a sound, move the pointer
|
||||
to widget 1 and to initialize $ToDo to "Restart" at every startup.
|
||||
|
||||
.SH PERIODIC TASKS
|
||||
This part of the script contains some instructions whom are executed every second.
|
||||
For example:
|
||||
.EX
|
||||
Periodic Task
|
||||
Begin
|
||||
If (RemainderOfDiv (GetTime) 10)==0 Then
|
||||
Do {Exec xcalc}
|
||||
End
|
||||
.EE
|
||||
This example shows how to launch xcalc every 10 seconds.
|
||||
|
||||
.SH MAIN OF A SCRIPT
|
||||
The second part of the script contains the description for every widget
|
||||
which will be used in the program. A description of widget is composed of
|
||||
two parts. Fisrt part describes initial properties and second part contains
|
||||
instructions which will be executed when the widget receives messages.
|
||||
All widgets can send and receive messages. All message are identify by
|
||||
a number. The message "UserAction" is sent to a widget when user has
|
||||
altered this one. The syntax is as following:
|
||||
.EX
|
||||
Widget id # Set the id widget
|
||||
Property
|
||||
Type string
|
||||
Size width height
|
||||
Position x y
|
||||
Title { string }
|
||||
Value int
|
||||
MaxValue int
|
||||
MinValue int
|
||||
Font string
|
||||
ForeColor { color }
|
||||
BackColor { color }
|
||||
HilightColor { color }
|
||||
ShadowColor { Color }
|
||||
Flags Hidden and/or NoReliefString
|
||||
.EE
|
||||
The option 'Flags` is used to specify if the widget is hidden or not and
|
||||
if strings are drew with relief or not.
|
||||
|
||||
.EX
|
||||
Main
|
||||
Case Message of
|
||||
SingleClic:
|
||||
Begin
|
||||
# list of instructions which will be
|
||||
# executed when widget receives
|
||||
# message "SingleClic". This message is
|
||||
# generated by the user.
|
||||
End
|
||||
1:
|
||||
Begin
|
||||
# list of instructions which will be
|
||||
# executed when widget receives
|
||||
# message 1
|
||||
End
|
||||
End
|
||||
.EE
|
||||
|
||||
.SH LIST OF WIDGETS
|
||||
There is fifteen types of widgets.
|
||||
|
||||
.IP "\fBItemDraw\fP: Display an icon and/or a string."
|
||||
|
||||
\fBTitle\fP: string to display.
|
||||
|
||||
\fBIcon\fP: icon to display.
|
||||
|
||||
.IP "\fBPushButton\fP: Display push button with an icon and/or a string."
|
||||
|
||||
\fBTitle\fP: this string has the following syntax {Title of the button|Option 1|Option 2|
|
||||
Option3|...|Option N}. "Option 1|Option 2|...|Option N" is the popup menu which is
|
||||
displayed when pressing the right button.
|
||||
|
||||
\fBIcon\fP: icon to display.
|
||||
|
||||
.IP "\fBRadioButton\fP: Display radio button with a string."
|
||||
|
||||
\fBTitle\fP: title of the radio button.
|
||||
|
||||
\fBValue\fP: if Value is equal to 1, the box is checked else it is not.
|
||||
|
||||
.IP "\fBCheckBox\fP: Display check box with a string."
|
||||
|
||||
\fBTitle\fP: title of the check box.
|
||||
|
||||
\fBValue\fP: if Value is equal to 1, the box is checked else it is not.
|
||||
|
||||
.IP "\fBTextField\fP: Display a text input field. The text input field can be used to edit a single-line string."
|
||||
|
||||
\fBTitle\fP: content of text field.
|
||||
|
||||
\fBValue\fP: position of the insert point.
|
||||
|
||||
.IP "\fBHScrollBar\fP: Display an horizontal scrollbar."
|
||||
|
||||
\fBValue\fP: position of the thumb.
|
||||
|
||||
\fBMaxValue\fP: upper limit of Value.
|
||||
|
||||
\fBMinValue\fP: lower limit of Value.
|
||||
|
||||
.IP "\fBVScrollBar\fP: Display a vertical scrollbar."
|
||||
|
||||
\fBValue\fP: position of the thumb.
|
||||
|
||||
\fBMaxValue\fP: upper limit of Value.
|
||||
|
||||
\fBMinValue\fP: lower limit of Value.
|
||||
|
||||
.IP "\fBMiniScrollBar\fP: Display a very small vertical scrollbar."
|
||||
|
||||
\fBValue\fP: position of the thumb.
|
||||
|
||||
\fBMaxValue\fP: upper limit of Value.
|
||||
|
||||
\fBMinValue\fP: lower limit of Value.
|
||||
|
||||
.IP "\fBRectangle\fP: Display a rectangle. This type of widget can be used to decorate window."
|
||||
|
||||
.IP "\fBSwallowExec\fP: This type of widget causes FvwmScript to spawn an process, and capture the first window whose name or resource is equal to Title, and display it in the script window."
|
||||
|
||||
\fBTitle\fP: specify the window name which be captured and displayed in the script window.
|
||||
|
||||
\fBSwallowExec\fP: specify the command line to execute to spawn the process. Modules canalso be swallowed.
|
||||
|
||||
\fBValue\fP: specify the looking of the border. Possible value: -1, 0, 1.
|
||||
|
||||
.IP "\fBPopupMenu\fP: Display a popup menu."
|
||||
|
||||
\fBValue\fP: specify what option is selected.
|
||||
|
||||
\fBTitle\fP: the title has the following syntax: {Option 1|Option 2|...|Option N}."Option 1|Option 2|...|Option N" is the popup menu which is displayed when pressing mouse button.
|
||||
|
||||
.IP "\fBHDipstick\fP: Display a horizontal dipstick. This widget can be used to display disk usage."
|
||||
|
||||
\fBValue\fP: specify the current value of the dipstick.
|
||||
|
||||
\fBMinValue\fP: specify the minimum value of the dipstick.
|
||||
|
||||
\fBMaxValue\fP: specify the maximum value of the dipstick.
|
||||
|
||||
.IP "\fBVDipstick\fP: Display a vertical dipstick."
|
||||
|
||||
\fBValue\fP: specify the current value of the dipstick.
|
||||
|
||||
\fBMinValue\fP: specify the minimum value of the dipstick.
|
||||
|
||||
\fBMaxValue\fP: specify the maximum value of the dipstick.
|
||||
|
||||
.IP "\fBList\fP: Display a list. List lets user to choose between various options."
|
||||
|
||||
\fBValue\fP: specify which option is selected.
|
||||
|
||||
\fBTitle\fP: title contains options displayed in the list. The syntaxe is the following:
|
||||
{Option 1|Option 2|...|Option N}. All menus are displayed at the top of window.
|
||||
|
||||
.IP "\fBMenu\fP: Display a menu whom lets user to choose a option."
|
||||
|
||||
\fBValue\fP: specify which option is selected.
|
||||
|
||||
\fBTitle\fP: title contains options displayed in the menu. The syntaxe is the following:
|
||||
{Option 1|Option 2|...|Option N}.
|
||||
|
||||
.SH INSTRUCTIONS
|
||||
|
||||
Here is the description of all instructions.
|
||||
|
||||
.IP "HideWidget \fIid\fP : hide the widget numbered \fIid\fP."
|
||||
|
||||
.IP "ShowWidget \fIid\fP: show the widget numbered \fIid\fP."
|
||||
|
||||
.IP "ChangeValue \fIid1 id2\fP: set the value of the widget numbered \fIid1\fP to \fIid2\fP."
|
||||
|
||||
.IP "ChangeMaxValue \fIid1 id2\fP: set the maximum value of the widget numbered \fIid1\fP to \fIid2\fP."
|
||||
|
||||
.IP "ChangeMinValue \fIid1 id2\fP: set the minimum value of the widget numbered \fIid1\fP to \fIid2\fP."
|
||||
|
||||
.IP "ChangeTitle \fIid1 id2\fP: set the title of the widget numbered \fIid1\fP to \fIid2\fP."
|
||||
|
||||
.IP "ChangeIcon \fIid1 id2\fP: set the icon of the widget numbered \fIid1\fP to \fIid2\fP."
|
||||
|
||||
.IP "ChangeForeColor \fIid1\fP {\fIcolor\fP}: set the foreground color of the widget numbered \fIid1\fP to {\fIcolor\fP}."
|
||||
|
||||
.IP "ChangeBackColor \fIid1\fP {\fIcolor\fP}: set the background color of the widget numbered \fIid1\fP to {\fIcolor\fP}.
|
||||
|
||||
|
||||
.IP "ChangePosition \fIid1 x y\fP: move the widget numbered \fIid1\fP to position (\fIx\fP,\fIy\fP)."
|
||||
|
||||
.IP "ChangeSize \fIid1 width height\fP: set the size of the widget numbered \fIid1\fP to (\fIwidth\fP,\fIheight\fP)."
|
||||
|
||||
.IP "ChangeFont \fIid1 newfont\fP: set the font of the widget numbered \fIid1\fP to \fInewfont\fP."
|
||||
|
||||
.IP "WarpPointer \fIid\fP: warp the mouse pointer into the widget numbered \fIid\fP."
|
||||
|
||||
.IP "WriteToFile \fIfilename\fP {\fIstr1\fP} {\fIstr2\fP} etc: write to the file \fIfilename\fP the string which is the concatenation of all arguments \fIstr1\fP, \fIstr2\fP, etc."
|
||||
|
||||
.IP "Do {\fIstr1\fP} {\fIstr2\fP} etc: execute the command which is the concatenation of all arguments \fIstr1\fP, \fIstr2\fP, etc."
|
||||
|
||||
.IP "Set $\fIvar\fP={\fIstr\fP1} {\fIstr2\fP} etc: concatenate all arguments to a string and set the variable $\fIvar\fP to this string."
|
||||
|
||||
.IP "Quit: quit the program."
|
||||
|
||||
.IP "SendSignal \fIid1 id2\fP: send a message numbered \fIid2\fP to widget \fIid1\fP."
|
||||
|
||||
.IP "SendToScript \fIid_script\fP {\fIstr1\fP1} {\fIstr2\fP} etc: send a message to the script identified by id_script. The message is the concatenation of str1, str2...
|
||||
|
||||
.SH ARGUMENTS
|
||||
Most of commands use arguments. There is two kinds of argument: numbers and strings.
|
||||
A numerical argument is a value which is between -32000 and +32000. A string is always
|
||||
surrounded with brace. Variables always begin with the character "$" and can contains both
|
||||
number and string.
|
||||
|
||||
.SH FUNCTIONS
|
||||
All functions are used as argument. Functions can return both string and number.
|
||||
The syntax is:
|
||||
.EX
|
||||
(function argument1 argument2 etc)
|
||||
.EE
|
||||
Here is the complete list of arguments:
|
||||
|
||||
.IP "(GetTitle \fIid\fP): return the title of the widget numbered \fIid\fP."
|
||||
|
||||
.IP "(GetValue \fIid\fP): return the current value of the widget numbered \fIid\fP."
|
||||
|
||||
.IP "(GetOutput {\fIstr\fP} \fIint1 int2\fP): executes the command \fIstr\fP, gets the standart output and returns the word which is in the line \fIint1\fP and in the position \fIint2\fP. If \fIint2\fP is equal to -1, GetOutput returns the complete line."
|
||||
|
||||
.IP "(NumToHex \fIint\fP): return the hexadecimal value of \fIint\fP."
|
||||
|
||||
.IP "(HexToNum {\fIstr\fP}): return the decimal value of \fIstr\fP, \fIstr\fP must be an hexadecimal value."
|
||||
|
||||
.IP "(Add \fIint1 int2\fP): return the result of (\fIint1\fP+\fIint2\fP)."
|
||||
|
||||
.IP "(Mult \fIint1 int2\fP): return the result of (\fIint1\fP*\fIint2\fP)."
|
||||
|
||||
.IP "(Div \fIint1 int2\fP): return the result of (\fIint1\fP/\fIint2\fP)."
|
||||
|
||||
.IP "(StrCopy {\fIstr\fP} \fIint1 int2\fP): return the string whom is between position int1 and int2. For example, (StrCopy {Hello} 1 2) returns {He}"
|
||||
|
||||
.IP "(LaunchScript {\fIstr\fP}): this function launch the script named str and return an identification number. This number is necessary to use these functions SendToScript and ReceivFromScript. The string str contains the script name and some arguments."
|
||||
|
||||
.IP "(GetScriptArgument {\fIint\fP}): this function return the argument script used in the function LaunchScript. If int is equal to zero, GetScriptArgument return the name of the script."
|
||||
|
||||
.IP "(GetScriptFather): this function return the identification number of the script father."
|
||||
|
||||
.IP "(ReceivFromScript {\fIint\fP}): this function return the message sended by the script numbered int."
|
||||
|
||||
.IP "(RemainderOfDiv {\fIint1 int2\fP}): this function return the remainder of the division (\fIint1\fP/\fIint2\fP)."
|
||||
|
||||
.IP "(GetTime): this function return the time in second."
|
||||
|
||||
.SH CONDITIONAL LOOPS
|
||||
There is three kind of conditional loops. The instruction "If-Then-Else" has the following syntax:
|
||||
.EX
|
||||
If $ToDo=={Open xcalc} Then
|
||||
Do {Exec xcalc &} # List of instructions
|
||||
Else
|
||||
Begin
|
||||
Do {Exec killall xcalc &} # List of instructions
|
||||
Do {Exec echo xcalc killed > /dev/console}
|
||||
End
|
||||
.EE
|
||||
The second part "Else-Begin-End" is optional. If the loop contains only one instruction, Begin and End can be omitted. The instruction "While-Do" as the following syntax:
|
||||
.EX
|
||||
While $i<5 Do
|
||||
Begin
|
||||
Set $i=(Add i 1) # List of instructions
|
||||
End
|
||||
.EE
|
||||
Two strings can be compared with "==" and two numbers can be compared with "<", "<=", "==", ">=", ">". The loop "For-Do-Begin-End" has the following syntax:
|
||||
.EX
|
||||
For $i=1 To 20 Do
|
||||
Begin
|
||||
Do {Exec xcalc &} # List of instructions
|
||||
End
|
||||
.EE
|
||||
.SH AUTHOR
|
||||
Frederic Cordier (cordie97@cui.unige.ch or f-cord96@univ-lyon1.fr).
|
||||
.SH CONTRIBUTOR
|
||||
Eddy J. Gurney (eddy@gizmo.aa.ans.net).
|
||||
@@ -1,756 +0,0 @@
|
||||
/* Copyright May 1996, Frederic Cordier. No guarantees or warantees are
|
||||
* provided or implied in any way whatsoever. Use this program at your own
|
||||
* risk. Permission to use, modify, and redistribute this program is hereby
|
||||
* given, provided that this copyright is kept intact.
|
||||
*/
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef MEMDEBUG /* For debugging */
|
||||
#include <unchecked.h>
|
||||
#endif
|
||||
|
||||
/* Variables utilise par l'analyseur syntaxique */
|
||||
extern ScriptProp *scriptprop;
|
||||
extern int nbobj; /* Nombre d'objets */
|
||||
extern int numligne; /* Numero de ligne */
|
||||
extern TabObj *tabobj; /* Tableau d'objets, limite=100 */
|
||||
extern char **TabVVar; /* Tableau des variables du sript */
|
||||
extern int TabIdObj[101];
|
||||
extern Bloc **TabIObj;
|
||||
extern CaseObj *TabCObj;
|
||||
#ifdef MEMDEBUG
|
||||
extern int __bounds_debug_no_checking;
|
||||
#endif
|
||||
|
||||
/* Constante de couleurs utilise dans le tableau TabColor */
|
||||
#define black 0
|
||||
#define white 1
|
||||
#define back 2
|
||||
#define fore 3
|
||||
#define shad 4
|
||||
#define li 5
|
||||
|
||||
|
||||
/* Variables globales */
|
||||
char *ScriptName; /* Nom du fichier contenat le script decrivant le GUI */
|
||||
char *ScriptPath;
|
||||
char *ModuleName;
|
||||
int fd[2]; /* pipe pair */
|
||||
int fd_err;
|
||||
int x_fd; /* fd for X */
|
||||
Window ref;
|
||||
|
||||
|
||||
extern void (*TabCom[30]) (int NbArg,long *TabArg);
|
||||
|
||||
X11base *x11base; /* Pour le serveur X */
|
||||
TypeBuffSend BuffSend; /* Pour les communication entre script */
|
||||
int grab_server = 0;
|
||||
struct XObj *tabxobj[100];
|
||||
char *Scrapt;
|
||||
Atom propriete,type;
|
||||
static Atom wm_del_win;
|
||||
char *pixmapPath = NULL;
|
||||
|
||||
extern void InitCom();
|
||||
|
||||
void Debug()
|
||||
{
|
||||
int i,j;
|
||||
|
||||
for (j=1;j<=nbobj;j++)
|
||||
for (i=0;i<=TabCObj[TabIdObj[j]].NbCase;i++)
|
||||
{
|
||||
/* Execution du bloc d'instruction */
|
||||
fprintf(stderr,"Id de l'objet %d\n",TabIdObj[j]);
|
||||
fprintf(stderr,"Nb Instruction %d\n",TabIObj[TabIdObj[j]][i].NbInstr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Lecture du fichier contenant le scipt */
|
||||
void ReadConfig (char *ScriptName)
|
||||
{
|
||||
extern FILE *yyin;
|
||||
char s[255];
|
||||
|
||||
sprintf(s,"%s/%s",ScriptPath,ScriptName);
|
||||
yyin=fopen(s,"r");
|
||||
if (yyin == NULL)
|
||||
{
|
||||
fprintf(stderr,"Can't open the script %s",s);
|
||||
exit(1);
|
||||
}
|
||||
/* On ne redefini pas yyout qui est la sortie standard */
|
||||
|
||||
/* Application de l'analyseur syntaxique et lexical */
|
||||
yyparse();
|
||||
/* Fermeture du script */
|
||||
|
||||
fclose(yyin);
|
||||
}
|
||||
|
||||
/* Quitter par l'option Delete du bouton de la fenetre */
|
||||
void DeadPipe(int nonsense)
|
||||
{
|
||||
Quit (0,NULL);
|
||||
}
|
||||
|
||||
/* Lecture du fichier system.fvwmrc ou .fvwmrc */
|
||||
void ParseOptions(void)
|
||||
{
|
||||
char *tline;
|
||||
|
||||
GetConfigLine(fd,&tline);
|
||||
while(tline != (char *)0)
|
||||
{
|
||||
if((strlen(&tline[0])>1)&&(strncasecmp(tline,"PixmapPath",10)==0))
|
||||
{
|
||||
CopyString(&pixmapPath,&tline[10]);
|
||||
}
|
||||
|
||||
if((strlen(&tline[0])>1)&&(strncasecmp(tline,"*FvwmScriptPath",15)==0))
|
||||
{
|
||||
CopyString(&ScriptPath,&tline[15]);
|
||||
}
|
||||
GetConfigLine(fd,&tline);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Procedure d'initialisation du serveur X et des variables globales*/
|
||||
void Xinit(int IsFather)
|
||||
{
|
||||
char *name;
|
||||
Atom myatom;
|
||||
int i=16;
|
||||
|
||||
/* Connextion au serveur X */
|
||||
#ifdef MEMDEBUG
|
||||
__bounds_debug_no_checking=True;
|
||||
#endif
|
||||
|
||||
x11base->display=XOpenDisplay(NULL);
|
||||
if (x11base->display==NULL)
|
||||
{
|
||||
fprintf(stderr,"Enable to open display.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef MEMDEBUG
|
||||
__bounds_debug_no_checking=False;
|
||||
#endif
|
||||
|
||||
if (IsFather)
|
||||
{
|
||||
name=(char*)calloc(sizeof(char),strlen("FvwmScript")+5);
|
||||
do
|
||||
{
|
||||
sprintf(name,"%c%xFvwmScript",161,i);
|
||||
i++;
|
||||
myatom=XInternAtom(x11base->display,name,False);
|
||||
}
|
||||
while (XGetSelectionOwner(x11base->display,myatom)!=None);
|
||||
x11base->TabScriptId[1]=name;
|
||||
x11base->TabScriptId[0]=NULL;
|
||||
}
|
||||
|
||||
x11base->NbChild=0;
|
||||
x11base->screen=DefaultScreen(x11base->display);
|
||||
x11base->WhitePix=WhitePixel(x11base->display,x11base->screen);
|
||||
x11base->BlackPix=BlackPixel(x11base->display,x11base->screen);
|
||||
x11base->depth=XDefaultDepth(x11base->display,x11base->screen);
|
||||
x11base->colormap = DefaultColormap(x11base->display,x11base->screen);
|
||||
x11base->root = RootWindow(x11base->display,x11base->screen);
|
||||
x_fd = XConnectionNumber(x11base->display);
|
||||
}
|
||||
|
||||
/***********************/
|
||||
/* Lecture d'un icone */
|
||||
/***********************/
|
||||
void LoadIcon(struct XObj *xobj)
|
||||
{
|
||||
char *path = NULL;
|
||||
XWindowAttributes root_attr;
|
||||
XpmAttributes xpm_attributes;
|
||||
|
||||
if ((xobj->icon)!=NULL)
|
||||
{
|
||||
path = (char*)findIconFile(xobj->icon, pixmapPath,4);
|
||||
if(path == NULL)return;
|
||||
XGetWindowAttributes(xobj->display,RootWindow(xobj->display,DefaultScreen(xobj->display)),&root_attr);
|
||||
xpm_attributes.colormap = root_attr.colormap;
|
||||
xpm_attributes.valuemask = XpmSize | XpmReturnPixels|XpmColormap;
|
||||
if(XpmReadFileToPixmap(xobj->display, RootWindow(xobj->display,DefaultScreen(xobj->display)),
|
||||
path,
|
||||
&xobj->iconPixmap,
|
||||
&xobj->icon_maskPixmap,
|
||||
&xpm_attributes) == XpmSuccess)
|
||||
{
|
||||
xobj->icon_w = xpm_attributes.width;
|
||||
xobj->icon_h = xpm_attributes.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"Enable to load pixmap %s\n",xobj->icon);
|
||||
xobj->iconPixmap=None;
|
||||
xobj->icon_maskPixmap=None;
|
||||
}
|
||||
free(path);
|
||||
}
|
||||
}
|
||||
|
||||
int MyAllocNamedColor(Display *display,Colormap colormap,char* colorname,XColor* color)
|
||||
{
|
||||
static XColor TempColor;
|
||||
|
||||
if (colorname[0]=='#')
|
||||
{
|
||||
if (XParseColor(display,colormap,colorname,color))
|
||||
return XAllocColor(display,colormap,color);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (XLookupColor(display,colormap,colorname,&TempColor,color))
|
||||
return XAllocColor(display,colormap,color);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Ouvre une fenetre pour l'affichage du GUI */
|
||||
void OpenWindow ()
|
||||
{
|
||||
XTextProperty Name;
|
||||
XWMHints *IndicWM;
|
||||
XSizeHints *IndicNorm;
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
|
||||
/* Allocation des couleurs */
|
||||
MyAllocNamedColor(x11base->display,x11base->colormap,x11base->forecolor,&x11base->TabColor[fore]);
|
||||
MyAllocNamedColor(x11base->display,x11base->colormap,x11base->backcolor,&x11base->TabColor[back]);
|
||||
MyAllocNamedColor(x11base->display,x11base->colormap,x11base->shadcolor,&x11base->TabColor[shad]);
|
||||
MyAllocNamedColor(x11base->display,x11base->colormap,x11base->licolor,&x11base->TabColor[li]);
|
||||
MyAllocNamedColor(x11base->display,x11base->colormap,"#000000",&x11base->TabColor[black]);
|
||||
MyAllocNamedColor(x11base->display,x11base->colormap,"#FFFFFF",&x11base->TabColor[white]);
|
||||
|
||||
/* Definition des caracteristiques de la fentre */
|
||||
mask=0;
|
||||
mask|=CWBackPixel;
|
||||
Attr.background_pixel=x11base->TabColor[back].pixel;
|
||||
|
||||
x11base->win=XCreateWindow(x11base->display,
|
||||
DefaultRootWindow(x11base->display),
|
||||
x11base->size.x,
|
||||
x11base->size.y,
|
||||
x11base->size.width,
|
||||
x11base->size.height,0,
|
||||
CopyFromParent,
|
||||
InputOutput,
|
||||
CopyFromParent,
|
||||
mask,&Attr);
|
||||
|
||||
XSetWindowColormap(x11base->display,x11base->win,x11base->colormap);
|
||||
x11base->gc=XCreateGC(x11base->display,x11base->win,0,NULL);
|
||||
|
||||
/* Choix des evts recus par la fenetre */
|
||||
XSelectInput(x11base->display,x11base->win,KeyPressMask|ButtonPressMask|
|
||||
ExposureMask|ButtonReleaseMask|EnterWindowMask|LeaveWindowMask|ButtonMotionMask);
|
||||
XSelectInput(x11base->display,x11base->root,PropertyChangeMask);
|
||||
|
||||
/* Specification des parametres utilises par le gestionnaire de fenetre */
|
||||
if (XStringListToTextProperty(&x11base->title,1,&Name)==0)
|
||||
fprintf(stderr,"Can't use icon name\n");
|
||||
IndicNorm=XAllocSizeHints();
|
||||
if (x11base->size.x!=-1)
|
||||
{
|
||||
IndicNorm->x=x11base->size.x;
|
||||
IndicNorm->y=x11base->size.y;
|
||||
IndicNorm->flags=PSize|PMinSize|PMaxSize|PResizeInc|PBaseSize|PPosition;
|
||||
}
|
||||
else
|
||||
IndicNorm->flags=PSize|PMinSize|PMaxSize|PResizeInc|PBaseSize;
|
||||
IndicNorm->width=x11base->size.width;
|
||||
IndicNorm->height=x11base->size.height;
|
||||
IndicNorm->min_width=x11base->size.width;
|
||||
IndicNorm->min_height=x11base->size.height;
|
||||
IndicNorm->max_width=x11base->size.width;
|
||||
IndicNorm->max_height=x11base->size.height;
|
||||
IndicWM=XAllocWMHints();
|
||||
IndicWM->input=True;
|
||||
IndicWM->initial_state=NormalState;
|
||||
IndicWM->flags=InputHint|StateHint;
|
||||
XSetWMProperties(x11base->display,x11base->win,&Name,
|
||||
&Name,NULL,0,IndicNorm,IndicWM,NULL);
|
||||
Scrapt=(char*)calloc(sizeof(char),1);
|
||||
|
||||
/* Construction des atomes pour la communication inter-application */
|
||||
propriete=XInternAtom(x11base->display,"Prop_selection",False);
|
||||
wm_del_win = XInternAtom(x11base->display,"WM_DELETE_WINDOW",False);
|
||||
XSetWMProtocols(x11base->display,x11base->win,&wm_del_win,1);
|
||||
|
||||
}
|
||||
|
||||
/***********************************************/
|
||||
/* Execution d'une sequence d'instruction */
|
||||
/***********************************************/
|
||||
void ExecBloc(Bloc *bloc)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<=bloc->NbInstr;i++)
|
||||
{
|
||||
TabCom[bloc->TabInstr[i].Type](bloc->TabInstr[i].NbArg,bloc->TabInstr[i].TabArg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Construction de l'interface graphique */
|
||||
void BuildGUI(int IsFather)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
if (scriptprop->font==NULL)
|
||||
x11base->font=strdup("fixed");
|
||||
else
|
||||
x11base->font=scriptprop->font;
|
||||
|
||||
if (scriptprop->forecolor==NULL)
|
||||
x11base->forecolor=strdup("black");
|
||||
else
|
||||
x11base->forecolor=scriptprop->forecolor;
|
||||
|
||||
if (scriptprop->backcolor==NULL)
|
||||
x11base->backcolor=strdup("white");
|
||||
else
|
||||
x11base->backcolor=scriptprop->backcolor;
|
||||
|
||||
if (scriptprop->shadcolor==NULL)
|
||||
x11base->shadcolor=strdup("black");
|
||||
else
|
||||
x11base->shadcolor=scriptprop->shadcolor;
|
||||
|
||||
if (scriptprop->licolor==NULL)
|
||||
x11base->licolor=strdup("black");
|
||||
else
|
||||
x11base->licolor=scriptprop->licolor;
|
||||
|
||||
x11base->icon=scriptprop->icon;
|
||||
|
||||
x11base->size.x=scriptprop->x;
|
||||
x11base->size.y=scriptprop->y;
|
||||
x11base->size.width=scriptprop->width;
|
||||
x11base->size.height=scriptprop->height;
|
||||
x11base->title=scriptprop->titlewin;
|
||||
|
||||
/* Initialisation du serveur X et de la fenetre */
|
||||
|
||||
Xinit(IsFather);
|
||||
OpenWindow();
|
||||
|
||||
|
||||
/* Parcour de tous les objets graphiques */
|
||||
nbobj++;
|
||||
for (i=0;i<nbobj;i++)
|
||||
{
|
||||
tabxobj[i]=(struct XObj*)calloc(1,sizeof(struct XObj));
|
||||
tabxobj[i]->id=(*tabobj)[i].id;
|
||||
tabxobj[i]->x=(*tabobj)[i].x;
|
||||
tabxobj[i]->y=(*tabobj)[i].y;
|
||||
tabxobj[i]->width=(*tabobj)[i].width;
|
||||
tabxobj[i]->height=(*tabobj)[i].height;
|
||||
if (tabxobj[i]->width==0) tabxobj[i]->width=1;
|
||||
if (tabxobj[i]->height==0) tabxobj[i]->height=1;
|
||||
tabxobj[i]->value=(*tabobj)[i].value;
|
||||
tabxobj[i]->value2=(*tabobj)[i].value2;
|
||||
tabxobj[i]->value3=(*tabobj)[i].value3;
|
||||
tabxobj[i]->flags[0]=(*tabobj)[i].flags[0];
|
||||
tabxobj[i]->flags[1]=(*tabobj)[i].flags[1];
|
||||
tabxobj[i]->flags[2]=(*tabobj)[i].flags[2];
|
||||
tabxobj[i]->icon=(*tabobj)[i].icon;
|
||||
tabxobj[i]->swallow=(*tabobj)[i].swallow;
|
||||
|
||||
if ((*tabobj)[i].title==NULL)
|
||||
tabxobj[i]->title=(char*)calloc(1,200);
|
||||
else
|
||||
tabxobj[i]->title=(*tabobj)[i].title;
|
||||
|
||||
if ((*tabobj)[i].font==NULL)
|
||||
tabxobj[i]->font=(char*)strdup(x11base->font);
|
||||
else
|
||||
tabxobj[i]->font=(*tabobj)[i].font;
|
||||
|
||||
if ((*tabobj)[i].forecolor==NULL)
|
||||
tabxobj[i]->forecolor=(char*)strdup(x11base->forecolor);
|
||||
else
|
||||
tabxobj[i]->forecolor=(*tabobj)[i].forecolor;
|
||||
|
||||
if ((*tabobj)[i].backcolor==NULL)
|
||||
tabxobj[i]->backcolor=(char*)strdup(x11base->backcolor);
|
||||
else
|
||||
tabxobj[i]->backcolor=(*tabobj)[i].backcolor;
|
||||
|
||||
if ((*tabobj)[i].shadcolor==NULL)
|
||||
tabxobj[i]->shadcolor=(char*)strdup(x11base->shadcolor);
|
||||
else
|
||||
tabxobj[i]->shadcolor=(*tabobj)[i].shadcolor;
|
||||
|
||||
if ((*tabobj)[i].licolor==NULL)
|
||||
tabxobj[i]->licolor=strdup(x11base->licolor);
|
||||
else
|
||||
tabxobj[i]->licolor=(*tabobj)[i].licolor;
|
||||
|
||||
ChooseFunction(tabxobj[i],(*tabobj)[i].type);
|
||||
tabxobj[i]->gc=x11base->gc;
|
||||
tabxobj[i]->display=x11base->display;
|
||||
tabxobj[i]->ParentWin=&(x11base->win);
|
||||
tabxobj[i]->Screen=x11base->screen;
|
||||
tabxobj[i]->colormap=&(x11base->colormap);
|
||||
tabxobj[i]->iconPixmap=None;
|
||||
tabxobj[i]->icon_maskPixmap=None;
|
||||
|
||||
LoadIcon(tabxobj[i]); /* Chargement de l'icone du widget */
|
||||
|
||||
tabxobj[i]->InitObj(tabxobj[i]);
|
||||
}
|
||||
|
||||
/* Enregistrement du bloc de taches periodic */
|
||||
x11base->periodictasks=scriptprop->periodictasks;
|
||||
|
||||
/*Si un bloc d'initialisation du script existe, on l'execute ici */
|
||||
if (scriptprop->initbloc!=NULL)
|
||||
{
|
||||
ExecBloc(scriptprop->initbloc);
|
||||
free(scriptprop->initbloc->TabInstr);
|
||||
free(scriptprop->initbloc);
|
||||
}
|
||||
|
||||
free(tabobj);
|
||||
free(scriptprop);
|
||||
XMapRaised(x11base->display,x11base->win);
|
||||
for (i=0;i<nbobj;i++)
|
||||
if (tabxobj[i]->flags[0]!=True)
|
||||
XMapWindow(x11base->display,tabxobj[i]->win);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***********************************************/
|
||||
/* Fonction de traitement des msg entre objets */
|
||||
/***********************************************/
|
||||
void SendMsg(struct XObj *xobj,int TypeMsg)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<=TabCObj[TabIdObj[xobj->id]].NbCase;i++)
|
||||
if (TabCObj[TabIdObj[xobj->id]].LstCase[i]==TypeMsg)
|
||||
{
|
||||
/* Execution du bloc d'instruction */
|
||||
ExecBloc(&TabIObj[TabIdObj[xobj->id]][i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************/
|
||||
/* Appeler lors d'une demande de selection */
|
||||
/*******************************************/
|
||||
void SendMsgToScript(XEvent event)
|
||||
{
|
||||
Atom Sender,Receiver=None;
|
||||
static XEvent evnt_sel;
|
||||
int i;
|
||||
|
||||
Sender=XInternAtom(x11base->display,x11base->TabScriptId[1],True);
|
||||
|
||||
if (event.xselectionrequest.selection==Sender)
|
||||
{
|
||||
i=0;
|
||||
while ((i<BuffSend.NbMsg)&&(event.xselectionrequest.target!=Receiver))
|
||||
{
|
||||
Receiver=XInternAtom(x11base->display,BuffSend.TabMsg[i].R,True);
|
||||
i++;
|
||||
}
|
||||
i--;
|
||||
|
||||
evnt_sel.type=SelectionNotify;
|
||||
evnt_sel.xselection.requestor=event.xselectionrequest.requestor;
|
||||
evnt_sel.xselection.selection=event.xselectionrequest.selection;
|
||||
evnt_sel.xselection.target=Receiver;
|
||||
evnt_sel.xselection.time=event.xselectionrequest.time;
|
||||
|
||||
if (event.xselectionrequest.target==Receiver) /* On a trouve le recepteur */
|
||||
{
|
||||
evnt_sel.xselection.property=event.xselectionrequest.property;
|
||||
XChangeProperty(x11base->display,evnt_sel.xselection.requestor,
|
||||
evnt_sel.xselection.property,
|
||||
evnt_sel.xselection.target,
|
||||
8,PropModeReplace,BuffSend.TabMsg[i].Msg,strlen(BuffSend.TabMsg[i].Msg)+1);
|
||||
BuffSend.NbMsg--;
|
||||
free(BuffSend.TabMsg[i].Msg);
|
||||
if (BuffSend.NbMsg>0)
|
||||
{
|
||||
memmove(&BuffSend.TabMsg[i],&BuffSend.TabMsg[i+1],(BuffSend.NbMsg-i)*sizeof(TypeName));
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* Cas ou le recepteur demande un message et qu'il n'y en a pas */
|
||||
evnt_sel.xselection.property=None;
|
||||
}
|
||||
XSendEvent(x11base->display,evnt_sel.xselection.requestor,False,0,&evnt_sel);
|
||||
}
|
||||
}
|
||||
|
||||
/* read an X event */
|
||||
void ReadXServer ()
|
||||
{
|
||||
static XEvent event,evnt_sel;
|
||||
int i;
|
||||
char *octet;
|
||||
|
||||
while (XEventsQueued(x11base->display, QueuedAfterReading))
|
||||
{
|
||||
XNextEvent(x11base->display, &event);
|
||||
switch (event.type)
|
||||
{
|
||||
case Expose:
|
||||
if (event.xexpose.count==0)
|
||||
for (i=0;i<nbobj;i++)
|
||||
tabxobj[i]->DrawObj(tabxobj[i]);
|
||||
break;
|
||||
case KeyPress:
|
||||
/* Touche presse dans un objet */
|
||||
if (event.xkey.subwindow!=0)
|
||||
{
|
||||
/* Envoi de l'evt <20> l'objet */
|
||||
for (i=0;i<nbobj;i++)
|
||||
if (tabxobj[i]->win==event.xkey.subwindow)
|
||||
tabxobj[i]->EvtKey(tabxobj[i],&event.xkey);
|
||||
}
|
||||
break;
|
||||
case ButtonPress:
|
||||
/* Clique dans quel fenetre? */
|
||||
if (event.xbutton.subwindow!=0)
|
||||
{
|
||||
i=0;
|
||||
while ((tabxobj[i]->win!=event.xbutton.subwindow)&&(i<nbobj-1))
|
||||
i++;
|
||||
tabxobj[i]->EvtMouse(tabxobj[i],&event.xbutton);
|
||||
}
|
||||
break;
|
||||
case ButtonRelease:
|
||||
break;
|
||||
case EnterNotify:
|
||||
break;
|
||||
case LeaveNotify:
|
||||
break;
|
||||
case MotionNotify:
|
||||
break;
|
||||
case MappingNotify:
|
||||
XRefreshKeyboardMapping((XMappingEvent*)&event);
|
||||
break;
|
||||
case SelectionRequest:
|
||||
if (event.xselectionrequest.selection==XA_PRIMARY)
|
||||
{
|
||||
evnt_sel.type=SelectionNotify;
|
||||
evnt_sel.xselection.requestor=event.xselectionrequest.requestor;
|
||||
evnt_sel.xselection.selection=event.xselectionrequest.selection;
|
||||
evnt_sel.xselection.target=event.xselectionrequest.target;
|
||||
evnt_sel.xselection.time=event.xselectionrequest.time;
|
||||
evnt_sel.xselection.property=event.xselectionrequest.property;
|
||||
switch (event.xselectionrequest.target)
|
||||
{
|
||||
case XA_STRING:
|
||||
XChangeProperty(x11base->display,evnt_sel.xselection.requestor,
|
||||
evnt_sel.xselection.property,
|
||||
evnt_sel.xselection.target,
|
||||
8,PropModeReplace,Scrapt,strlen(Scrapt)+1);
|
||||
break;
|
||||
default:evnt_sel.xselection.property=None;
|
||||
}
|
||||
XSendEvent(x11base->display,evnt_sel.xselection.requestor,False,0,&evnt_sel);
|
||||
}
|
||||
else
|
||||
SendMsgToScript(event);
|
||||
break;
|
||||
case SelectionClear:
|
||||
if (event.xselectionclear.selection==XA_PRIMARY)
|
||||
UnselectAllTextField(tabxobj);
|
||||
break;
|
||||
case ClientMessage:
|
||||
if ((event.xclient.format==32) && (event.xclient.data.l[0]==wm_del_win))
|
||||
DeadPipe(1);
|
||||
break;
|
||||
case PropertyNotify:
|
||||
if (event.xproperty.atom==XA_CUT_BUFFER0)
|
||||
octet=XFetchBuffer(x11base->display,&i,0);
|
||||
else if (event.xproperty.atom==XA_CUT_BUFFER1)
|
||||
octet=XFetchBuffer(x11base->display,&i,1);
|
||||
else if (event.xproperty.atom==XA_CUT_BUFFER2)
|
||||
octet=XFetchBuffer(x11base->display,&i,2);
|
||||
else if (event.xproperty.atom==XA_CUT_BUFFER3)
|
||||
octet=XFetchBuffer(x11base->display,&i,3);
|
||||
else if (event.xproperty.atom==XA_CUT_BUFFER4)
|
||||
octet=XFetchBuffer(x11base->display,&i,4);
|
||||
else if (event.xproperty.atom==XA_CUT_BUFFER5)
|
||||
octet=XFetchBuffer(x11base->display,&i,5);
|
||||
else if (event.xproperty.atom==XA_CUT_BUFFER6)
|
||||
octet=XFetchBuffer(x11base->display,&i,6);
|
||||
else if (event.xproperty.atom==XA_CUT_BUFFER7)
|
||||
octet=XFetchBuffer(x11base->display,&i,7);
|
||||
else break;
|
||||
if (i>0)
|
||||
{
|
||||
Scrapt=(char*)realloc((void*)Scrapt,sizeof(char)*(i+1));
|
||||
Scrapt=strcpy(Scrapt,octet);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* main event loop */
|
||||
void MainLoop ()
|
||||
{
|
||||
fd_set in_fdset;
|
||||
unsigned long header[HEADER_SIZE];
|
||||
unsigned long *body;
|
||||
int count,i;
|
||||
struct timeval tv;
|
||||
int res;
|
||||
|
||||
while (1)
|
||||
{
|
||||
FD_ZERO(&in_fdset);
|
||||
FD_SET(x_fd,&in_fdset);
|
||||
FD_SET(fd[1],&in_fdset);
|
||||
|
||||
XFlush(x11base->display);
|
||||
|
||||
tv.tv_sec = 1;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
if (x11base->periodictasks!=NULL)
|
||||
res=select(32, SELECT_TYPE_ARG234 &in_fdset, NULL, NULL, &tv);
|
||||
else
|
||||
res=select(32, SELECT_TYPE_ARG234 &in_fdset, NULL, NULL, NULL);
|
||||
|
||||
if (res > 0)
|
||||
{
|
||||
if (FD_ISSET(x_fd, &in_fdset))
|
||||
ReadXServer();
|
||||
|
||||
if(FD_ISSET(fd[1], &in_fdset))
|
||||
{
|
||||
if((count = ReadFvwmPacket(fd[1], header, &body)) > 0)
|
||||
{
|
||||
for (i=0;i<nbobj;i++)
|
||||
tabxobj[i]->ProcessMsg(tabxobj[i],header[1],body);
|
||||
free(body);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (x11base->periodictasks!=NULL) /* Execution des taches periodics */
|
||||
ExecBloc(x11base->periodictasks);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadFvwmScriptArg(int argc, char **argv,int IsFather)
|
||||
{
|
||||
int i;
|
||||
Atom myatom;
|
||||
int FisrtArg;
|
||||
|
||||
BuffSend.NbMsg=0; /* Aucun message dans le buffer */
|
||||
|
||||
for (i=2;i<98;i++)
|
||||
x11base->TabScriptId[i]=NULL;
|
||||
|
||||
if (IsFather) /* Cas du pere */
|
||||
{
|
||||
myatom=XInternAtom(x11base->display,x11base->TabScriptId[1],True);
|
||||
XSetSelectionOwner(x11base->display,myatom,x11base->win,CurrentTime);
|
||||
FisrtArg=9;
|
||||
}
|
||||
else
|
||||
{ /* Cas du fils */
|
||||
x11base->TabScriptId[0]=(char*)calloc(sizeof(char),strlen(argv[7]));
|
||||
x11base->TabScriptId[0]=strncpy(x11base->TabScriptId[0],argv[7],strlen("FvwmScript")+3);
|
||||
x11base->TabScriptId[1]=argv[7];
|
||||
myatom=XInternAtom(x11base->display,x11base->TabScriptId[1],True);
|
||||
XSetSelectionOwner(x11base->display,myatom,x11base->win,CurrentTime);
|
||||
FisrtArg=8;
|
||||
}
|
||||
}
|
||||
|
||||
/* main procedure */
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
int IsFather;
|
||||
int i;
|
||||
|
||||
/* we get rid of the path from program name */
|
||||
ModuleName = argv[0];
|
||||
|
||||
/* On determine si le script a un pere */
|
||||
if (argc>=8)
|
||||
IsFather=(argv[7][0]!=(char)161);
|
||||
else
|
||||
IsFather=1;
|
||||
|
||||
|
||||
signal (SIGPIPE, DeadPipe);
|
||||
signal (SIGINT, DeadPipe); /* cleanup on other ways of closing too */
|
||||
signal (SIGHUP, DeadPipe);
|
||||
signal (SIGQUIT, DeadPipe);
|
||||
signal (SIGTERM, DeadPipe);
|
||||
|
||||
if (argc < 6)
|
||||
{
|
||||
fprintf(stderr,"%s must be started by Fvwm.\n", ModuleName);
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
if(argc>=7)
|
||||
{
|
||||
ScriptName = argv[6];
|
||||
ref = strtol(argv[4], NULL, 16);
|
||||
if (ref == 0) ref = None;
|
||||
fd[0] = atoi(argv[1]);
|
||||
fd[1] = atoi(argv[2]);
|
||||
SetMessageMask(fd, M_NEW_DESK | M_END_WINDOWLIST|
|
||||
M_MAP| M_RES_NAME| M_RES_CLASS| M_CONFIG_INFO|
|
||||
M_END_CONFIG_INFO| M_WINDOW_NAME);
|
||||
|
||||
/* Enregistrement des arguments du script */
|
||||
x11base=(X11base*) calloc(1,sizeof(X11base));
|
||||
x11base->TabArg[0]=ModuleName;
|
||||
for (i=8-IsFather;i<argc;i++)
|
||||
x11base->TabArg[i-7+IsFather]=argv[i];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"%s requires only the path of the script.\n", ModuleName);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ParseOptions();
|
||||
|
||||
SendText(fd,"Send_WindowList",0);
|
||||
|
||||
ReadConfig(ScriptName); /* Lecture et analyse du script */
|
||||
|
||||
InitCom(); /* Fonction d'initialisation de TabCom et TabFunc */
|
||||
|
||||
BuildGUI(IsFather); /* Construction des boutons et de la fenetre */
|
||||
|
||||
ReadFvwmScriptArg(argc,argv,IsFather);
|
||||
|
||||
MainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
How to install FvwmScript in the fvwm-2.0.45 tree.
|
||||
|
||||
1) Untar the distribution inside fvwm-2.0.45/modules/FvwmButtons
|
||||
|
||||
3) In that directory, type
|
||||
xmkmf; make Makefiles; make install
|
||||
This will install FvwmScript and script examples in the module directory.
|
||||
You can copy the file FvwmScript/Scripts/system.fvwmrc to ~/.fvwmrc.
|
||||
This is an example of the Fvwm configuration file. This one is necessary
|
||||
for using the script "DeskSetup".
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,169 +0,0 @@
|
||||
WindowTitle {Bell}
|
||||
WindowSize 360 230 # Taille
|
||||
WindowPosition 191 50 # Position
|
||||
ForeColor {black}
|
||||
BackColor {grey85}
|
||||
ShadowColor {grey55}
|
||||
HilightColor {grey100}
|
||||
Font -adobe-helvetica-bold-r-*-*-12-*
|
||||
|
||||
Init
|
||||
Begin
|
||||
WarpPointer 2
|
||||
ChangeValue 4 (GetOutput {xset -q} 7 3)
|
||||
ChangeTitle 6 (GetOutput {xset -q } 7 6)
|
||||
ChangeTitle 8 (GetOutput {xset -q} 7 9)
|
||||
End
|
||||
|
||||
Widget 1
|
||||
Property
|
||||
Size 50 30
|
||||
Position 100 180
|
||||
Type PushButton
|
||||
Title {Apply}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Do {Exec xset b } (GetValue 4) { } (GetTitle 6) { } (GetTitle 8)
|
||||
End
|
||||
End
|
||||
|
||||
Widget 2
|
||||
Property
|
||||
Size 50 30
|
||||
Position 190 180
|
||||
Type PushButton
|
||||
Title {OK}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Do {Exec xset b } (GetValue 4) { } (GetTitle 6) { } (GetTitle 8)
|
||||
WriteToFile .xinitrc-fvwm {xset b } (GetValue 4) { } (GetTitle 6) { } (GetTitle 8)
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 3
|
||||
Property
|
||||
Size 50 30
|
||||
Position 280 180
|
||||
Type PushButton
|
||||
Title {Cancel}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 4
|
||||
Property
|
||||
Size 250 1
|
||||
Position 90 30
|
||||
Type HScrollBar
|
||||
MinValue 0
|
||||
MaxValue 100
|
||||
Value 0
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 5
|
||||
Property
|
||||
Position 20 53
|
||||
Type ItemDraw
|
||||
Title {Volume:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 6
|
||||
Property
|
||||
Size 60 1
|
||||
Position 90 90
|
||||
Type TextField
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 7
|
||||
Property
|
||||
Position 20 95
|
||||
Type ItemDraw
|
||||
Title {Pitch(Hz):}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 8
|
||||
Property
|
||||
Size 60 1
|
||||
Position 280 90
|
||||
Type TextField
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 9
|
||||
Property
|
||||
Position 190 95
|
||||
Type ItemDraw
|
||||
Title {Duration(ms):}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 10
|
||||
Property
|
||||
Size 340 130
|
||||
Position 10 10
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 11
|
||||
Property
|
||||
Position 15 3
|
||||
Type ItemDraw
|
||||
Title {Bell}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,289 +0,0 @@
|
||||
WindowTitle {FvwmButtons}
|
||||
WindowSize 548 95 # Taille
|
||||
WindowPosition 0 0 # Position
|
||||
ForeColor {#000000}
|
||||
BackColor {#d0d0d0}
|
||||
ShadowColor {#858585}
|
||||
HilightColor {#FFFFFF}
|
||||
Font -adobe-helvetica-bold-r-*-*-12-*
|
||||
|
||||
Init
|
||||
Begin
|
||||
End
|
||||
|
||||
Widget 1
|
||||
Property
|
||||
Size 65 65
|
||||
Position 15 15
|
||||
Type SwallowExec
|
||||
Title {xclock}
|
||||
Value -1
|
||||
SwallowExec {exec xclock -analog -padding 0 -geometry 70x56-1500-1500 -fg MidnightBlue -hd Blue -hl Blue -bg Grey85 &}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 2
|
||||
Property
|
||||
Size 40 71
|
||||
Position 88 12
|
||||
Type SwallowExec
|
||||
Title {xload}
|
||||
SwallowExec {exec xload -nolabel -bg Grey85 -fg Yellow -update 3 -geometry 30x56-1500-1500 &}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 3
|
||||
Property
|
||||
Size 140 65
|
||||
Position 136 15
|
||||
Type SwallowExec
|
||||
Title {FvwmPager}
|
||||
Value -1
|
||||
SwallowExec {Module FvwmPager 0 0}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 4
|
||||
Property
|
||||
Size 281 85
|
||||
Position 5 5
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 5
|
||||
Property
|
||||
Size 251 85
|
||||
Position 291 5
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
|
||||
Widget 7
|
||||
Property
|
||||
Size 1 1
|
||||
Position 296 10
|
||||
Type PushButton
|
||||
Title {|XV|XPaint|Image Magic|XFig|XMag|Screen Dump}
|
||||
Icon small.Paint2.xpm
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 7)==1 Then
|
||||
Do {Exec xv &}
|
||||
If (GetValue 7)==2 Then
|
||||
Do {Exec xpaint &}
|
||||
If (GetValue 7)==3 Then
|
||||
Do {Exec xterm -geometry -5000-5000 -e display &}
|
||||
If (GetValue 7)==4 Then
|
||||
Do {Exec xfig &}
|
||||
If (GetValue 7)==5 Then
|
||||
Do {Exec xmag &}
|
||||
If (GetValue 7)==6 Then
|
||||
Do {Module FvwmScript ScreenDump}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 8
|
||||
Property
|
||||
Size 1 1
|
||||
Position 331 10
|
||||
Type PushButton
|
||||
Title {|XCalc|HP 48GX}
|
||||
Icon small.calc.next.xpm
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 8)==1 Then
|
||||
Do {exec xcalc &}
|
||||
If (GetValue 8)==2 Then
|
||||
Do {exec x48 &}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 9
|
||||
Property
|
||||
Size 1 1
|
||||
Position 366 10
|
||||
Type PushButton
|
||||
Title {|TextEdit|MEdit|XEdit|Axe|Netscape|Clipboard|Plan}
|
||||
Icon small.note.next.xpm
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 9)==1 Then
|
||||
Do {Exec textedit -En 30 &}
|
||||
If (GetValue 9)==2 Then
|
||||
Do {Exec medit &}
|
||||
If (GetValue 9)==3 Then
|
||||
Do {Exec xedit &}
|
||||
If (GetValue 9)==4 Then
|
||||
Do {Exec coaxe &}
|
||||
If (GetValue 9)==5 Then
|
||||
Do {Exec bash -c "netscape" &}
|
||||
If (GetValue 9)==6 Then
|
||||
Do {Exec xclipboard &}
|
||||
If (GetValue 9)==7 Then
|
||||
Do {Exec plan &}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 10
|
||||
Property
|
||||
Size 1 1
|
||||
Position 471 10
|
||||
Type PushButton
|
||||
Title {|Random|Bat|Blot|Bouboule|Bounce|Flame|Galaxy|Grav|Helix|Hop|Maze}
|
||||
Icon small.lock.xpm
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 10)==1 Then
|
||||
Do {Exec xlock -nolock -nice 0 -mode random &}
|
||||
If (GetValue 10)==2 Then
|
||||
Do {Exec xlock -nolock -nice 0 -mode bat &}
|
||||
If (GetValue 10)==3 Then
|
||||
Do {Exec xlock -nolock -nice 0 -mode blot &}
|
||||
If (GetValue 10)==4 Then
|
||||
Do {Exec xlock -nolock -nice 0 -mode bouboule &}
|
||||
If (GetValue 10)==5 Then
|
||||
Do {Exec xlock -nolock -nice 0 -mode bounce &}
|
||||
If (GetValue 10)==6 Then
|
||||
Do {Exec xlock -nolock -nice 0 -mode flame &}
|
||||
If (GetValue 10)==7 Then
|
||||
Do {Exec xlock -nolock -nice 0 -mode galaxy &}
|
||||
If (GetValue 10)==8 Then
|
||||
Do {Exec xlock -nolock -nice 0 -mode grav &}
|
||||
If (GetValue 10)==9 Then
|
||||
Do {Exec xlock -nolock -nice 0 -mode helix &}
|
||||
If (GetValue 10)==10 Then
|
||||
Do {Exec xlock -nolock -nice 0 -mode hop &}
|
||||
If (GetValue 10)==11 Then
|
||||
Do {Exec xlock -nolock -nice 0 -mode maze &}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 11
|
||||
Property
|
||||
Size 1 1
|
||||
Position 506 10
|
||||
Type PushButton
|
||||
Icon small.exit.xpm
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Do {Module FvwmScript Quit}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 12
|
||||
Property
|
||||
Size 1 1
|
||||
Position 436 10
|
||||
Type PushButton
|
||||
Title {|Display|Bell|Keyboard|Pointer|Date|Desktop}
|
||||
Icon small.tools2_3d.xpm
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 12)==1 Then
|
||||
Do {Module FvwmScript ScreenSetup}
|
||||
If (GetValue 12)==2 Then
|
||||
Do {Module FvwmScript BellSetup}
|
||||
If (GetValue 12)==3 Then
|
||||
Do {Module FvwmScript KeyboardSetup}
|
||||
If (GetValue 12)==4 Then
|
||||
Do {Module FvwmScript PointerSetup}
|
||||
If (GetValue 12)==5 Then
|
||||
Do {Module FvwmScript Date}
|
||||
If (GetValue 12)==6 Then
|
||||
Do {Module FvwmScript DeskSetup}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 13
|
||||
Property
|
||||
Size 1 1
|
||||
Position 401 10
|
||||
Type PushButton
|
||||
Title {|TkMan|XMan}
|
||||
Icon small.man.next.xpm
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 13)==1 Then
|
||||
Do {Exec tkman &}
|
||||
If (GetValue 13)==2 Then
|
||||
Do {Exec xman -notopbox &}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 6
|
||||
Property
|
||||
Size 240 40
|
||||
Position 296 45
|
||||
Type SwallowExec
|
||||
Title {TkDesk Application Bar}
|
||||
SwallowExec {exec tkdesk &}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,416 +0,0 @@
|
||||
WindowTitle {Date}
|
||||
WindowSize 360 330 # Taille
|
||||
WindowPosition 191 50 # Position
|
||||
ForeColor {black}
|
||||
BackColor {grey85}
|
||||
ShadowColor {grey55}
|
||||
HilightColor {grey100}
|
||||
Font -adobe-helvetica-bold-r-*-*-12-*
|
||||
|
||||
Init
|
||||
Begin
|
||||
WarpPointer 1
|
||||
Set $NHour=(GetOutput {date '+%d %m %Y %H %M'} 1 4)
|
||||
ChangeValue 10 $NHour
|
||||
ChangeTitle 8 $NHour
|
||||
|
||||
Set $NMinu=(GetOutput {date '+%d %m %Y %H %M'} 1 5)
|
||||
ChangeValue 14 $NMinu
|
||||
ChangeTitle 12 $NMinu
|
||||
|
||||
Set $Day=(GetOutput {date '+%d %m %Y %H %M'} 1 1)
|
||||
ChangeValue 20 $Day
|
||||
ChangeTitle 18 $Day
|
||||
|
||||
Set $Year=(GetOutput {date '+%d %m %Y %H %M'} 1 3)
|
||||
ChangeValue 24 $Year
|
||||
ChangeTitle 22 $Year
|
||||
|
||||
Set $Month=(GetOutput {date '+%d %m %Y %H %M'} 1 2)
|
||||
ChangeValue 26 $Month
|
||||
|
||||
Set $MaxDay=31
|
||||
Set $cmd={date --date '} $Month {/} $MaxDay {/} $Year {' +%d}
|
||||
While (GetOutput $cmd 1 1)=={} Do
|
||||
Begin
|
||||
Set $MaxDay=(Add $MaxDay -1)
|
||||
Set $cmd={date --date '} $Month {/} $MaxDay {/} $Year {' +%d}
|
||||
End
|
||||
ChangeMaxValue 20 $MaxDay
|
||||
|
||||
End
|
||||
|
||||
Widget 1
|
||||
Property
|
||||
Size 50 30
|
||||
Position 190 280
|
||||
Type PushButton
|
||||
Title {OK}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Do {Exec date -s '} $NHour {:} $NMinu { } $Month {/} $Day {/} $Year{'}
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 2
|
||||
Property
|
||||
Size 50 30
|
||||
Position 280 280
|
||||
Type PushButton
|
||||
Title {Cancel}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Do {Exec xset s } $TimeOut
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 3
|
||||
Property
|
||||
Size 340 130
|
||||
Position 10 10
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 4
|
||||
Property
|
||||
Position 15 2
|
||||
Type ItemDraw
|
||||
Title {Time}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 5
|
||||
Property
|
||||
Size 80 80
|
||||
Position 240 35
|
||||
Type SwallowExec
|
||||
Title {xclock}
|
||||
SwallowExec {exec xclock -analog -padding 0 -geometry 70x56-1500-1500 -fg MidnightBlue -hd Blue -hl Blue -bg Grey85 -update 1 &}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 6
|
||||
Property
|
||||
Size 100 100
|
||||
Position 230 25
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 7
|
||||
Property
|
||||
Position 35 40
|
||||
Type ItemDraw
|
||||
Title {Hours:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 8
|
||||
Property
|
||||
Position 100 40
|
||||
Type ItemDraw
|
||||
Title {00}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 9
|
||||
Property
|
||||
Size 26 26
|
||||
Position 95 35
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 10
|
||||
Property
|
||||
Position 125 32
|
||||
Type MiniScroll
|
||||
Value 15
|
||||
MaxValue 23
|
||||
MinValue 0
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Set $NHour=(GetValue 10)
|
||||
If $NHour<10 Then
|
||||
Set $NHour=0 $NHour
|
||||
ChangeTitle 8 $NHour
|
||||
End
|
||||
End
|
||||
|
||||
Widget 11
|
||||
Property
|
||||
Position 35 90
|
||||
Type ItemDraw
|
||||
Title {Minutes:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 12
|
||||
Property
|
||||
Position 100 90
|
||||
Type ItemDraw
|
||||
Title {00}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 13
|
||||
Property
|
||||
Size 26 26
|
||||
Position 95 85
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 14
|
||||
Property
|
||||
Position 125 82
|
||||
Type MiniScroll
|
||||
Value 15
|
||||
MaxValue 59
|
||||
MinValue 0
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Set $NMinu=(GetValue 14)
|
||||
If $NMinu<10 Then
|
||||
Set $NMinu=0 $NMinu
|
||||
ChangeTitle 12 $NMinu
|
||||
End
|
||||
End
|
||||
|
||||
Widget 15
|
||||
Property
|
||||
Size 340 110
|
||||
Position 10 155
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 16
|
||||
Property
|
||||
Position 15 147
|
||||
Type ItemDraw
|
||||
Title {Date}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 17
|
||||
Property
|
||||
Position 30 180
|
||||
Type ItemDraw
|
||||
Title {Day:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 18
|
||||
Property
|
||||
Position 80 180
|
||||
Type ItemDraw
|
||||
Title {00}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 19
|
||||
Property
|
||||
Size 26 26
|
||||
Position 75 175
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 20
|
||||
Property
|
||||
Position 105 172
|
||||
Type MiniScroll
|
||||
Value 1
|
||||
MaxValue 1
|
||||
MinValue 1
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Set $Day=(GetValue 20)
|
||||
If $Day<10 Then
|
||||
Set $Day=0 $Day
|
||||
ChangeTitle 18 $Day
|
||||
End
|
||||
End
|
||||
|
||||
Widget 21
|
||||
Property
|
||||
Position 200 180
|
||||
Type ItemDraw
|
||||
Title {Year:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 22
|
||||
Property
|
||||
Position 250 180
|
||||
Type ItemDraw
|
||||
Title {1996}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 23
|
||||
Property
|
||||
Size 41 26
|
||||
Position 245 175
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 24
|
||||
Property
|
||||
Position 290 172
|
||||
Type MiniScroll
|
||||
Value 1996
|
||||
MaxValue 1999
|
||||
MinValue 1970
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Set $Year=(GetValue 24)
|
||||
ChangeTitle 22 $Year
|
||||
Set $MaxDay=31
|
||||
Set $cmd={date --date '} $Month {/} $MaxDay {/} $Year {' +%d}
|
||||
While (GetOutput $cmd 1 1)=={} Do
|
||||
Begin
|
||||
Set $MaxDay=(Add $MaxDay -1)
|
||||
Set $cmd={date --date '} $Month {/} $MaxDay {/} $Year {' +%d}
|
||||
End
|
||||
ChangeMaxValue 20 $MaxDay
|
||||
Set $Day=(GetValue 20)
|
||||
If $Day<10 Then
|
||||
Set $Day=0 $Day
|
||||
ChangeTitle 18 $Day
|
||||
End
|
||||
End
|
||||
|
||||
Widget 25
|
||||
Property
|
||||
Position 30 225
|
||||
Type ItemDraw
|
||||
Title {Month:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 26
|
||||
Property
|
||||
Position 100 220
|
||||
Type PopupMenu
|
||||
Title {January|February|March|April|May|June|July|August|September|October|November|December}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Set $Month=(GetValue 26)
|
||||
If $Month<10 Then
|
||||
Set $Month=0 $Month
|
||||
Set $MaxDay=31
|
||||
Set $cmd={date --date '} $Month {/} $MaxDay {/} $Year {' +%d}
|
||||
While (GetOutput $cmd 1 1)=={} Do
|
||||
Begin
|
||||
Set $MaxDay=(Add $MaxDay -1)
|
||||
Set $cmd={date --date '} $Month {/} $MaxDay {/} $Year {' +%d}
|
||||
End
|
||||
ChangeMaxValue 20 $MaxDay
|
||||
Set $Day=(GetValue 20)
|
||||
If $Day<10 Then
|
||||
Set $Day=0 $Day
|
||||
ChangeTitle 18 $Day
|
||||
End
|
||||
End
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,429 +0,0 @@
|
||||
WindowTitle {Desktop}
|
||||
WindowSize 360 400 # Taille
|
||||
WindowPosition 191 50 # Position
|
||||
ForeColor {black}
|
||||
BackColor {grey85}
|
||||
ShadowColor {grey55}
|
||||
HilightColor {grey100}
|
||||
Font -adobe-helvetica-bold-r-*-*-12-*
|
||||
|
||||
Init
|
||||
Begin
|
||||
WarpPointer 1
|
||||
Set $RAISE=(GetOutput {cat ~/.fvwmrc} 6 -1)
|
||||
If $RAISE=={KillModule FvwmAuto} Then
|
||||
ChangeValue 6 0
|
||||
Else
|
||||
ChangeValue 6 1
|
||||
|
||||
Set $FOCUS=(GetOutput {cat ~/.fvwmrc} 7 -1)
|
||||
If $FOCUS=={ChangeDefaultFocus SloppyFocus} Then
|
||||
ChangeValue 8 1
|
||||
If $FOCUS=={ChangeDefaultFocus ClickToFocus} Then
|
||||
ChangeValue 8 2
|
||||
If $FOCUS=={ChangeDefaultFocus FocusFollowsMouse} Then
|
||||
ChangeValue 8 3
|
||||
|
||||
Set $PAGE=(GetOutput {cat ~/.fvwmrc} 8 -1)
|
||||
If $PAGE == {EdgeScroll 100 100} Then
|
||||
ChangeValue 12 1
|
||||
If $PAGE == {EdgeScroll 0 0} Then
|
||||
ChangeValue 12 2
|
||||
If $PAGE == {EdgeScroll 100 0} Then
|
||||
ChangeValue 12 3
|
||||
If $PAGE == {EdgeScroll 0 100} Then
|
||||
ChangeValue 12 4
|
||||
If $PAGE == {EdgeScroll 50 50} Then
|
||||
ChangeValue 12 5
|
||||
If $PAGE == {EdgeScroll 100000 100000} Then
|
||||
ChangeValue 12 6
|
||||
|
||||
Set $COLOR=(GetOutput {cat ~/.fvwmrc} 9 -1)
|
||||
If $COLOR=={ColormapFocus FollowsMouse} Then
|
||||
ChangeValue 10 1
|
||||
Else
|
||||
ChangeValue 10 2
|
||||
|
||||
Set $NBROW=(GetOutput {cat ~/.fvwmrc} 11 3)
|
||||
Set $NBCOL=(GetOutput {cat ~/.fvwmrc} 11 2)
|
||||
ChangeTitle 21 $NBROW
|
||||
ChangeTitle 20 $NBCOL
|
||||
ChangeValue 19 $NBROW
|
||||
ChangeValue 18 $NBCOL
|
||||
|
||||
Set $OPAQ=(GetOutput {cat ~/.fvwmrc} 10 2)
|
||||
ChangeValue 23 $OPAQ
|
||||
ChangeTitle 25 $OPAQ
|
||||
|
||||
End
|
||||
|
||||
Widget 1
|
||||
Property
|
||||
Size 50 30
|
||||
Position 100 340
|
||||
Type PushButton
|
||||
Title {OK}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Do $RAISE
|
||||
WriteToFile .fvwmrc $RAISE
|
||||
|
||||
Do $FOCUS
|
||||
WriteToFile .fvwmrc $FOCUS
|
||||
|
||||
Do $PAGE
|
||||
WriteToFile .fvwmrc $PAGE
|
||||
|
||||
Do $COLOR
|
||||
WriteToFile .fvwmrc $COLOR
|
||||
|
||||
Do {OpaqueMoveSize } (GetValue 23)
|
||||
WriteToFile .fvwmrc {OpaqueMoveSize } (GetValue 23)
|
||||
|
||||
Do {DeskTopSize } (GetValue 18) { } (GetValue 19)
|
||||
WriteToFile .fvwmrc {DeskTopSize } (GetValue 18) { } (GetValue 19)
|
||||
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 2
|
||||
Property
|
||||
Size 50 30
|
||||
Position 190 340
|
||||
Type PushButton
|
||||
Title {Apply}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Do $RAISE
|
||||
Do $FOCUS
|
||||
Do $PAGE
|
||||
Do $COLOR
|
||||
Do {DeskTopSize } (GetValue 18) { } (GetValue 19)
|
||||
Do {OpaqueMoveSize } (GetValue 23)
|
||||
End
|
||||
End
|
||||
|
||||
Widget 3
|
||||
Property
|
||||
Size 30 30
|
||||
Position 280 340
|
||||
Type PushButton
|
||||
Title {Cancel}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 4
|
||||
Property
|
||||
Size 340 310
|
||||
Position 10 10
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 5
|
||||
Property
|
||||
Position 30 40
|
||||
Type ItemDraw
|
||||
Title {Auto raise:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
|
||||
Widget 6
|
||||
Property
|
||||
Position 110 40
|
||||
Type CheckBox
|
||||
Title {On}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 6) == 1 Then
|
||||
Set $RAISE={Module FvwmAuto 2000 Raise Nop}
|
||||
Else
|
||||
Set $RAISE={KillModule FvwmAuto}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 7
|
||||
Property
|
||||
Position 30 75
|
||||
Type ItemDraw
|
||||
Title {Focus:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 8
|
||||
Property
|
||||
Position 110 70
|
||||
Type PopupMenu
|
||||
Title {Sloppy Focus|Click To Focus|Focus Follows Mouse}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 8) == 1 Then
|
||||
Set $FOCUS={ChangeDefaultFocus SloppyFocus}
|
||||
If (GetValue 8) == 2 Then
|
||||
Set $FOCUS={ChangeDefaultFocus ClickToFocus}
|
||||
If (GetValue 8) == 3 Then
|
||||
Set $FOCUS={ChangeDefaultFocus FocusFollowsMouse}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 11
|
||||
Property
|
||||
Position 30 155
|
||||
Type ItemDraw
|
||||
Title {Paging:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 12
|
||||
Property
|
||||
Position 110 150
|
||||
Type PopupMenu
|
||||
Title {Full Paging ON|All Paging OFF|Horizontal Paging Only|Vertical Paging Only|Partial Paging|Full Paging && Edge Wrap}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 12) == 1 Then
|
||||
Set $PAGE={EdgeScroll 100 100}
|
||||
If (GetValue 12) == 2 Then
|
||||
Set $PAGE={EdgeScroll 0 0}
|
||||
If (GetValue 12) == 3 Then
|
||||
Set $PAGE={EdgeScroll 100 0}
|
||||
If (GetValue 12) == 4 Then
|
||||
Set $PAGE={EdgeScroll 0 100}
|
||||
If (GetValue 12) == 5 Then
|
||||
Set $PAGE={EdgeScroll 50 50}
|
||||
If (GetValue 12) == 6 Then
|
||||
Set $PAGE={EdgeScroll 100000 100000}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 9
|
||||
Property
|
||||
Position 30 115
|
||||
Type ItemDraw
|
||||
Title {Colormap:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 10
|
||||
Property
|
||||
Position 110 110
|
||||
Type PopupMenu
|
||||
Title {Colormap Follows Mouse|Colormap Follows Focus}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 10) == 1 Then
|
||||
Set $COLOR={ColormapFocus FollowsMouse}
|
||||
Else
|
||||
Set $COLOR={ColormapFocus FollowsFocus}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 13
|
||||
Property
|
||||
Position 30 210
|
||||
Type ItemDraw
|
||||
Title {Desktop size}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 14
|
||||
Property
|
||||
Position 120 195
|
||||
Type ItemDraw
|
||||
Title {Nb of column:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 15
|
||||
Property
|
||||
Position 139 228
|
||||
Type ItemDraw
|
||||
Title {Nb of row:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 16
|
||||
Property
|
||||
Size 25 25
|
||||
Position 210 190
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 17
|
||||
Property
|
||||
Size 25 25
|
||||
Position 210 225
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 18
|
||||
Property
|
||||
Size 25 25
|
||||
Position 240 187
|
||||
Value 1
|
||||
MaxValue 9
|
||||
MinValue 1
|
||||
Type MiniScroll
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
ChangeTitle 20 (GetValue 18)
|
||||
End
|
||||
End
|
||||
|
||||
Widget 19
|
||||
Property
|
||||
Size 25 25
|
||||
Position 240 222
|
||||
Type MiniScroll
|
||||
Value 1
|
||||
MaxValue 9
|
||||
MinValue 1
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
ChangeTitle 21 (GetValue 19)
|
||||
End
|
||||
End
|
||||
|
||||
Widget 20
|
||||
Property
|
||||
Position 218 195
|
||||
Type ItemDraw
|
||||
Title {4}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 21
|
||||
Property
|
||||
Position 218 228
|
||||
Type ItemDraw
|
||||
Title {2}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 22
|
||||
Property
|
||||
Size 35 25
|
||||
Position 200 272
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 23
|
||||
Property
|
||||
Size 25 25
|
||||
Position 240 268
|
||||
Value 100
|
||||
MaxValue 100
|
||||
MinValue 0
|
||||
Type MiniScroll
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
ChangeTitle 25 (GetValue 23)
|
||||
End
|
||||
End
|
||||
|
||||
Widget 24
|
||||
Property
|
||||
Size 25 25
|
||||
Position 30 277
|
||||
Type ItemDraw
|
||||
Title {Opaque move size (%):}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 25
|
||||
Property
|
||||
Position 206 277
|
||||
Type ItemDraw
|
||||
Title {100}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
|
||||
@@ -1,258 +0,0 @@
|
||||
WindowTitle {File Browser}
|
||||
WindowSize 360 340 # Taille
|
||||
WindowPosition 191 50 # Position
|
||||
ForeColor {black}
|
||||
BackColor {grey85}
|
||||
ShadowColor {grey55}
|
||||
HilightColor {grey100}
|
||||
Font -adobe-helvetica-bold-r-*-*-12-*
|
||||
|
||||
Init
|
||||
Begin
|
||||
Set $PWD=(GetScriptArgument 1)
|
||||
Set $POS=50
|
||||
Set $LOOP=1
|
||||
While $LOOP==1 Do
|
||||
Begin
|
||||
If (StrCopy $PWD $POS $POS)=={/} Then
|
||||
Set $LOOP=0
|
||||
If $POS==0 Then
|
||||
Set $LOOP=0
|
||||
Set $POS=(Add $POS -1)
|
||||
End
|
||||
Set $PWD=(StrCopy $PWD 1 $POS)
|
||||
Set $CMD2={bash -c "cd;cd } $PWD {; pwd"}
|
||||
Set $PWD=(GetOutput $CMD2 0 0)
|
||||
Do {Exec echo } $PWD
|
||||
Set $OPT={ }
|
||||
Set $CMD={bash -c "cd } $PWD {; ls} $OPT {-1 -F"}
|
||||
Set $LS=(GetOutput $CMD 1 -1)
|
||||
Set $ID=2
|
||||
While (GetOutput $CMD $ID -1) <> {} Do
|
||||
Begin
|
||||
Set $LS=$LS {|} (GetOutput $CMD $ID -1)
|
||||
Set $ID=(Add $ID 1)
|
||||
End
|
||||
ChangeTitle 7 $LS
|
||||
ChangeTitle 5 $PWD
|
||||
ChangeTitle 9 {}
|
||||
End
|
||||
|
||||
Widget 1
|
||||
Property
|
||||
Size 50 30
|
||||
Position 190 300
|
||||
Type PushButton
|
||||
Title {OK}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
SendToScript (GetScriptFather) $PWD {/} (GetTitle 9)
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 2
|
||||
Property
|
||||
Size 50 30
|
||||
Position 280 300
|
||||
Type PushButton
|
||||
Title {Cancel}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 3
|
||||
Property
|
||||
Position 10 10
|
||||
Size 340 280
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 4
|
||||
Property
|
||||
Position 20 42
|
||||
Type ItemDraw
|
||||
Title {Path:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 5
|
||||
Property
|
||||
Position 65 42
|
||||
Size 270 0
|
||||
Type ItemDraw
|
||||
Title {*}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 10
|
||||
Property
|
||||
Position 60 40
|
||||
Size 279 20
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
|
||||
Widget 6
|
||||
Property
|
||||
Position 21 67
|
||||
Size 50 18
|
||||
Icon up.xpm
|
||||
Type PushButton
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Set $CMD={bash -c "cd } $PWD {/..; pwd"}
|
||||
Set $PWD=(GetOutput $CMD 0 0)
|
||||
Set $CMD={bash -c "cd } $PWD {; ls} $OPT {-1 -F"}
|
||||
Set $LS=(GetOutput $CMD 1 -1)
|
||||
Set $ID=2
|
||||
While (GetOutput $CMD $ID -1) <> {} Do
|
||||
Begin
|
||||
Set $LS=$LS {|} (GetOutput $CMD $ID -1)
|
||||
Set $ID=(Add $ID 1)
|
||||
End
|
||||
ChangeTitle 7 $LS
|
||||
ChangeTitle 5 $PWD
|
||||
ChangeTitle 9 {}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 11
|
||||
Property
|
||||
Position 91 67
|
||||
Size 50 18
|
||||
Icon home.xpm
|
||||
Type PushButton
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Set $PWD={~}
|
||||
Set $CMD={bash -c "cd } $PWD {; ls} $OPT {-1 -F"}
|
||||
Set $LS=(GetOutput $CMD 1 -1)
|
||||
Set $ID=2
|
||||
While (GetOutput $CMD $ID -1) <> {} Do
|
||||
Begin
|
||||
Set $LS=$LS {|} (GetOutput $CMD $ID -1)
|
||||
Set $ID=(Add $ID 1)
|
||||
End
|
||||
ChangeTitle 7 $LS
|
||||
ChangeTitle 5 $PWD
|
||||
ChangeTitle 9 {}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 12
|
||||
Property
|
||||
Position 180 72
|
||||
Type CheckBox
|
||||
Title { Show hidden files}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 12) == 1 Then
|
||||
Set $OPT={ -A }
|
||||
Else
|
||||
Set $OPT={ }
|
||||
Set $CMD={bash -c "cd } $PWD {; ls} $OPT {-1 -F"}
|
||||
Set $LS=(GetOutput $CMD 1 -1)
|
||||
Set $ID=2
|
||||
While (GetOutput $CMD $ID -1) <> {} Do
|
||||
Begin
|
||||
Set $LS=$LS {|} (GetOutput $CMD $ID -1)
|
||||
Set $ID=(Add $ID 1)
|
||||
End
|
||||
ChangeTitle 7 $LS
|
||||
ChangeTitle 5 $PWD
|
||||
ChangeTitle 9 {}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 7
|
||||
Property
|
||||
Position 20 100
|
||||
Size 320 115
|
||||
Type List
|
||||
Title {}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Set $CMD3={bash -c "cd } $PWD {; ls} $OPT {-1"}
|
||||
Set $PWD2=$PWD {/} (GetOutput $CMD3 (GetValue 7) -1)
|
||||
Set $CMD2={bash -c "cd } $PWD {;cd } $PWD2 {; pwd"}
|
||||
Set $PWD2=(GetOutput $CMD2 0 0)
|
||||
If $PWD2 <> $PWD Then
|
||||
Begin
|
||||
Set $PWD = $PWD2
|
||||
Set $CMD={bash -c "cd } $PWD {; ls} $OPT {-1 -F"}
|
||||
Set $LS=(GetOutput $CMD 1 -1)
|
||||
Set $ID=2
|
||||
While (GetOutput $CMD $ID -1) <> {} Do
|
||||
Begin
|
||||
Set $LS=$LS {|} (GetOutput $CMD $ID -1)
|
||||
Set $ID=(Add $ID 1)
|
||||
End
|
||||
ChangeTitle 7 $LS
|
||||
ChangeTitle 5 $PWD
|
||||
ChangeTitle 9 {}
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
ChangeTitle 9 (GetOutput $CMD3 (GetValue 7) -1)
|
||||
End
|
||||
End
|
||||
End
|
||||
|
||||
Widget 8
|
||||
Property
|
||||
Position 20 220
|
||||
Type ItemDraw
|
||||
Title {Selected file:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 9
|
||||
Property
|
||||
Position 20 240
|
||||
Size 320 20
|
||||
Type TextField
|
||||
Title {}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
WindowTitle {Keyboard}
|
||||
WindowSize 360 250 # Taille
|
||||
WindowPosition 191 50 # Position
|
||||
ForeColor {black}
|
||||
BackColor {grey85}
|
||||
ShadowColor {grey55}
|
||||
HilightColor {grey100}
|
||||
Font -adobe-helvetica-bold-r-*-*-12-*
|
||||
|
||||
Init
|
||||
Begin
|
||||
WarpPointer 2
|
||||
ChangeValue 4 (GetOutput {xset -q} 2 7)
|
||||
If (GetOutput {xset -q } 2 3)==on Then
|
||||
ChangeValue 6 1
|
||||
End
|
||||
|
||||
Widget 1
|
||||
Property
|
||||
Size 50 30
|
||||
Position 100 200
|
||||
Type PushButton
|
||||
Title {Apply}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Do {Exec xset c } (GetValue 4)
|
||||
If (GetValue 6) == 1 Then
|
||||
Do {Exec xset r on}
|
||||
Else
|
||||
Do {Exec xset r off}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 2
|
||||
Property
|
||||
Size 50 30
|
||||
Position 190 200
|
||||
Type PushButton
|
||||
Title {OK}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Do {Exec xset c } (GetValue 4)
|
||||
If (GetValue 6) == 1 Then
|
||||
Begin
|
||||
Do {Exec xset r on}
|
||||
WriteToFile .xinitrc-fvwm {xset r on c } (GetValue 4)
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
Do {Exec xset r off}
|
||||
WriteToFile .xinitrc-fvwm {xset r off c } (GetValue 4)
|
||||
End
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 3
|
||||
Property
|
||||
Size 50 30
|
||||
Position 280 200
|
||||
Type PushButton
|
||||
Title {Cancel}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 4
|
||||
Property
|
||||
Size 300 1
|
||||
Position 30 120
|
||||
Type HScrollBar
|
||||
MinValue 0
|
||||
MaxValue 100
|
||||
Value 0
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 5
|
||||
Property
|
||||
Position 130 100
|
||||
Type ItemDraw
|
||||
Title {Click Volume (%)}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 6
|
||||
Property
|
||||
Position 30 40
|
||||
Type CheckBox
|
||||
Title {On}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 7
|
||||
Property
|
||||
Position 250 35
|
||||
Type PopupMenu
|
||||
Title {English|French|German|Italian}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 8
|
||||
Property
|
||||
Position 170 40
|
||||
Type ItemDraw
|
||||
Title {Nationnality:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 10
|
||||
Property
|
||||
Size 340 180
|
||||
Position 10 10
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 11
|
||||
Property
|
||||
Position 15 3
|
||||
Type ItemDraw
|
||||
Title {Keyboard}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
WindowTitle {Pointer}
|
||||
WindowSize 320 290 # Taille
|
||||
WindowPosition 191 50 # Position
|
||||
ForeColor {black}
|
||||
BackColor {grey85}
|
||||
ShadowColor {grey55}
|
||||
HilightColor {grey100}
|
||||
Font -adobe-helvetica-bold-r-*-*-12-*
|
||||
|
||||
Init
|
||||
Begin
|
||||
WarpPointer 2
|
||||
Set $tmp=(GetOutput {xset -q} 9 2)
|
||||
Set $pos=1
|
||||
While (StrCopy $tmp $pos $pos)<>{/} Do
|
||||
Set $pos=(Add $pos 1)
|
||||
Set $pos=(Add $pos -1)
|
||||
|
||||
ChangeValue 6 (Div (Mult (StrCopy $tmp 1 $pos) 20) (StrCopy $tmp (Add $pos 2) 256))
|
||||
ChangeTitle 8 (GetOutput {xset -q} 9 4)
|
||||
End
|
||||
|
||||
Widget 1
|
||||
Property
|
||||
Size 50 30
|
||||
Position 70 230
|
||||
Type PushButton
|
||||
Title {Apply}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Do {Exec xset m } (GetValue 6) {/20 } (GetTitle 8)
|
||||
If (GetValue 4) == 1 Then
|
||||
Do {Exec xmodmap -e "pointer = 1 2 3"}
|
||||
Else
|
||||
Do {Exec xmodmap -e "pointer = 3 2 1"}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 2
|
||||
Property
|
||||
Size 50 30
|
||||
Position 160 230
|
||||
Type PushButton
|
||||
Title {OK}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Do {Exec xset m } (GetValue 6) {/20 } (GetTitle 8)
|
||||
WriteToFile .xinitrc-fvwm {xset m } (GetValue 6) {/20 } (GetTitle 8)
|
||||
If (GetValue 4) == 1 Then
|
||||
Begin
|
||||
Do {Exec xmodmap -e "pointer = 1 2 3"}
|
||||
WriteToFile .xinitrc-fvwm {xmodmap -e "pointer = 1 2 3"}
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
Do {Exec xmodmap -e "pointer = 3 2 1"}
|
||||
WriteToFile .xinitrc-fvwm {xmodmap -e "pointer = 3 2 1"}
|
||||
End
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 3
|
||||
Property
|
||||
Size 50 30
|
||||
Position 250 230
|
||||
Type PushButton
|
||||
Title {Cancel}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 4
|
||||
Property
|
||||
Position 150 140
|
||||
Type PopupMenu
|
||||
Title {Right-handed user|Left-handed user}
|
||||
Value 1
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 5
|
||||
Property
|
||||
Position 20 145
|
||||
Type ItemDraw
|
||||
Title {Mouse configuration:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 6
|
||||
Property
|
||||
Size 188 1
|
||||
Position 110 25
|
||||
MinValue 5
|
||||
MaxValue 100
|
||||
Type HScrollBar
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 7
|
||||
Property
|
||||
Position 20 45
|
||||
Type ItemDraw
|
||||
Title {Acceleration:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 8
|
||||
Property
|
||||
Size 60 1
|
||||
Position 150 90
|
||||
Type TextField
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 9
|
||||
Property
|
||||
Size 110 1
|
||||
Position 20 95
|
||||
Type ItemDraw
|
||||
Title {Threshold (pixels):}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 10
|
||||
Property
|
||||
Size 300 190
|
||||
Position 10 10
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 11
|
||||
Property
|
||||
Position 15 3
|
||||
Type ItemDraw
|
||||
Title {Pointer}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
WindowTitle {Logout}
|
||||
WindowSize 400 250 # Taille
|
||||
WindowPosition 191 143 # Position
|
||||
ForeColor {black}
|
||||
BackColor {grey85}
|
||||
ShadowColor {grey55}
|
||||
HilightColor {grey100}
|
||||
Font -adobe-helvetica-bold-r-*-*-12-*
|
||||
|
||||
Init
|
||||
Begin
|
||||
Do {Exec sync &}
|
||||
WarpPointer 1
|
||||
Do {Exec cat /usr/X11R6/lib/TkDesk/sounds/metal.voc > /dev/dsp &}
|
||||
Set $ToDo = Restart
|
||||
End
|
||||
|
||||
Widget 8
|
||||
Property
|
||||
Position 40 40
|
||||
Type ItemDraw
|
||||
Icon shutdown.xpm
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 7
|
||||
Property
|
||||
Size 370 220
|
||||
Position 15 15
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 6
|
||||
Property
|
||||
Title {Are you sure to:}
|
||||
Position 100 50
|
||||
Type ItemDraw
|
||||
Value 0
|
||||
Font -adobe-helvetica-bold-r-*-*-12-*
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 1
|
||||
Property
|
||||
Title {OK}
|
||||
Size 60 28
|
||||
Position 280 190
|
||||
Type PushButton
|
||||
Value 1
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If $ToDo == Logout Then
|
||||
Do {Quit}
|
||||
Else
|
||||
Begin
|
||||
If $ToDo == Restart Then
|
||||
Begin
|
||||
Do {Exec sync}
|
||||
Do {Exec xterm -geometry 80x12+150+130 -bg grey85 -fg red -cr red -e pauseme /sbin/shutdown -r -f now}
|
||||
Quit
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
Do {Exec sync}
|
||||
Do {Exec xterm -geometry 80x12+150+130 -bg grey85 -fg red -cr red -e pauseme /sbin/shutdown -h -f now}
|
||||
Quit
|
||||
End
|
||||
End
|
||||
End
|
||||
End
|
||||
|
||||
Widget 2
|
||||
Property
|
||||
Title {Cancel}
|
||||
Size 60 28
|
||||
Position 190 190
|
||||
Type PushButton
|
||||
Value 1
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 3
|
||||
Property
|
||||
Title {Shut down the computer}
|
||||
Position 110 90
|
||||
Type RadioButton
|
||||
Value 0
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
ChangeValue 4 0
|
||||
ChangeValue 5 0
|
||||
Set $ToDo = Halt
|
||||
End
|
||||
End
|
||||
|
||||
Widget 4
|
||||
Property
|
||||
Title {Restart the computer}
|
||||
Position 110 120
|
||||
Type RadioButton
|
||||
Value 1
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
ChangeValue 3 0
|
||||
ChangeValue 5 0
|
||||
Set $ToDo = Restart
|
||||
End
|
||||
End
|
||||
|
||||
Widget 5
|
||||
Property
|
||||
Title {Logout}
|
||||
Position 110 150
|
||||
Type RadioButton
|
||||
Value 0
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
ChangeValue 3 0
|
||||
ChangeValue 4 0
|
||||
Set $ToDo = Logout
|
||||
End
|
||||
End
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
The directory ./Examples contains some examples of what can we do with
|
||||
FvwmScript:
|
||||
|
||||
- BellSetup: desk accessory to modify bell. This script
|
||||
requires xsetup.
|
||||
- Buttons: buttons panel wich can replace FvwmButtons.
|
||||
This script support popup menu and requires xload, xclock,
|
||||
FvwmPager, TkDesk and some icons wich are located in ./some_nice_icons.
|
||||
- Date: desk accessory to setup date and time, requires
|
||||
xclock and date.
|
||||
- KeyboardSetup: desk accessory to setup keyboard, requires
|
||||
xsetup.
|
||||
- Quit: scritp to confirm "Logout" or "Restart computer"
|
||||
- ScreenSetup: desk accessory to customize background display
|
||||
and screen saver.
|
||||
- fvwmrc: my preferred fvwm config wich use all the six scripts.
|
||||
|
||||
|
||||
N.B. BellSetup, KeyBoardSetup and ScreenSetup save preferences to
|
||||
~/.xinit-fvwmrc. If you want to load these preferences at every startup,
|
||||
you have to include the line ".xinit-fvwmrc" in your .xinitrc before
|
||||
the line "fvwm".
|
||||
|
||||
I hope that FvwmScript will interest you. In any case, please send me a short email and
|
||||
tell me what you think about FvwmScript.
|
||||
|
||||
Frederic Cordier
|
||||
e-mail f-cord96@bat710.univ-lyon1.fr
|
||||
@@ -1,279 +0,0 @@
|
||||
WindowTitle {Screen Grabber}
|
||||
WindowSize 360 360 # Taille
|
||||
WindowPosition 191 50 # Position
|
||||
ForeColor {black}
|
||||
BackColor {grey85}
|
||||
ShadowColor {grey55}
|
||||
HilightColor {grey100}
|
||||
Font -adobe-helvetica-bold-r-*-*-12-*
|
||||
|
||||
Init
|
||||
Begin
|
||||
WarpPointer 1
|
||||
Set $Ext = {.gif}
|
||||
Set $Format = {| ppmtogif}
|
||||
End
|
||||
|
||||
Widget 1
|
||||
Property
|
||||
Size 50 30
|
||||
Position 190 320
|
||||
Type PushButton
|
||||
Title {OK}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 5)==1 Then
|
||||
Do {Exec xwd } $Opt1 { } $Opt2 { | xwdtopnm } $Format { > } (GetTitle 7) $Ext
|
||||
Else
|
||||
Do {Exec xwd } $Opt1 { } $Opt2 { | xwdtopnm | ppmtopgm | pnmtops | } (GetTitle 11)
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 2
|
||||
Property
|
||||
Size 50 30
|
||||
Position 280 320
|
||||
Type PushButton
|
||||
Title {Cancel}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Do {Exec xset s } $TimeOut
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 3
|
||||
Property
|
||||
Size 340 170
|
||||
Position 10 10
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 4
|
||||
Property
|
||||
Position 15 2
|
||||
Type ItemDraw
|
||||
Title {Dump to:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 5
|
||||
Property
|
||||
Size 50 30
|
||||
Position 30 30
|
||||
Type RadioButton
|
||||
Title {File}
|
||||
Value 1
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
ChangeValue 6 0
|
||||
End
|
||||
End
|
||||
|
||||
Widget 6
|
||||
Property
|
||||
Size 50 30
|
||||
Position 30 110
|
||||
Type RadioButton
|
||||
Title {Printer}
|
||||
Value 0
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
ChangeValue 5 0
|
||||
End
|
||||
End
|
||||
|
||||
Widget 7
|
||||
Property
|
||||
Size 250 30
|
||||
Position 75 27
|
||||
Type TextField
|
||||
Title {~/picture}
|
||||
Value 200
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 8
|
||||
Property
|
||||
Position 74 65
|
||||
Type ItemDraw
|
||||
Title {Format}
|
||||
Value 1
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 9
|
||||
Property
|
||||
Position 130 60
|
||||
Type PopupMenu
|
||||
Title {GIF|PostScript|Tiff|X11 Pixmap|Pgm|Bmp|Sun rasterfile}
|
||||
Value 1
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 9)==1 Then
|
||||
Begin
|
||||
Set $Ext = {.gif}
|
||||
Set $Format = {| ppmtogif}
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
If (GetValue 9)==2 Then
|
||||
Begin
|
||||
Set $Ext = {.ps}
|
||||
Set $Format = {| pnmtops}
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
If (GetValue 9)==3 Then
|
||||
Begin
|
||||
Set $Ext = {.tif}
|
||||
Set $Format = {| pnmtotiff}
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
If (GetValue 9)==4 Then
|
||||
Begin
|
||||
Set $Ext = {.xpm}
|
||||
Set $Format = {| ppmtoxpm}
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
If (GetValue 9)==5 Then
|
||||
Begin
|
||||
Set $Ext = {.pgm}
|
||||
Set $Format = { }
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
If (GetValue 9)==6 Then
|
||||
Begin
|
||||
Set $Ext = {.bmp}
|
||||
Set $Format = {| ppmtobmp}
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
Set $Ext = {.ras}
|
||||
Set $Format = {| pnmtorast}
|
||||
End
|
||||
End
|
||||
End
|
||||
End
|
||||
End
|
||||
End
|
||||
End
|
||||
End
|
||||
|
||||
Widget 10
|
||||
Property
|
||||
Position 74 138
|
||||
Type ItemDraw
|
||||
Title {Command line}
|
||||
Value 1
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
|
||||
Widget 11
|
||||
Property
|
||||
Size 150 30
|
||||
Position 175 135
|
||||
Type TextField
|
||||
Title {lpr}
|
||||
Value 200
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 12
|
||||
Property
|
||||
Size 340 100
|
||||
Position 10 200
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 13
|
||||
Property
|
||||
Position 15 192
|
||||
Type ItemDraw
|
||||
Title {Options:}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 14
|
||||
Property
|
||||
Position 30 220
|
||||
Type CheckBox
|
||||
Title {Include frame}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 14)==1 Then
|
||||
Set $Opt1 = {-frame}
|
||||
Else
|
||||
Set $Opt1 = { }
|
||||
End
|
||||
End
|
||||
|
||||
Widget 15
|
||||
Property
|
||||
Position 30 260
|
||||
Type CheckBox
|
||||
Title {Select the root window}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 15)==1 Then
|
||||
Set $Opt2 = {-root}
|
||||
Else
|
||||
Set $Opt2 = { }
|
||||
End
|
||||
End
|
||||
|
||||
|
||||
|
||||
@@ -1,437 +0,0 @@
|
||||
WindowTitle {Screen}
|
||||
WindowSize 430 530 # Taille
|
||||
WindowPosition 191 15 # Position
|
||||
ForeColor {black}
|
||||
BackColor {grey85}
|
||||
ShadowColor {grey55}
|
||||
HilightColor {grey100}
|
||||
Font -adobe-helvetica-bold-r-*-*-12-*
|
||||
|
||||
Init
|
||||
Begin
|
||||
WarpPointer 2
|
||||
If (GetOutput {xset -q} 11 3) == yes Then
|
||||
ChangeValue 10 1
|
||||
Else
|
||||
ChangeValue 11 1
|
||||
ChangeTitle 14 (GetOutput {xset -q} 12 2)
|
||||
ChangeTitle 15 (GetOutput {xset -q} 12 4)
|
||||
Set $BColor=(StrCopy (GetOutput {cat ~/.xinitrc-fvwm} 15 3) 2 8)
|
||||
Do {Exec echo } (StrCopy (GetOutput {cat ~/.xinitrc-fvwm} 15 3) 2 8) {>/dev/console}
|
||||
If (StrCopy $BColor 1 1)<>{#} Then
|
||||
Begin
|
||||
Set $BColor={#0EC4B8}
|
||||
ChangeTitle 7 (GetOutput {cat ~/.xinitrc-fvwm} 15 2)
|
||||
ChangeIcon 8 (GetTitle 7)
|
||||
ChangeValue 4 0
|
||||
ChangeValue 5 1
|
||||
End
|
||||
ChangeBackColor 6 $BColor
|
||||
ChangeValue 20 (HexToNum (StrCopy $BColor 2 3))
|
||||
ChangeValue 21 (HexToNum (StrCopy $BColor 4 5))
|
||||
ChangeValue 22 (HexToNum (StrCopy $BColor 6 7))
|
||||
End
|
||||
|
||||
PeriodicTasks
|
||||
Begin
|
||||
Set $MSG=(ReceivFromScript $BROWSER)
|
||||
If $MSG <> {No message} Then
|
||||
Begin
|
||||
ChangeTitle 7 $MSG
|
||||
ChangeIcon 8 $MSG
|
||||
End
|
||||
End
|
||||
|
||||
Widget 1
|
||||
Property
|
||||
Size 50 30
|
||||
Position 100 480
|
||||
Type PushButton
|
||||
Title {Apply}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Do {Exec xset s } (GetTitle 14) { } (GetTitle 15)
|
||||
If (GetValue 10)==1 Then
|
||||
Do {Exec xset s blank}
|
||||
Else
|
||||
Do {Exec xset s noblank}
|
||||
If (GetValue 5) == 1 Then
|
||||
Do {Exec xpmroot } (GetTitle 7)
|
||||
Else
|
||||
Do {Exec xsetroot -solid "} $BColor {"}
|
||||
End
|
||||
End
|
||||
|
||||
Widget 2
|
||||
Property
|
||||
Size 50 30
|
||||
Position 190 480
|
||||
Type PushButton
|
||||
Title {OK}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
If (GetValue 10)==1 Then
|
||||
Set $tmp2 = { s blank}
|
||||
Else
|
||||
Set $tmp2 = { s noblank}
|
||||
Do {Exec xset s } (GetTitle 14) { } (GetTitle 15) $tmp2
|
||||
WriteToFile .xinitrc-fvwm {Exec xset s } (GetTitle 14) { } (GetTitle 15) $tmp2
|
||||
If (GetValue 5) == 1 Then
|
||||
Begin
|
||||
Do {Exec xpmroot } (GetTitle 7)
|
||||
WriteToFile .xinitrc-fvwm {xpmroot } (GetTitle 7)
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
Do {Exec xsetroot -solid "} $BColor {"}
|
||||
WriteToFile .xinitrc-fvwm {xsetroot -solid "} $BColor {"}
|
||||
End
|
||||
WriteToFile .xinitrc-fvwm {xset s } (GetTitle 14) { } (GetTitle 15) $tmp2
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 3
|
||||
Property
|
||||
Size 50 30
|
||||
Position 280 480
|
||||
Type PushButton
|
||||
Title {Cancel}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Quit
|
||||
End
|
||||
End
|
||||
|
||||
Widget 4
|
||||
Property
|
||||
Position 30 30
|
||||
Type RadioButton
|
||||
Title {Uniform colour:}
|
||||
Value 1
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
ChangeValue 5 0
|
||||
End
|
||||
End
|
||||
|
||||
Widget 5
|
||||
Property
|
||||
Position 30 240
|
||||
Type RadioButton
|
||||
Title {Pixmap:}
|
||||
Value 0
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
ChangeValue 4 0
|
||||
End
|
||||
End
|
||||
|
||||
Widget 6
|
||||
Property
|
||||
Size 50 50
|
||||
Position 60 80
|
||||
Type ItemDraw
|
||||
BackColor {#0EC4B8}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 23
|
||||
Property
|
||||
Size 60 60
|
||||
Position 55 75
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 24
|
||||
Property
|
||||
Size 50 50
|
||||
Position 58 140
|
||||
Type ItemDraw
|
||||
Title {#0EC4B8}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 20
|
||||
Property
|
||||
Size 250 1
|
||||
Position 155 20
|
||||
Type HScrollBar
|
||||
Value 14
|
||||
MinValue 0
|
||||
MaxValue 255
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Set $BColor = {#} (NumToHex (GetValue 20) 2) (NumToHex (GetValue 21) 2) (NumToHex (GetValue 22) 2)
|
||||
ChangeTitle 24 $BColor
|
||||
ChangeBackColor 6 $BColor
|
||||
End
|
||||
End
|
||||
|
||||
Widget 21
|
||||
Property
|
||||
Size 250 1
|
||||
Position 155 75
|
||||
Type HScrollBar
|
||||
Value 196
|
||||
MinValue 0
|
||||
MaxValue 255
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Set $BColor = {#} (NumToHex (GetValue 20) 2) (NumToHex (GetValue 21) 2) (NumToHex (GetValue 22) 2)
|
||||
ChangeTitle 24 $BColor
|
||||
ChangeBackColor 6 $BColor
|
||||
End
|
||||
End
|
||||
|
||||
Widget 22
|
||||
Property
|
||||
Size 250 1
|
||||
Position 155 130
|
||||
Type HScrollBar
|
||||
Value 184
|
||||
MinValue 0
|
||||
MaxValue 255
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Set $BColor = {#} (NumToHex (GetValue 20) 2) (NumToHex (GetValue 21) 2) (NumToHex (GetValue 22) 2)
|
||||
ChangeTitle 24 $BColor
|
||||
ChangeBackColor 6 $BColor
|
||||
End
|
||||
End
|
||||
|
||||
Widget 7
|
||||
Property
|
||||
Size 280 30
|
||||
Position 30 300
|
||||
Type TextField
|
||||
Title {/usr/X11/include/X11/pixmaps/fvwm2.xpm}
|
||||
Value 200
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
ChangeIcon 8 (GetTitle 7)
|
||||
End
|
||||
End
|
||||
|
||||
Widget 25
|
||||
Property
|
||||
Position 327 299
|
||||
Type PushButton
|
||||
Title {Browser...}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
Set $ARG={FileBrowser } (GetTitle 7) { Hello word}
|
||||
Set $BROWSER=(LaunchScript $ARG )
|
||||
End
|
||||
End
|
||||
|
||||
Widget 8
|
||||
Property
|
||||
Size 175 75
|
||||
Position 120 215
|
||||
Type ItemDraw
|
||||
Icon /usr/X11/include/X11/pixmaps/fvwm2.xpm
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 9
|
||||
Property
|
||||
Size 179 79
|
||||
Position 118 213
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 10
|
||||
Property
|
||||
Position 50 380
|
||||
Type RadioButton
|
||||
Title {Blank}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
ChangeValue 11 0
|
||||
End
|
||||
End
|
||||
|
||||
Widget 11
|
||||
Property
|
||||
Position 50 425
|
||||
Type RadioButton
|
||||
Title {Pattern}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
ChangeValue 10 0
|
||||
End
|
||||
End
|
||||
|
||||
Widget 12
|
||||
Property
|
||||
Position 230 380
|
||||
Type ItemDraw
|
||||
Title {Timeout(s):}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 13
|
||||
Property
|
||||
Position 230 425
|
||||
Type ItemDraw
|
||||
Title {Cycle(s):}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
ChangeValue 10 0
|
||||
End
|
||||
End
|
||||
|
||||
Widget 14
|
||||
Property
|
||||
Size 80 79
|
||||
Position 310 375
|
||||
Type TextField
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 15
|
||||
Property
|
||||
Size 80 79
|
||||
Position 310 420
|
||||
Type TextField
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
ChangeValue 10 0
|
||||
End
|
||||
End
|
||||
|
||||
Widget 16
|
||||
Property
|
||||
Size 410 330
|
||||
Position 10 13
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
|
||||
Widget 17
|
||||
Property
|
||||
Size 410 105
|
||||
Position 10 355
|
||||
Type Rectangle
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
Widget 18
|
||||
Property
|
||||
Position 15 5
|
||||
Type ItemDraw
|
||||
Title {Background}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
|
||||
Widget 19
|
||||
Property
|
||||
Position 15 347
|
||||
Type ItemDraw
|
||||
Title {Screen-saver}
|
||||
Main
|
||||
Case message of
|
||||
SingleClic :
|
||||
Begin
|
||||
End
|
||||
End
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/* XPM */
|
||||
static char * a_xpm[] = {
|
||||
"56 46 8 1",
|
||||
" c None",
|
||||
". c #FFFFFFFFFFFF",
|
||||
"X c #000000000000",
|
||||
"o c #000008080808",
|
||||
"O c #52525555FFFF",
|
||||
"+ c #7B7B86869C9C",
|
||||
"@ c #737379798484",
|
||||
"# c #949496969494",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" .. ",
|
||||
" ..XX. ",
|
||||
" ..XX.X. ",
|
||||
" ..XX...X. ",
|
||||
" .XX.. .X. ",
|
||||
" .X.. .X. ",
|
||||
" .X. .X. oXXXXXoX ",
|
||||
" .X. .X. XX. . . XX ",
|
||||
" .X. ...X. oX........XX ",
|
||||
" .X. .XXXX. X...XXXX.. X ",
|
||||
" .X. .X..OX. XX..XXXXXX..X ",
|
||||
" .X. .X.OOX. X .XX ++XX . ",
|
||||
" .X. .XOOOX. X .X . @XX ",
|
||||
" ...X. .XXX. X .X... XX ",
|
||||
" .XXXX. ... X ...XXXX ",
|
||||
" .X..OX. X ..X ... ",
|
||||
" .X.OOX. X ..X#... ",
|
||||
" .XOOOX. X ..X+ .. ",
|
||||
" .XXX. X+ ..X+ + ",
|
||||
" ... XXXXXXX X+ ..X+@XX ",
|
||||
" ....... XX+ ..XXX.. ",
|
||||
" XX+ ...... ",
|
||||
" XXXXXXXXXXX XX+ .... ",
|
||||
" ........... XX+ +X ",
|
||||
" XX+@+@X ",
|
||||
" XXXXXXXXXXXX XXXXX ",
|
||||
" ............ ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
@@ -1,61 +0,0 @@
|
||||
/* XPM */
|
||||
static char * date_xpm[] = {
|
||||
"56 46 12 1",
|
||||
" c None",
|
||||
". c #FFFFFFFFFFFF",
|
||||
"X c #8C8C8E8E8C8C",
|
||||
"o c #DEDEDBDBDEDE",
|
||||
"O c #000000000000",
|
||||
"+ c #FFFF14144242",
|
||||
"@ c #CECE55552929",
|
||||
"# c #ADAD61616363",
|
||||
"$ c #B5B545455A5A",
|
||||
"% c #DEDEAEAE6B6B",
|
||||
"& c #FFFF8E8E0808",
|
||||
"* c #A5A579798C8C",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ............................... ",
|
||||
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXX.X ",
|
||||
" .XoooooooooooooOooooooooooooo.X ",
|
||||
" .XoooooooooooooOooooooooooooo.X ",
|
||||
" .Xo+++++++++++oOo+++++++++++o.X ",
|
||||
" .XoooooooooooooOooooooooooooo.X ",
|
||||
" .XoooooooooooOOoOOooooooooooo.X ",
|
||||
" .Xooooo@@#oooOOOOOooo@@#@oooo.X ",
|
||||
" .Xoooo#@$@oooooOoooo#@$@@@ooo.X ",
|
||||
" .Xooo@@%@@oooooOoooo@%o@%$ooo.X ",
|
||||
" .Xooo@o@$@oooooOooooooo@$@ooo.X ",
|
||||
" .Xooooo@%$oooooOoooooo@$@oooo.X ",
|
||||
" .Xoooo...............$@@%oooo.X ",
|
||||
" .Xooo.oooooooooooooooX@&ooooo.X ",
|
||||
" .Xooo.oXXXXXXXXXXXX.oX*oooooo.X ",
|
||||
" .Xooo.oXooooooooooo.oX@oooooo.X ",
|
||||
" .Xooo.oXoooooOooooo.oX@oooooo.X ",
|
||||
" .Xooo.oXoooooOooooo.oX@$@#ooo.X ",
|
||||
" .Xooo.oXoooooOooooo.oX$%@@ooo.X ",
|
||||
" .Xooo.oXoooooOooooo.oXooooooo.X ",
|
||||
" .Xooo.oXoooooOOOOoo.oXooooooo.X ",
|
||||
" .X....oXoooo@oooooo.oX........X ",
|
||||
" .oooo.oXooo@ooooooo.oXooooooooX ",
|
||||
" .XXXX.oXoo@oooooooo.oXXXXXXXXXX ",
|
||||
" .oXooooooooooo.oX ",
|
||||
" .oXooooooooooo.oX ",
|
||||
" .o.............oX ",
|
||||
" .oooooooooooooooX ",
|
||||
" .XXXXXXXXXXXXXXXX ",
|
||||
" XXXXXXXXXXXXXXX ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
@@ -1,65 +0,0 @@
|
||||
/* XPM */
|
||||
static char * window_xpm[] = {
|
||||
"48 48 14 1",
|
||||
" c None",
|
||||
". c #E7E7E3E3E7E7",
|
||||
"X c #C6C6C3C3C6C6",
|
||||
"o c #848482828484",
|
||||
"O c #A5A5A2A2A5A5",
|
||||
"+ c #636361616363",
|
||||
"@ c #00000000FFFF",
|
||||
"# c #FFFFFFFFFFFF",
|
||||
"$ c #DEDEDBDBDEDE",
|
||||
"% c #8C8C8E8E8C8C",
|
||||
"& c #4A4AD7D7BDBD",
|
||||
"* c #0000FFFF0000",
|
||||
"= c #21218A8A2121",
|
||||
"- c #212120202121",
|
||||
" ..................XXXXXXXXXXXXoo ",
|
||||
" .............XXXXXXXXXXOOOOOOO++oo ",
|
||||
" .............XXXXXXXXXOOOOOOOO++++oo ",
|
||||
" ..XOoOOOOOOOOOOOOOOOOOOOOOOOOO+++++++ ",
|
||||
" ..X@@@@@@@@@@@@@@@@@@@@@@@@OOO+++++++ ",
|
||||
" ..X@@@@@@@@@@@@@@@@@@@@@@@@OOO+++++++ ",
|
||||
" ..X@@@@@@@@@@@@@@@@@@@@@@@@OOO+++++++ ",
|
||||
" ..X@@@##################@@@OOO+++++++ ",
|
||||
" ..X@@@#$$#$$$$$$$$$#$$#%@@@OOO+++++++ ",
|
||||
" ..X@@@#%%%%%%%%%%%%%%%%%@@@OOO+++++++ ",
|
||||
" ..X@@@#&&&&&&&&&&&&&&&&%@@@OOO+++++++ ",
|
||||
" ..X@@@#&&&&&&&&&&&&&&&&%@@@OOO+++++++ ",
|
||||
" ..X@@@#&&&&&&&&&&&&&&&&%@@@OOO+++++++ ",
|
||||
" ..X@@@#&&&&&&&&&&&&&&&&%@@@OOO+++++++ ",
|
||||
" ..X@@@#&&&&&&&&&&&&&&&&%@@@OOO+++++++ ",
|
||||
" ..X@@@#&&&&&&&&&&&&&&&&%@@@OOO+++++++ ",
|
||||
" ..X@@@#&&&&&&&&&&&&&&&&%@@@OOO++++++ ",
|
||||
" ..X@@@#&&&&&&&&&&&&&&&&%@@@OOO++++++ ",
|
||||
" ..X@@@#%%%%%%%%%%%%%%%%%@@@OOO+++++ ",
|
||||
" ..X@@@@@@@@@@@@@@@@@@@@@@@@OOO+++++ ",
|
||||
" .XX@@@@@@@@@@@@@@@@@@@@@@@@OOO++++ ",
|
||||
" .XX@@@@@@@@@@@@@@@@@@@@@@@@OOO++++ ",
|
||||
" .XX@@@@@@@@@@@@@@@@@@@@@@@@OOO++++ ",
|
||||
" .XXOOOOOOO@@@@@@@@@@@@@@@@@OOO++++ ",
|
||||
" .XXXXXXXXXXXXXXXXXXXXOOOOOOOOO+++ ",
|
||||
" .XXXXXXXXXXXXXOOOOOOOOOO**OOOO+++ ",
|
||||
" OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO+++ ",
|
||||
" .#.XXOOOOOOOOOOOOOOOOOO++ ",
|
||||
" .#..XOOoo+++++++++++++++++++++oooo+",
|
||||
" .##..XOOoooooo++++++++++++++++++oooo++",
|
||||
" ......OOOooooooooo+++++++++++++ooooo++++",
|
||||
" .XOOOOXXXXXXXXOOOoooo++++++++ooooo++++++",
|
||||
" .XOOOOOOOOOOOOXXXXXXXXXOOOOOOOOO++++++++",
|
||||
" .XO**=OOOOOOOOOOOOOOOOOXXXXXXXX+++++++++",
|
||||
" .XO===OOOOOOOOOOOOOOOOOOOOOOOOO+++++++++",
|
||||
" .XOOOOOOOOOOOOOOOOOOOoooooOOOOO+++++++++",
|
||||
" #XOOOOOOOOOOOOOOOOOooo++++OoooO+++++++++",
|
||||
" XXXOXOOOOOOOOOOOOOOOOXXXXXXOOOO+++++++++",
|
||||
" OOXXOOXOXXOXXOOOOOOOOOOOOOOOOOOOO+++++++++",
|
||||
" OO..XOOXOOXOOXXOXXOXXOOOOOOOOOOOOOO+++++++ ",
|
||||
" OO...XoOXoOXoOOXOOXOOXOOoXXOXXOXOOOOO+++++ ",
|
||||
"oOX..OXoOXoO.oO.XoOXoOXoOX.XOOXOOXOoXO+-++ ",
|
||||
"oOOOXX......OOXXoOXoOXoOX.XoOXOOXOoXX++- ",
|
||||
" ooooOOOOXXXX#......XOOXXOoOOoOOOoXO++- ",
|
||||
" ooooooOOOOXXXX###...XXOOOOO.O++- ",
|
||||
" ooooooOOOOXXXX......Oo+- ",
|
||||
" ooooooOOOXXXOo+- ",
|
||||
" oooooo++ "};
|
||||
@@ -1,66 +0,0 @@
|
||||
/* XPM */
|
||||
static char * monitor_xpm[] = {
|
||||
"48 48 15 1",
|
||||
" s None c None",
|
||||
". c grey64",
|
||||
"X c white",
|
||||
"o c grey89",
|
||||
"O c grey76",
|
||||
"+ c grey51",
|
||||
"@ c magenta4",
|
||||
"# c grey39",
|
||||
"$ c grey13",
|
||||
"% c grey7",
|
||||
"& c grey4",
|
||||
"* c turquoise4",
|
||||
"= c blue4",
|
||||
"- c grey26",
|
||||
"; c green1",
|
||||
" ............................................. ",
|
||||
".XoXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXoO. ",
|
||||
".ooooooooooooooooooooooooooooooooooooOoOOOOOo.+ ",
|
||||
".XoooooooooooooooooooooooooooooooooooooOOOOOO@# ",
|
||||
".XoooooooooooooooooooooooooooooooooOoOOOOOOOO+$ ",
|
||||
".XoooooooooooooooooooooooooooooooooooOOOOOOOO@% ",
|
||||
".Xoooo&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.OOO*$ ",
|
||||
".Xoooo&#=#=###=#=#=#=#=#=#=#=#=#=#=#=#=#=XOOO@% ",
|
||||
".Xoooo&##=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#XOOO#% ",
|
||||
".Xoooo&#=XXXXXX#=XX#=XXXXX=#=#=#=#=#=#=##XOOO@% ",
|
||||
".Xoooo&=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#XOOO#% ",
|
||||
".Xoooo&#=XXX=XX#XXXXX#=XXXXXX#XXX#=#=#=#-XOO.@% ",
|
||||
".Xoooo&##=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=-XO.O#% ",
|
||||
".Xoooo&#=XXXX#XXXXXXX#XXXX=#=#=#=#=#=#=#-X...@% ",
|
||||
".Xoooo&=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=-XO..#% ",
|
||||
".Xoooo&#=XX#XXXX=XXXXX=XXXXX=#=#=#=#=#=#-X...=% ",
|
||||
".Xoooo&=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=-X...#% ",
|
||||
".Xoooo&#=XXXXX=#=#=#=#=#=#=#=#=#=#=#=#=#-X...#& ",
|
||||
".Xoooo&=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=-X...#% ",
|
||||
".Xoooo&#=XX#=#=#=#=#=#=#=#=#=#=#=#=#=#=#-X...#& ",
|
||||
".Xoooo&@#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=-X...#% ",
|
||||
".Xoooo&#=XXXX#XX=XXX=#=#=#=#=#=#=#=#=#=#-X...#& ",
|
||||
".Xoooo&=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=-X...#& ",
|
||||
".Xoooo&#=XXX=XXXX#=XXXX#=#=#=#=#=#=#=#=#-X...#& ",
|
||||
".Xoooo&=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=-X...#& ",
|
||||
".Xoooo&#=XX#=#=#=#=#=#=#=#=#=#=#=#=#=#=#-X...#& ",
|
||||
".Xoooo&=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=-X..+#& ",
|
||||
".Xoooo&#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#-X..+#& ",
|
||||
".Xoooo&=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=-X+++#& ",
|
||||
".Xoooo&#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#-X+++-& ",
|
||||
".Xoooo&##=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#X+++-& ",
|
||||
".Xoooo&#####=#=#=#=#=#@@=#=@=#=#=#####=#=X+++-& ",
|
||||
".Xoooo.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX+++-& ",
|
||||
".XoooooOoOOOOOOOOOOOOO................---++++-& ",
|
||||
".XoooOoOOOOOOOOOOOOOO...............++-;;O+++-& ",
|
||||
".XoooOOOOOOOOOOOOOOO................+++OOO+++-& ",
|
||||
".X.+@+@+@@@#@#@#################-#------------& ",
|
||||
".*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ",
|
||||
" .X#----$OO..+##--$$%%%$$--- ",
|
||||
" .X.######-#+*+##---%$$--####$ ",
|
||||
" .Xo++++++++##---------#++++++#$ ",
|
||||
" .XX............................#$ ",
|
||||
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX#$ ",
|
||||
" .X................................& ",
|
||||
" .X................................& ",
|
||||
" #&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ",
|
||||
" ",
|
||||
" "};
|
||||
@@ -1,64 +0,0 @@
|
||||
/* XPM */
|
||||
static char * keyboard_xpm[] = {
|
||||
"56 46 15 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #29295D5D4A4A",
|
||||
"o c #BDBDBABABDBD",
|
||||
"O c #E7E7E7E7EFEF",
|
||||
"+ c #BDBDC3C3BDBD",
|
||||
"@ c #7B7B86869C9C",
|
||||
"# c #C6C6BABAC6C6",
|
||||
"$ c #94949696ADAD",
|
||||
"% c #737379798484",
|
||||
"& c #7B7B9292B5B5",
|
||||
"* c #BDBDC3C3CECE",
|
||||
"= c #000000001010",
|
||||
"- c #BDBDB6B6BDBD",
|
||||
"; c #8C8C8A8A8C8C",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ................................ ",
|
||||
" XoO+oO+ooOo..XOo+oO+ooOo..XO+oOo ",
|
||||
" +OOOOOOOOO@..oOOOOOOOOO@..oOOOOO ",
|
||||
" oO@@@@@@@@X..oO@@@@@@@@X..oO@@@@ ",
|
||||
" oO@XXXXX@@X..oO@XXXXX@@X..oO@XXX ",
|
||||
" oO@XX@@@#@X..oO@XX@@@#@X..oO@XX@ ",
|
||||
" OO@X@$%&o@X..OO@X@$%&o@X..OO@X@@ ",
|
||||
" #O@X&%@@O@X..#O@X&%@@#@X..#O@X@@ ",
|
||||
" oO@X%$%#*@X..oO@X%$%*O@X..+O@X@@ ",
|
||||
" oO@@#**+o@X..oO@@#**oo@X..#O@@#o ",
|
||||
" OO@@@@%&@@X..OO@@@@@@@@X..OO@@@@ ",
|
||||
" #@XXXXXXXXX..#@XXXXXXXXX..o@XXXX ",
|
||||
" ..=.=..........=...........=.=.. ",
|
||||
" ................................ ",
|
||||
" o..XoOooOo+oOo..XoOo+Oo+oOo..X+O ",
|
||||
" @..oOOOOOOOOO@..oOOOOOOOOO@..oOO ",
|
||||
" X..OO@@@@@@@@X..oO@@@@@@@@X..oO@ ",
|
||||
" X..oO@XXXXX@@X..oO@XXXXX@@X..OO@ ",
|
||||
" X..oO@XX@@$-@X..OO@XX@@$-@X..oO@ ",
|
||||
" X..oO@X$%&%*@X..#O@X$%&%*@X..#O@ ",
|
||||
" X..oO@X%&%$-@X..+O%X&%$%*@X..oO@ ",
|
||||
" X..oO@X&@@oO@X..#O&X%&%*O@X..OO@ ",
|
||||
" X..OO@%##ooo@X..+O%$*#*oo@X..oO@ ",
|
||||
" X..#O;&@@@@@@X..OO&%@%@@@@X..#O@ ",
|
||||
" X..+@XXXXXXXXX..#@XXXXXXXXX..o@X ",
|
||||
" .....=..=.=.=.....=.=.=.=....... ",
|
||||
" ................................ ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
@@ -1,54 +0,0 @@
|
||||
/* XPM */
|
||||
static char * menu_xpm[] = {
|
||||
"56 46 5 1",
|
||||
" c None",
|
||||
". c #FFFFFFFFFFFF",
|
||||
"X c #DEDEDBDBDEDE",
|
||||
"o c #8C8C8E8E8C8C",
|
||||
"O c #000000000000",
|
||||
" ",
|
||||
" ",
|
||||
" ................................................. ",
|
||||
" .XXXXXXXXXXXXXoXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ",
|
||||
" .XXXXooooXXXoXXXoXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ",
|
||||
" .XXXXXoXXXXooXoXooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ",
|
||||
" .XXXXXooXXoXoXoXoXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ",
|
||||
" .XXXXXoXXXoXoXoXoXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ",
|
||||
" .XXXXooooXXooXoXXoXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ",
|
||||
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ",
|
||||
" ooooooooooooooooooooooooooooooooooooooooooooooooo ",
|
||||
" ............................ ",
|
||||
" .XXXXXXXXXXXXXXXXXXXXXXXXXXo ",
|
||||
" .XXXoooXXXXXXoXXXXXXXXXXXXXo ",
|
||||
" .XXoXXXoXoXoXooXXXXXXXXXXXXo ",
|
||||
" .XXoXXXXXoXoXoXXXXXXXXXXXXXo ",
|
||||
" .XXoXXXoXoXoXoXXXXXXXXXXXXXo ",
|
||||
" .XXXoooXXXooXXoXXXXXXXXXXXXo ",
|
||||
" .XXXXXXXXXXXXXXXXXXXXXXXXXXo ",
|
||||
" ...........................o ",
|
||||
" ..XXoooXXXXXXXXXXXXXXXXXXXoo ",
|
||||
" ..XoXXXoXXoXXooXXoXoXXXXXXoo ",
|
||||
" ..XoXXXXXoXoXoXoXoXoXXXXXXoo ",
|
||||
" ..XoXXXoXoXoXoXoXoXoXXXOOOOOOO ",
|
||||
" ..XXoooXXXoXXooXXXoXXXXXOOOOO ",
|
||||
" ..XXXXXXXXXXXoXXXXoXXXXXXOOOOO ",
|
||||
" ..XXXXXXXXXXXoXXXoXXXXXXXXOO OOO ",
|
||||
" ..oooooooooooooooooooooooooO OO ",
|
||||
" .XXXXXXXXXXXXXXXXXXXXXXXXXXo ",
|
||||
" .XXooooXXXXXXXoXXXXXXXXXXXXo ",
|
||||
" .XXXoXXooXXooXooXXoXXXXXXXXo ",
|
||||
" .XXXoooXXoXoXXoXXoooXXXXXXXo ",
|
||||
" .XXXoXXXooXXoXoXXoXXXXXXXXXo ",
|
||||
" .XXooXXXooXooXXoXXoXXXXXXXXo ",
|
||||
" .XXXXXXXXXXXXXXXXXXXXXXXXXXo ",
|
||||
" .XXXXXXXXXXXXXXXXXXXXXXXXXXo ",
|
||||
" .XXXXXXXXXXXXXXXXXXXXXXXXXXo ",
|
||||
" .XXXoooXXoXXXXXXXXXXXXXXXXXo ",
|
||||
" .XXoXXXoXoXXXoXXoXXoXoXXXXXo ",
|
||||
" .XXoXXXXXoXXoooXXoXooXXXXXXo ",
|
||||
" .XXoXXXoXoXXoXXXooXoXXXXXXXo ",
|
||||
" .XXXoooXXoXXXoXXooXoXXXXXXXo ",
|
||||
" .XXXXXXXXXXXXXXXXXXXXXXXXXXo ",
|
||||
" .ooooooooooooooooooooooooooo ",
|
||||
" ",
|
||||
" "};
|
||||
@@ -1,62 +0,0 @@
|
||||
/* XPM */
|
||||
static char * pointer_xpm[] = {
|
||||
"56 46 13 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #BDBDBABABDBD",
|
||||
"o c #ADADAAAAADAD",
|
||||
"O c #ADADAEAEADAD",
|
||||
"+ c #E7E7E7E7EFEF",
|
||||
"@ c #7B7B86869C9C",
|
||||
"# c #080804040808",
|
||||
"$ c #94949696ADAD",
|
||||
"% c #737379798484",
|
||||
"& c #7B7B9292B5B5",
|
||||
"* c #BDBDC3C3BDBD",
|
||||
"= c #000000001010",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" . . . .... ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" .... ",
|
||||
" XoXO ",
|
||||
" ...... ",
|
||||
" .++++++. ",
|
||||
" ....++++++++.... ",
|
||||
" .+++++++++++++++@. ",
|
||||
" .+++..........+@@. ",
|
||||
" .+...++++++++..#@. ",
|
||||
" .+.X..........X.@. ",
|
||||
" .+.+.@@@@@@@@.+.@. ",
|
||||
" .+.X.@@@$%&@@#X.@. ",
|
||||
" .+.X.#####....X#@. ",
|
||||
" .+.+XX+XXX+XX+X.@. ",
|
||||
" .+.*X*XX+*X*X*X#@. ",
|
||||
" .+.X+X*XXX*+XX+.@# ",
|
||||
" .+.*XX*X*+XXX*X.@. ",
|
||||
" .+.X+X+XXX*X+X*.@. ",
|
||||
" .+.X*X*X*X+X*XX#@. ",
|
||||
" .+.X+X*+X*X*+X+.@# ",
|
||||
" .+.*X*XXX+*XX*X#@. ",
|
||||
" .+.+XX+*XXX+XX*.@. ",
|
||||
" .+.XX*XX*X*X*X+#@. ",
|
||||
" .+.*+X*+X+XX*+X.@# ",
|
||||
" .+@....#..#...#@@. ",
|
||||
" .@@@@@@@@@@@@@@@@# ",
|
||||
" .$%&%$@@@@&%$%&@@. ",
|
||||
" .=.######.=##..# ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
@@ -1,119 +0,0 @@
|
||||
/* XPM */
|
||||
static char *shutdown[] = {
|
||||
/* width height num_colors chars_per_pixel */
|
||||
" 48 48 62 1",
|
||||
/* colors */
|
||||
". c #000000",
|
||||
"# c #00000f",
|
||||
"a c None",
|
||||
"b c #0f000f",
|
||||
"c c #0f001f",
|
||||
"d c #0f0f0f",
|
||||
"e c #0f0f1f",
|
||||
"f c #1f001f",
|
||||
"g c #1f002f",
|
||||
"h c #1f0f1f",
|
||||
"i c #1f0f2f",
|
||||
"j c #2f0040",
|
||||
"k c #2f0f40",
|
||||
"l c #400040",
|
||||
"m c #400050",
|
||||
"n c #400f40",
|
||||
"o c #400f50",
|
||||
"p c #400f60",
|
||||
"q c #500060",
|
||||
"r c #500f60",
|
||||
"s c #500f70",
|
||||
"t c #50402f",
|
||||
"u c #50502f",
|
||||
"v c #505040",
|
||||
"w c #505050",
|
||||
"x c #600070",
|
||||
"y c #600f80",
|
||||
"z c #600f90",
|
||||
"A c #60402f",
|
||||
"B c #604040",
|
||||
"C c #606750",
|
||||
"D c #700f90",
|
||||
"E c #700fa0",
|
||||
"F c #7020a0",
|
||||
"G c #705050",
|
||||
"H c #705060",
|
||||
"I c #706750",
|
||||
"J c #706760",
|
||||
"K c #800fa0",
|
||||
"L c #800fb0",
|
||||
"M c #800fcf",
|
||||
"N c #8020cf",
|
||||
"O c #900fb0",
|
||||
"P c #900fcf",
|
||||
"Q c #900fdf",
|
||||
"R c #9020cf",
|
||||
"S c #a00fdf",
|
||||
"T c #a00fef",
|
||||
"U c #a020df",
|
||||
"V c #a020ef",
|
||||
"W c #a08770",
|
||||
"X c #a09770",
|
||||
"Y c #a0a8a0",
|
||||
"Z c #b00fef",
|
||||
"0 c #b00fff",
|
||||
"1 c #b020ef",
|
||||
"2 c #b020ff",
|
||||
"3 c #b08770",
|
||||
"4 c #b08780",
|
||||
"5 c #cf0fff",
|
||||
"6 c #ffc8a0",
|
||||
"7 c #ffffff",
|
||||
/* pixels */
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaYIGIGIGIGIGwwIaaaaaaaaaa",
|
||||
"aaaaaaaaaaaaaaaaaaaaaaCHw66666666666X3Cwaaaaaaaa",
|
||||
"aaaaaaaaaaaaaaaaaaaaGC666666666666666666Gaaaaaaa",
|
||||
"aaaaaaaaaaaaaaaaaaaI666666666666666666666Jaaaaaa",
|
||||
"aaaaaaaaaaaaaaaaaaG66666666666366666666666GIaaaa",
|
||||
"aaaaaaaaaaaaaaaaaJ66666663X4X3X4X3X4vBX66666CJaa",
|
||||
"aaaaaaaaaaaaaaaaG666666tBuBtBuBtBuBt3X66666666GI",
|
||||
"aaaaaaaaaaaaaaaI6666vBv6666666666666666666666666",
|
||||
"aaaaaaaaaaaaaaGX66Bu6666666666666666666666666666",
|
||||
"aaaaaaaaaaaaaJX66B666666666666666666666666666666",
|
||||
"aaaaaaaaaaaaGX666u666666666666666666666666666666",
|
||||
"aaaaaaaaaaaIX666XB666666666666666666666666666666",
|
||||
".................ABX3WBXB.BuBABX3666666666666666",
|
||||
"77777777777777777YvB...........Bv366666666666666",
|
||||
"YYYYYYYYYYYYYYYYYYYwwwwww.........36666666666666",
|
||||
"YYYYYYYYYYYYYYYYYYYYYYYww..........6666666666666",
|
||||
"YYYYYYY77777777777777.YYw...........666666666666",
|
||||
"YYYYYYY7YYYYYYYYYYYYw.YYw............36666666666",
|
||||
"YYYYYYY7Y.wYYYYYYw.Yw.YYw..............666666666",
|
||||
"YYYYYYY7Yw.wYYYYw.wYw.YYw...............X6666666",
|
||||
"YYYYYYY7YYw.wYYw.wYYw.YYw................A3X6666",
|
||||
"YYYYYYY7YYYw.ww.wYYYw.YYw..................BX666",
|
||||
"YYYYYYY7YYYYw..wYYYYw.YYw................uBt3X6W",
|
||||
"YYYYYYY7YYYYw..wYYYYw.YYw......Bw.....vBvBX3X6X6",
|
||||
"YYYYYYY7YYYw.ww.wYYYw.YYw.....BaaAB....uBWBX3W6X",
|
||||
"YYYYYYY7YYw.wYYw.wYYw.YYw......aaaaavBvB.BvBXBX4",
|
||||
"YYYYYYY7Yw.wYYYYw.wYw.YYw.B....aaaaaaaaaauBtBuBt",
|
||||
"YYYYYYY7Y.wYYYYYYw.Yw.YYw.vB...aaaaaaaaaaaaavBvB",
|
||||
"YYYYYYY7YYYYYYYYYYYYw.YYw.auB.aaaaaaaaaaaaaaaaaa",
|
||||
"YYYYYYY7wwwwwwwwwwwww.YYw.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"YYYYYYY...............YYw.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"YYYYYYYYYYYYYYYYYYYYYYYYw.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"YYYYYYYYYYYYYYYYYYYYYYYYw.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"wwwwwwwwwwwwwwwwwwwwwwwww.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"..........................aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"YYYYYYYYYYYYYYYYYYYYYYYYY.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"YYYYYYYYYYYYYYYYYYYYYYYYY.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"YYYYYYYYYYYYYYYYYYYYYYYYY.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"YYYYYYYYYYYYYYYYYYYYYYYYY.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"YYYYYYYYYYYYYYYYYYYYYYYYY.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"YYYYYYYYYYYYYYYYYYYYYYYYY.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"wwwwwwwwwwwwwwwwwwww7YYYY.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"...................Y7YYYY.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"#chjkmossyzEELRSUZ2Y7YYYY.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"bbgilnqrxyDDKLPRS15Y7YYYY.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"dfejkmpssyzEFONQU22Y7YYYY.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"bbggjoqrxyDDLLPPTV5Y7YYYY.aaaaaaaaaaaaaaaaaaaaaa",
|
||||
"#chjkmpsszzEEMRSU02Y7YYYY.aaaaaaaaaaaaaaaaaaaaaa"
|
||||
};
|
||||
SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 48 NAXIS2 = 48 HISTORY Written by XV 3.10 END
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
/* XPM */
|
||||
static char * image_name[] = {
|
||||
"20 20 63 1",
|
||||
" c #DCDCDCDCDCDC",
|
||||
". c #D7D7D3D3D7D7",
|
||||
"X c #9E9E9A9A9E9E",
|
||||
"o c #CFCFC7C7CFCF",
|
||||
"O c #B6B6AEAEB6B6",
|
||||
"+ c #BEBEB6B6BEBE",
|
||||
"@ c #C7C7BABAC7C7",
|
||||
"# c #AEAEAEAEB6B6",
|
||||
"$ c #8E8E8A8A8E8E",
|
||||
"% c #AEAEB2B2CFCF",
|
||||
"& c #C4C4C4C4C4C4",
|
||||
"* c #B6B6B2B2B6B6",
|
||||
"= c #717175757171",
|
||||
"- c #717179798686",
|
||||
"; c #181820202020",
|
||||
": c #000000000000",
|
||||
"> c #797986869E9E",
|
||||
", c #515171718E8E",
|
||||
"< c #2F2F4F4F5050",
|
||||
"1 c #000000001010",
|
||||
"2 c #080804040808",
|
||||
"3 c #000000001818",
|
||||
"4 c #28282C2C3030",
|
||||
"5 c #B0B0B0B0B0B0",
|
||||
"6 c #B9B9B9B9B9B9",
|
||||
"7 c #202028285151",
|
||||
"8 c #2B2B2B2B2B2B",
|
||||
"9 c #5F5F5F5F5F5F",
|
||||
"0 c #96969696AEAE",
|
||||
"q c #494949495151",
|
||||
"w c #000008080808",
|
||||
"e c #69698686BEBE",
|
||||
"r c #696969697171",
|
||||
"t c #A6A6A6A6A6A6",
|
||||
"y c #BEBEBEBEBEBE",
|
||||
"u c #A6A6A2A2A6A6",
|
||||
"i c #AEAEA6A6AEAE",
|
||||
"p c #969692929696",
|
||||
"a c #999999999999",
|
||||
"s c #6B6B69696B6B",
|
||||
"d c #202020202020",
|
||||
"f c #555555555555",
|
||||
"g c #A9A9A9A9A9A9",
|
||||
"h c #79799292B6B6",
|
||||
"j c #5959A2A2D7D7",
|
||||
"k c #616161616161",
|
||||
"l c #A6A69E9EA6A6",
|
||||
"z c #D2D2B4B48C8C",
|
||||
"x c #F7F7B2B2AEAE",
|
||||
"c c #F5F5DEDEB3B3",
|
||||
"v c #FFFFE7E7BEBE",
|
||||
"b c #F0F0F0F0F0F0",
|
||||
"n c #FFFFFBFBFFFF",
|
||||
"m c #797979797979",
|
||||
"M c #BEBEBABABEBE",
|
||||
"N c #F7F7F3F3F7F7",
|
||||
"B c #FFFFFFFFFFFF",
|
||||
"V c #D7D7DFDFE7E7",
|
||||
"C c #525252525252",
|
||||
"Z c #666666666666",
|
||||
"A c #AEAEAAAAAEAE",
|
||||
"S c #909090909090",
|
||||
"D c #303034343030",
|
||||
" ..................X",
|
||||
"oO+++@#$%&++**++*Oo=",
|
||||
"oO+@#-;:;>&&+*++++o=",
|
||||
"oO+#,<122345o*++*+o=",
|
||||
"o+6-<<;74::8o+O**Oo=",
|
||||
"o+-<,9:;2:;10@OOOOo=",
|
||||
"&+,,,q,,3we7qoOOOOor",
|
||||
"@tee,q,,,:9<qyOOOO%r",
|
||||
"@u0uipas7d%eq+OOO#@s",
|
||||
"@u+o%%%0d9%>f+iigO+7",
|
||||
"@i#0heej:9h,k+iilz,9",
|
||||
"@l+xxx@o2l%r$Og0x90s",
|
||||
"@0icxvb.7n%=Oiu@m-os",
|
||||
"Mll#NBVC:C0uOX#$,O+Z",
|
||||
"+Xuai=:::p0iur7r#u*Z",
|
||||
"+XllA07q>u,*r,;*ul*Z",
|
||||
"6XlllO-S0#0072mOll*Z",
|
||||
"*plXXArrAX077SAl0lOk",
|
||||
"+iOOO6#0*O*Oy6OOOO@Z",
|
||||
"mffffffffffffffffffD"};
|
||||
@@ -1,83 +0,0 @@
|
||||
/* XPM */
|
||||
static char * image_name[] = {
|
||||
"20 20 60 1",
|
||||
" c #E9E9E9E9E9E9",
|
||||
". c #D7D7D3D3D7D7",
|
||||
"X c #DCDCD8D8DCDC",
|
||||
"o c #9E9E9A9A9E9E",
|
||||
"O c #CCCCCCCCCCCC",
|
||||
"+ c #B0B0B0B0B0B0",
|
||||
"@ c #B6B6B2B2B6B6",
|
||||
"# c #B9B9B9B9B9B9",
|
||||
"$ c #717175757171",
|
||||
"% c #D7D7DFDFE7E7",
|
||||
"& c #E7E7E7E7EFEF",
|
||||
"* c #D3D3D3D3D3D3",
|
||||
"= c #BEBEC3C3CFCF",
|
||||
"- c #A9A9A9A9A9A9",
|
||||
"; c #C7C7BABAC7C7",
|
||||
": c #AEAEAEAEB6B6",
|
||||
"> c #515171718E8E",
|
||||
", c #8E8E8A8A8E8E",
|
||||
"< c #38386D6DA6A6",
|
||||
"1 c #28284D4D9696",
|
||||
"2 c #717179798686",
|
||||
"3 c #202028285151",
|
||||
"4 c #CFCFC7C7CFCF",
|
||||
"5 c #BFBFC2C2BFBF",
|
||||
"6 c #6B6B69696B6B",
|
||||
"7 c #797979797979",
|
||||
"8 c #AEAE61616161",
|
||||
"9 c #868679798686",
|
||||
"0 c #8E8E86867979",
|
||||
"q c #3D3D3B3B3D3D",
|
||||
"w c #CFCFD3D3CFCF",
|
||||
"e c #AEAEB2B2CFCF",
|
||||
"r c #C4C4C4C4C4C4",
|
||||
"t c #DCDCDCDCDCDC",
|
||||
"y c #494949495151",
|
||||
"u c #BEBEBEBEBEBE",
|
||||
"i c #A0A0A0A0A0A0",
|
||||
"p c #555555555555",
|
||||
"a c #999999999999",
|
||||
"s c #5F5F5F5F5F5F",
|
||||
"d c #707080809090",
|
||||
"f c #2F2F4F4F5050",
|
||||
"g c #666666666666",
|
||||
"h c #696969697171",
|
||||
"j c #BEBEB6B6BEBE",
|
||||
"k c #BEBEBABABEBE",
|
||||
"l c #969692929696",
|
||||
"z c #535353535353",
|
||||
"x c #AAAAAAAAAAAA",
|
||||
"c c #7F7F7F7F7F7F",
|
||||
"v c #909090909090",
|
||||
"b c #A6A6A2A2A6A6",
|
||||
"n c #A6A6A6A6A6A6",
|
||||
"m c #96969696AEAE",
|
||||
"M c #A3A3D1D1F2F2",
|
||||
"N c #A6A69E9EA6A6",
|
||||
"B c #AEAEAAAAAEAE",
|
||||
"V c #B6B6AEAEB6B6",
|
||||
"C c #AEAEA6A6AEAE",
|
||||
"Z c #303034343030",
|
||||
" .................Xo",
|
||||
"O+@@@@########@###O$",
|
||||
"O#%%&%%%%%%*%%&=%-*$",
|
||||
"O;:>,>>>>>>><123>34$",
|
||||
"O5$67$$7$$789770,qw$",
|
||||
"Oe,r*wt tt tt*4X%yw$",
|
||||
"ru,@urip2a2sdO#r=fO$",
|
||||
"ru,@X.g::,7e$@Xw=fOh",
|
||||
"rj,k$77jkalk@z$x4frh",
|
||||
"r#,+c;vbOao4i,*,=fr6",
|
||||
";@,x-rk,*an.7u5mMfr6",
|
||||
"r@,@,@*c#vNB,O,r=fr6",
|
||||
";@,#r,OOOO*rrl-4=fu6",
|
||||
"k@,+O+v#@rOO6brOefk6",
|
||||
"kV,@=eOk@kr+g4#rMfu6",
|
||||
"kB,+k#esyzpyvr#ref#g",
|
||||
"#B,OtXX XX Mfjg",
|
||||
"#Ccg66666h66666$p3#g",
|
||||
"j:@CC::C:::C::::@#4g",
|
||||
"7pppppspppppppppppsZ"};
|
||||
@@ -1,76 +0,0 @@
|
||||
/* XPM */
|
||||
static char * image_name[] = {
|
||||
"20 20 53 1",
|
||||
" c #DCDCD8D8DCDC",
|
||||
". c #D3D3D3D3D3D3",
|
||||
"X c #CFCFC7C7CFCF",
|
||||
"o c #CCCCCCCCCCCC",
|
||||
"O c #999999999999",
|
||||
"+ c #C4C4C4C4C4C4",
|
||||
"@ c #B6B6AEAEB6B6",
|
||||
"# c #717175757171",
|
||||
"$ c #B6B6B2B2B6B6",
|
||||
"% c #696969697171",
|
||||
"& c #AEAEAEAEB6B6",
|
||||
"* c #B0B0B0B0B0B0",
|
||||
"= c #C7C7BABAC7C7",
|
||||
"- c #AEAEAEAEAEAE",
|
||||
"; c #6B6B69696B6B",
|
||||
": c #A6A6A2A2A6A6",
|
||||
"> c #666666666666",
|
||||
", c #AEAEAAAAAEAE",
|
||||
"< c #080804040808",
|
||||
"1 c #BEBEBABABEBE",
|
||||
"2 c #8E8E8A8A8E8E",
|
||||
"3 c #000000000000",
|
||||
"4 c #B9B9B9B9B9B9",
|
||||
"5 c #E9E9E9E9E9E9",
|
||||
"6 c #5F5F5F5F5F5F",
|
||||
"7 c #797979797979",
|
||||
"8 c #FFFFFFFFFFFF",
|
||||
"9 c #202020202020",
|
||||
"0 c #303034343030",
|
||||
"q c #535353535353",
|
||||
"w c #2B2B2B2B2B2B",
|
||||
"e c #494949495151",
|
||||
"r c #868679798686",
|
||||
"t c #A9A9A9A9A9A9",
|
||||
"y c #DCDCDCDCDCDC",
|
||||
"u c #D7D7D3D3D7D7",
|
||||
"i c #3D3D3B3B3D3D",
|
||||
"p c #EDEDEDEDEDED",
|
||||
"a c #F0F0F0F0F0F0",
|
||||
"s c #F7F7F3F3F7F7",
|
||||
"d c #909090909090",
|
||||
"f c #BEBEB6B6BEBE",
|
||||
"g c #A6A69E9EA6A6",
|
||||
"h c #181820202020",
|
||||
"j c #9E9E9A9A9E9E",
|
||||
"k c #CFCFD3D3CFCF",
|
||||
"l c #AAAAAAAAAAAA",
|
||||
"z c #616161616161",
|
||||
"x c #969692929696",
|
||||
"c c #969696969696",
|
||||
"v c #A0A0A0A0A0A0",
|
||||
"b c #A6A6A6A6A6A6",
|
||||
"n c #555555555555",
|
||||
" .XXXoXXXXXXXXXXXX.O",
|
||||
"+@@@@@@@@@@@@@@@@@+#",
|
||||
"+@@@$@@@$$@@$$$$@@X%",
|
||||
"+@@@@@@@@@@@@&@*@@+%",
|
||||
"+@=++=@@-@@$==$@@@+;",
|
||||
"=:##%>@@,@@$<<11$$+;",
|
||||
"+23333+=4141;25634X;",
|
||||
"=2378529220=q6=33w@;",
|
||||
"=23e2rt3<37y33u33w.;",
|
||||
"=2333i e3wp13<a03 u>",
|
||||
"1237syod3wXf3<5w3+=>",
|
||||
"123e2;gh33#+335w32@>",
|
||||
"173333w<13hf3<u733$>",
|
||||
"4j+..k+o+@+=lk4t1o z",
|
||||
"4xjjjjOOOjjjjjOOjO,z",
|
||||
"$dxOcjcOOcOOOxOOOc,6",
|
||||
"$dOOOcccOcccOcxOOO,z",
|
||||
"*dxxxOxcxxccxccxxxt6",
|
||||
"$vtltbltb,btlttltt16",
|
||||
"7qqqqqnqqnnqqnnnqqn0"};
|
||||
@@ -1,90 +0,0 @@
|
||||
/* XPM */
|
||||
static char * image_name[] = {
|
||||
"20 20 67 1",
|
||||
" c #DCDCD8D8DCDC",
|
||||
". c #CFCFC7C7CFCF",
|
||||
"X c #999999999999",
|
||||
"o c #C4C4C4C4C4C4",
|
||||
"O c #AEAEAAAAAEAE",
|
||||
"+ c #B6B6AEAEB6B6",
|
||||
"@ c #AEAEAEAEB6B6",
|
||||
"# c #717175757171",
|
||||
"$ c #B6B6B2B2B6B6",
|
||||
"% c #B0B0B0B0B0B0",
|
||||
"& c #BEBEB6B6BEBE",
|
||||
"* c #AEAEA6A6AEAE",
|
||||
"= c #BEBEBABABEBE",
|
||||
"- c #FFFFFBFBFFFF",
|
||||
"; c #FFFFFFFFFFFF",
|
||||
": c #666666666666",
|
||||
"> c #A6A69E9EA6A6",
|
||||
", c #B9B9B9B9B9B9",
|
||||
"< c #696969697171",
|
||||
"1 c #AEAEB2B2CFCF",
|
||||
"2 c #CCCCCCCCCCCC",
|
||||
"3 c #DCDCDCDCDCDC",
|
||||
"4 c #303034343030",
|
||||
"5 c #96969696AEAE",
|
||||
"6 c #3D3D3B3B3D3D",
|
||||
"7 c #515155554949",
|
||||
"8 c #909090909090",
|
||||
"9 c #D7D7D3D3D7D7",
|
||||
"0 c #000008080808",
|
||||
"q c #5F5F5F5F5F5F",
|
||||
"w c #8E8E8A8A8E8E",
|
||||
"e c #C7C7BABAC7C7",
|
||||
"r c #A6A6A2A2A6A6",
|
||||
"t c #6B6B69696B6B",
|
||||
"y c #DFDFBABA8E8E",
|
||||
"u c #DFDFAEAE6969",
|
||||
"i c #AEAE61616161",
|
||||
"p c #595951512828",
|
||||
"a c #616161616161",
|
||||
"s c #F0F0F0F0F0F0",
|
||||
"d c #BEBEBEBEBEBE",
|
||||
"f c #A9A9A9A9A9A9",
|
||||
"g c #AEAE9E9E5959",
|
||||
"h c #E7E7D7D79E9E",
|
||||
"j c #9E9E9A9A9E9E",
|
||||
"k c #F7F7F3F3F7F7",
|
||||
"l c #717179798686",
|
||||
"z c #A6A6A6A6A6A6",
|
||||
"x c #AEAEA6A67171",
|
||||
"c c #969692929696",
|
||||
"v c #7F7F7F7F7F7F",
|
||||
"b c #D2D2B4B48C8C",
|
||||
"n c #AAAAAAAAAAAA",
|
||||
"m c #797979797979",
|
||||
"M c #BFBFC2C2BFBF",
|
||||
"N c #525252525252",
|
||||
"B c #8E8E91918E8E",
|
||||
"V c #2F2F4F4F4F4F",
|
||||
"C c #28282C2C3030",
|
||||
"Z c #2B2B2B2B2B2B",
|
||||
"A c #8E8E86867979",
|
||||
"S c #555555555555",
|
||||
"D c #868679798686",
|
||||
"F c #969696969696",
|
||||
"G c #404042424040",
|
||||
"H c #AEAEAEAEAEAE",
|
||||
"J c #535353535353",
|
||||
" ..................X",
|
||||
"oO+++++++++@OO+++@o#",
|
||||
"o+$$%$$%$$OO+++&$+o#",
|
||||
"oO@$+++++*=-;;:>,+o<",
|
||||
"o*@+++,$@1;2+334++o<",
|
||||
"o*OO+$567890q#;ww$o<",
|
||||
"erO*+@tyuipaoXsdw$e<",
|
||||
"=rff+wgh:5qw$jk$l+=<",
|
||||
"=rfz$#xhiii<fcs%vO&<",
|
||||
"=>rf@tbhhhtk;;;;;f$<",
|
||||
",jrnmuxixpwM$%+%f#,t",
|
||||
"=j@wxgNBnVCCCCCZtm,:",
|
||||
",j8Ax4S=;XiAwwwicm,:",
|
||||
",Xibp6X$;D:####twm$:",
|
||||
"$c:77F5n;a6GGpG6mv+:",
|
||||
"%Xwwwrcf;zjrr>rr>m+a",
|
||||
"$cj>5Xcn$#wwwwwwm#Oa",
|
||||
"%wcccXcc8888c8ccccna",
|
||||
"$rffnffffHnfOnnnfn,q",
|
||||
"mJJJJSSJJJJJSSSJSJS6"};
|
||||
@@ -1,84 +0,0 @@
|
||||
/* XPM */
|
||||
static char * image_name[] = {
|
||||
"20 20 61 1",
|
||||
" c #F7F7F3F3F7F7",
|
||||
". c #DCDCDCDCDCDC",
|
||||
"X c #6B6B69696B6B",
|
||||
"o c #E9E9E9E9E9E9",
|
||||
"O c #999999999999",
|
||||
"+ c #A6A6A2A2A6A6",
|
||||
"@ c #C7C7BABAC7C7",
|
||||
"# c #555555555555",
|
||||
"$ c #A6A69E9EA6A6",
|
||||
"% c #AEAEAAAAAEAE",
|
||||
"& c #B6B6AEAEB6B6",
|
||||
"* c #B6B6B2B2B6B6",
|
||||
"= c #AEAEAEAEB6B6",
|
||||
"- c #AAAAAAAAAAAA",
|
||||
"; c #C4C4C4C4C4C4",
|
||||
": c #5F5F5F5F5F5F",
|
||||
"> c #A0A0A0A0A0A0",
|
||||
", c #666666666666",
|
||||
"< c #B0B0B0B0B0B0",
|
||||
"1 c #B9B9B9B9B9B9",
|
||||
"2 c #7F7F7F7F7F7F",
|
||||
"3 c #D3D3D3D3D3D3",
|
||||
"4 c #CCCCCCCCCCCC",
|
||||
"5 c #000000000000",
|
||||
"6 c #969696969696",
|
||||
"7 c #BEBEBABABEBE",
|
||||
"8 c #BEBEBEBEBEBE",
|
||||
"9 c #8E8E8A8A8E8E",
|
||||
"0 c #F0F0F0F0F0F0",
|
||||
"q c #181820202020",
|
||||
"w c #FFFFFFFFFFFF",
|
||||
"e c #404042424040",
|
||||
"r c #AEAEA6A6AEAE",
|
||||
"t c #515155554949",
|
||||
"y c #616161616161",
|
||||
"u c #909090909090",
|
||||
"i c #DCDCD8D8DCDC",
|
||||
"p c #AEAEB2B2CFCF",
|
||||
"a c #3D3D3B3B3D3D",
|
||||
"s c #CFCFC7C7CFCF",
|
||||
"d c #9E9E9A9A9E9E",
|
||||
"f c #717175757171",
|
||||
"g c #969692929696",
|
||||
"h c #5151A2A24949",
|
||||
"j c #707080809090",
|
||||
"k c #202020202020",
|
||||
"l c #797979797979",
|
||||
"z c #868679798686",
|
||||
"x c #A6A6A6A6A6A6",
|
||||
"c c #494949495151",
|
||||
"v c #080804040808",
|
||||
"b c #A9A9A9A9A9A9",
|
||||
"n c #BEBEB6B6BEBE",
|
||||
"m c #525252525252",
|
||||
"M c #303034343030",
|
||||
"N c #595951512828",
|
||||
"B c #8E8E86867979",
|
||||
"V c #8E8E91918E8E",
|
||||
"C c #96969696AEAE",
|
||||
"Z c #535353535353",
|
||||
"A c #2B2B2B2B2B2B",
|
||||
" ..................X",
|
||||
"oO++++++++++++++++@#",
|
||||
"o$%%&%**%=--%%%%&&;:",
|
||||
"o>&&&,o#$*<*&&1>&23:",
|
||||
"o$&&43&5+@+ X67o;X@:",
|
||||
"o$%%89,59=70q+1we5;:",
|
||||
"or64<#t5<y>u52ipa5s:",
|
||||
"o*8:9dX5fe>g5h ,-q;:",
|
||||
"o7j5+7952e1+q:f#4k@:",
|
||||
"o@l5+dz5xc1$v9by4k@:",
|
||||
"on+v+b95*m1%vlOy7q@:",
|
||||
"o*1MxOl5*m1%qNt:sk;:",
|
||||
"on>v%1B5bc8nqNNy7k;:",
|
||||
"o7f5$pf5Oe;nvyf,uv;:",
|
||||
"o@95Xfc59c6,qVnXe5s:",
|
||||
"o&lv9V:5fe+9v:l#y5;:",
|
||||
"o+$r+Xet9ljfNNM:9l4#",
|
||||
"o+**xC+n@8<*7@7@714:",
|
||||
"on;4ssss4ssss4sss;.:",
|
||||
"dZZZ###ZZZmZ#Z#####A"};
|
||||
@@ -1,81 +0,0 @@
|
||||
/* XPM */
|
||||
static char * image_name[] = {
|
||||
"20 20 58 1",
|
||||
" c #F7F7F3F3F7F7",
|
||||
". c #DCDCDCDCDCDC",
|
||||
"X c #DCDCD8D8DCDC",
|
||||
"o c #6B6B69696B6B",
|
||||
"O c #E9E9E9E9E9E9",
|
||||
"+ c #999999999999",
|
||||
"@ c #A6A69E9EA6A6",
|
||||
"# c #A6A6A2A2A6A6",
|
||||
"$ c #B6B6AEAEB6B6",
|
||||
"% c #717175757171",
|
||||
"& c #8E8E8A8A8E8E",
|
||||
"* c #CCCCCCCCCCCC",
|
||||
"= c #555555555555",
|
||||
"- c #AEAEAAAAAEAE",
|
||||
"; c #AEAEAEAEAEAE",
|
||||
": c #B6B6B2B2B6B6",
|
||||
"> c #AAAAAAAAAAAA",
|
||||
", c #A9A9A9A9A9A9",
|
||||
"< c #A6A6A6A6A6A6",
|
||||
"1 c #BEBEBABABEBE",
|
||||
"2 c #494949495151",
|
||||
"3 c #C7C7BABAC7C7",
|
||||
"4 c #696969697171",
|
||||
"5 c #797979797979",
|
||||
"6 c #707080809090",
|
||||
"7 c #5151A2A24949",
|
||||
"8 c #525252525252",
|
||||
"9 c #5F5F5F5F5F5F",
|
||||
"0 c #C4C4C4C4C4C4",
|
||||
"q c #969692929696",
|
||||
"w c #AEAEA6A6AEAE",
|
||||
"e c #D7D7D3D3D7D7",
|
||||
"r c #535353535353",
|
||||
"t c #CFCFC7C7CFCF",
|
||||
"y c #9E9E9A9A9E9E",
|
||||
"u c #BEBEB6B6BEBE",
|
||||
"i c #D3D3D3D3D3D3",
|
||||
"p c #868679798686",
|
||||
"a c #96969696AEAE",
|
||||
"s c #181820202020",
|
||||
"d c #8E8E91918E8E",
|
||||
"f c #515155554949",
|
||||
"g c #8E8E86867979",
|
||||
"h c #A0A0A0A0A0A0",
|
||||
"j c #B9B9B9B9B9B9",
|
||||
"k c #AEAEB2B2CFCF",
|
||||
"l c #FFFFFFFFFFFF",
|
||||
"z c #616161616161",
|
||||
"x c #404042424040",
|
||||
"c c #D7D7DFDFE7E7",
|
||||
"v c #FFFFFBFBFFFF",
|
||||
"b c #EDEDEDEDEDED",
|
||||
"n c #F0F0F0F0F0F0",
|
||||
"m c #202028285151",
|
||||
"M c #2F2F4F4F4F4F",
|
||||
"N c #303034343030",
|
||||
"B c #AEAE61616161",
|
||||
"V c #2B2B2B2B2B2B",
|
||||
" .XXXXXXXXXXXXXX...o",
|
||||
"O+@@@@#@@#@@#@#$%&*=",
|
||||
"O@-;::$->$$,<$1%o23=",
|
||||
"O@-$@4o5&67&&:89$=0=",
|
||||
"O@$3q&3w-,>1eqr#&+t=",
|
||||
"Oy0tu3tttiiO&=p#3$0=",
|
||||
"Oyta&&qwwow&sd2f3-0=",
|
||||
"Oy0++d+gh$52aj2=3-0=",
|
||||
"Oyk#lllll&zlllx=3-0=",
|
||||
"Oy3hllll%rllllx=3$0=",
|
||||
"Oa3yllc=zlllllx=3-0=",
|
||||
"Oykyll==llvv lx=3$0=",
|
||||
"Oak#l%9lvX. lx=3-09",
|
||||
"Oyk#<2bnOn lllx=3-0=",
|
||||
"Oa3h. lllllll2=k-0=",
|
||||
"Oy0:llllllllll==3$0=",
|
||||
"O#>mMNNNNNNNN2s=3$0=",
|
||||
"O#>zr==========B:w0=",
|
||||
"OuteXXcXXXcXXXXett.=",
|
||||
"arrrrrrrrrrrrrrrrr=V"};
|
||||
@@ -1,70 +0,0 @@
|
||||
/* XPM */
|
||||
static char * image_name[] = {
|
||||
"20 20 47 1",
|
||||
" c #E9E9E9E9E9E9",
|
||||
". c #D7D7D3D3D7D7",
|
||||
"X c #DCDCD8D8DCDC",
|
||||
"o c #96969696AEAE",
|
||||
"O c #CCCCCCCCCCCC",
|
||||
"+ c #B9B9B9B9B9B9",
|
||||
"@ c #B6B6B2B2B6B6",
|
||||
"# c #797979797979",
|
||||
"$ c #D3D3D3D3D3D3",
|
||||
"% c #BEBEBABABEBE",
|
||||
"& c #C4C4C4C4C4C4",
|
||||
"* c #C7C7BABAC7C7",
|
||||
"= c #CFCFD3D3CFCF",
|
||||
"- c #717175757171",
|
||||
"; c #404042424040",
|
||||
": c #A6A69E9EA6A6",
|
||||
"> c #666666666666",
|
||||
", c #6B6B69696B6B",
|
||||
"< c #555555555555",
|
||||
"1 c #A6A6A6A6A6A6",
|
||||
"2 c #BEBEBEBEBEBE",
|
||||
"3 c #B0B0B0B0B0B0",
|
||||
"4 c #A6A6A2A2A6A6",
|
||||
"5 c #5F5F5F5F5F5F",
|
||||
"6 c #8E8E8A8A8E8E",
|
||||
"7 c #AEAEAEAEB6B6",
|
||||
"8 c #AEAEB2B2CFCF",
|
||||
"9 c #B6B6AEAEB6B6",
|
||||
"0 c #9E9E9A9A9E9E",
|
||||
"q c #717179798686",
|
||||
"w c #AEAEAAAAAEAE",
|
||||
"e c #999999999999",
|
||||
"r c #909090909090",
|
||||
"t c #303034343030",
|
||||
"y c #AAAAAAAAAAAA",
|
||||
"u c #969696969696",
|
||||
"i c #494949495151",
|
||||
"p c #696969697171",
|
||||
"a c #A9A9A9A9A9A9",
|
||||
"s c #AEAEAEAEAEAE",
|
||||
"d c #2F2F4F4F4F4F",
|
||||
"f c #969692929696",
|
||||
"g c #BEBEB6B6BEBE",
|
||||
"h c #696908080808",
|
||||
"j c #515155554949",
|
||||
"k c #404040400000",
|
||||
"l c #202028285151",
|
||||
" .................Xo",
|
||||
"O++@++@++++++++++@O#",
|
||||
"O@++++++++++++++++$#",
|
||||
"O@@%+@&&&&&&&**%@+=-",
|
||||
"O@+@++%;:>-,<<12+3O-",
|
||||
"O@@@+%456#1788#3+@O-",
|
||||
"&9@@@%0#6<,,<-6q*@&-",
|
||||
"&w999@+;e+*rt2,-%9&-",
|
||||
"&y999@@;r%%ui%+@@9&p",
|
||||
"&awws@+df%gud+@www&p",
|
||||
"*4wyy@uh,88,hf@wwy*p",
|
||||
"&4awa8jhh77khj8aay%p",
|
||||
"*4aaa8jhk77kh<8aaa%p",
|
||||
"%4aaa8<hk77kh<8a4a%p",
|
||||
"%:444+jhk77khj+444+,",
|
||||
"+04:4@jhh11khj@44:@>",
|
||||
"+0:::y6h>77,h6y:::@>",
|
||||
"@e00::ao4444ea:0009>",
|
||||
"%w9@@9@@@@9@+3@@9@&>",
|
||||
"q<<<<<<<<<<<<<<<<<<l"};
|
||||
@@ -1,58 +0,0 @@
|
||||
/* XPM */
|
||||
static char * window_xpm[] = {
|
||||
"56 46 9 1",
|
||||
" c None",
|
||||
". c #FFFFFFFFFFFF",
|
||||
"X c #FFFFFBFBFFFF",
|
||||
"o c #DEDEDBDBDEDE",
|
||||
"O c #8C8C8E8E8C8C",
|
||||
"+ c #FFFFF3F3FFFF",
|
||||
"@ c #BDBDB6B6BDBD",
|
||||
"# c #00000000FFFF",
|
||||
"$ c #4A4AD7D7BDBD",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ........................................... ",
|
||||
" XoooOXoooooooooooooooooooooooooooOXoooOXoooO ",
|
||||
" XoOoO+oooooooooooooooooooooooooooOXoOoOXoOoO ",
|
||||
" XoooOXoooooooooooooooooooooooooooOXoooOXoooO ",
|
||||
" @OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ",
|
||||
" XO######################################...O ",
|
||||
" XO######################################.ooO ",
|
||||
" XO######################################.ooO ",
|
||||
" XO######################################.ooO ",
|
||||
" XO######################################.ooO ",
|
||||
" XO######################################.ooO ",
|
||||
" XO######################################.ooO ",
|
||||
" XO######################################.ooO ",
|
||||
" XO##############.................................. ",
|
||||
" XO##############.oooO.oooooooooooooooooO.oooO.ooo. ",
|
||||
" XO##############.oOoO.oooooooooooooooooO.oOoO.oOo. ",
|
||||
" XO##############.oooO.oooooooooooooooooO.oooO.ooo. ",
|
||||
" XO##############.OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ",
|
||||
" XO##############.O$$$$$$$$$$$$$$$$$$$$$$$$$$$$...O ",
|
||||
" XO##############.O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" XO##############.O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" +O##############.O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" XO##############.O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" XO##############.O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" XO##############.O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" +O##############.O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" XO##############.O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" +O##############.O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" XO##############.O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" +O##############.O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" XOXXXXXXXXXXXXXX.O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" +OOOOOOOOOOOOOOO.O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" .O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" .O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" .O$$$$$$$$$$$$$$$$$$$$$$$$$$$$.ooO ",
|
||||
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
@@ -1,411 +0,0 @@
|
||||
##############################################
|
||||
# Don't change the beginning of this file !!!#
|
||||
##############################################
|
||||
|
||||
#DeskSetup,4749
|
||||
KillModule FvwmAuto
|
||||
ChangeDefaultFocus SloppyFocus
|
||||
EdgeScroll 0 0
|
||||
ColormapFocus FollowsMouse
|
||||
OpaqueMoveSize 10
|
||||
DeskTopSize 4 2
|
||||
#end
|
||||
|
||||
#MenuSetup,1
|
||||
MenuStyle #000000 #d0d0d0 Black -adobe-times-bold-r-*-*-12-*-*-*-*-*-*-* mwm
|
||||
#end
|
||||
|
||||
#WinSetup,1
|
||||
WindowFont -adobe-times-bold-r-*-*-14-*-*-*-*-*-*-*
|
||||
IconFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
|
||||
HilightColor Yellow #5c54c0
|
||||
Style "*" BorderWidth 10, HandleWidth 10,IconBox 580x400-0-0
|
||||
Style "*" Icon unknown1.xpm, Color #AAFF00/RoyalBlue
|
||||
Style "*" ActivePlacement, SmartPlacement,SkipMapping
|
||||
Style "*" MWMFunctions,HintOverride,MWMBorder
|
||||
Style "*" DecorateTransient
|
||||
#end
|
||||
|
||||
|
||||
##############################################
|
||||
# Here, you can modify this file #
|
||||
##############################################
|
||||
|
||||
|
||||
# small up triangle
|
||||
ButtonStyle 2 4 50x35@1 65x65@0 35x65@0 50x35@1
|
||||
# small down triangle
|
||||
ButtonStyle 4 4 50x65@1 35x35@1 65x35@1 50x65@0
|
||||
|
||||
# some other ButtonStyles:
|
||||
# large up triangle
|
||||
#ButtonStyle 2 4 50x25@1 75x75@0 25x75@0 50x25@1
|
||||
# large down triangle
|
||||
#ButtonStyle 4 4 50x75@1 25x25@1 75x25@1 50x75@0
|
||||
# big box
|
||||
#ButtonStyle 2 5 25x25@1 25x75@1 75x75@0 75x25@0 25x25@1
|
||||
# little box
|
||||
#ButtonStyle 8 5 40x40@1 60x40@1 60x60@0 40x60@0 40x40@1
|
||||
# tall box
|
||||
#ButtonStyle 6 5 40x25@1 60x25@1 60x75@0 40x75@0 40x25@1
|
||||
# dot
|
||||
#ButtonStyle 4 5 45x45@1 55x45@1 55x55@0 45x55@0 45x45@1
|
||||
# an up arrow:
|
||||
#ButtonStyle 2 8 40x80@1 40x50@1 20x50@1 50x20@1 80x50@0 60x50@0 60x80@0 40x80@0
|
||||
# an X
|
||||
#ButtonStyle 3 13 26x29@1 34x21@1 50x35@1 70x21@1 79x29@1 63x48@0 79x65@1 70x75@0 50x61@0 34x75@0 26x65@0 44x48@1 26x29@0
|
||||
|
||||
|
||||
|
||||
ModulePath /usr/lib/X11/fvwm
|
||||
PixmapPath /usr/X11/lib/TkDesk/images/next/:/usr/include/X11/pixmaps/:/usr/X11R6/include/X11/mini-icons/:/usr/X11R6/include/X11/3dpixmaps/normal:/usr/X11R6/include/X11/3dpixmaps/next/:/usr/X11R6/include/X11/3dpixmaps/small
|
||||
IconPath /usr/X11/lib/TkDesk/images/next/:/usr/X11R6/include/X11/pixmaps/:/usr/X11R6/include/X11/mini-icons/
|
||||
|
||||
*FvwmScriptPath /usr/X11/lib/X11/fvwm
|
||||
|
||||
ClickTime 750
|
||||
# EdgeResistance 0 0
|
||||
|
||||
|
||||
Style "Fvwm*" NoHandles, Sticky, WindowListSkip,
|
||||
Style "Fvwm*" BorderWidth 8,CirculateSkipIcon
|
||||
Style "FvwmButtons" NoTitle, NoHandles, Sticky, WindowListSkip
|
||||
Style "FvwmButtons" BorderWidth 8, CirculateSkip
|
||||
Style "FvwmButtons" Icon toolbox.xpm
|
||||
Style "FvwmIdent" Title
|
||||
Style "xbiff" NoTitle, Sticky, WindowListSkip
|
||||
Style "Maker" StartsOnDesk 1,RandomPlacement
|
||||
Style "rxvt" Icon term.xpm,SloppyFocus
|
||||
Style "XTerm" Icon xterm.xpm
|
||||
Style "Appointment" Icon datebook.xpm, NoButton 2, NoButton 4
|
||||
Style "xcalc" Icon xcalc.xpm, NoButton 2
|
||||
Style "xmh" Icon mail1.xpm, NoIconTitle,StickyIcon
|
||||
Style "xmh" RandomPlacement, StartsOnDesk 2, NoButton 2
|
||||
Style "xman" Icon xman.xpm,RandomPlacement
|
||||
Style "xvgr" Icon graphs.xpm,RandomPlacement
|
||||
Style "matlab" Icon math4.xpm
|
||||
Style "xmag" Icon mag_glass.xpm,RandomPlacement
|
||||
Style "xgraph" Icon graphs.xpm,RandomPlacement
|
||||
Style "sppeed6" Icon math3.xpm,NoTitle
|
||||
Style "sppeed6_user" Icon math4.xpm,NoTitle
|
||||
Style "xmosaic" NoPPosition, color Green/Yellow
|
||||
Style "textedit" Icon editor.xpm
|
||||
Style "Edit" BorderWidth 5, HandleWidth 2,NoHandles, NoButton 2, NoButton 4
|
||||
Style "Edit" SloppyFocus,StaysOnTop, WindowListSkip
|
||||
Style "/mnt/floppy/" Icon floppy.xpm
|
||||
Style "/mnt/cdrom/" Icon cdisc.xpm
|
||||
Style "TkDesk Application Bar" Sticky, WindowListSkip, CirculateSkip,BorderWidth 0,NoTitle, NoHandles
|
||||
Style "Disk Usage" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "Background #1" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "Job Control" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "Find Files" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "Delete Files" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "File Information" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "Rename File" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "Copy, Move, Link Files" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "New File" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "New Directory" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "Info" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "Execute" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "Control" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "File modified" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "Starting..." NoHandles, BorderWidth 8, NoButton 4,NoButton 2,NoButton 1
|
||||
Style "File exists" NoHandles, BorderWidth 8, NoButton 4,NoButton 2,NoButton 1
|
||||
Style "TkMan v1.7.3" Icon xman.xpm
|
||||
Style "Logout" NoHandles, BorderWidth 8, NoButton 4,NoButton 2,Sticky,StaysOnTop
|
||||
Style "shutdown" NoHandles, NoTitle, BorderWidth 8, NoButton 4,NoButton 1,NoButton 2 ,Sticky,StaysOnTop
|
||||
Style "Screen Setup" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "Bell Setup" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "Keyboard Setup" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "Pointer Setup" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "Date" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
Style "Confirmation" NoHandles, BorderWidth 8, NoButton 4,NoButton 2
|
||||
|
||||
|
||||
Mouse 1 R A Menu Utilities Nop
|
||||
Mouse 2 R A Menu Window-Ops Nop
|
||||
Mouse 3 R A WindowList
|
||||
Mouse 1 1 A Raise-or-Delete
|
||||
Mouse 2 1 A Menu Window-Ops2
|
||||
Mouse 3 1 A RaiseLower
|
||||
Mouse 0 2 A Maximize-Func
|
||||
Mouse 0 4 A Iconify
|
||||
Mouse 1 F A Resize-or-Raise
|
||||
Mouse 1 T A Move-or-Raise
|
||||
Mouse 1 S A Resize-or-Raise
|
||||
Mouse 1 I A Move-or-Iconify
|
||||
Mouse 2 I A Menu Window-Ops Nop
|
||||
Mouse 2 FST A Menu Window-Ops2 Nop
|
||||
Mouse 3 TSIF A RaiseLower
|
||||
|
||||
|
||||
########################Initialization Functions ############################
|
||||
AddToFunc InitFunction "I" Module FvwmScript Buttons
|
||||
#+ "I" Module FvwmButtons
|
||||
#+ "I" Module FvwmBacker
|
||||
#+ "I" Module FvwmAudio
|
||||
|
||||
AddToFunc RestartFunction "I" Module FvwmScript Buttons
|
||||
#+ "I" Module FvwmBacker
|
||||
#+ "I" Module FvwmAudio
|
||||
########################Menus ########################################
|
||||
|
||||
# The following menus form the bulk of the menu system I have hanging
|
||||
# off the GoodStuff module; they contain most of my commonly used
|
||||
# X-based tools. Note that I use rxvt instead of xterm for most of my
|
||||
# shells due to memory constraints; if you use xterms or some variant
|
||||
# thereof (aixterm, cxterm, kxterm, etc.) you'll need to change quite
|
||||
# a few things. --tabaer@magnus
|
||||
|
||||
# A menu of VT100 size shells
|
||||
AddToMenu "80x25" "80x25 Shells" Nop
|
||||
+ "" Nop
|
||||
+ "Black on white" Exec exec color_xterm -sb -ls -geometry 80x25 -fg Black -bg White &
|
||||
+ "Gold on black" Exec exec color_xterm -sb -ls -geometry 80x25 -fg gold1 -bg Black &
|
||||
+ "Green on black" Exec exec color_xterm -sb -ls -geomtery 80x25 -fg green2 -bg Black &
|
||||
+ "White on black" Exec exec color_xterm -sb -ls -geometry 80x25 -fg White -bg Black &
|
||||
+ "Yellow on blue" Exec exec color_xterm -sb -ls -geometry 80x25 -fg Yellow -bg Blue &
|
||||
|
||||
# A menu of slightly larger shells
|
||||
AddToMenu "80x40" "80x40 Shells" Nop
|
||||
+ "" Nop
|
||||
+ "Black on gray" Exec exec color_xterm -sb -ls -geometry 80x40 -fg Black -bg LightGray &
|
||||
+ "Black on white" Exec exec color_xterm -sb -ls -geometry 80x40 -fg Black -bg White &
|
||||
+ "Gold on black" Exec exec color_xterm -sb -ls -geometry 80x40 -fg gold1 -bg Black &
|
||||
+ "Green on black" Exec exec color_xterm -sb -ls -geometry 80x40 -fg green2 -bg Black &
|
||||
+ "White on black" Exec exec xterm -sb -ls -geometry 80x40 -fg White -bg Black &
|
||||
+ "Yellow on blue" Exec exec xterm -sb -ls -geometry 80x40 -fg Yellow -bg Blue &
|
||||
|
||||
AddToMenu "Pict" "Pict viewer" Nop
|
||||
+ "" Nop
|
||||
+ "Loupe" Exec exec xmag &
|
||||
+ "Bitmap Viewer" Exec exec bitmap &
|
||||
+ "PostScript Previewer" Exec exec ghostview -magstep 1 &
|
||||
+ "XV" Exec exec xv &
|
||||
+ "XFigure" Exec exec xfig &
|
||||
+ "XPaint" Exec exec xpaint &
|
||||
|
||||
AddToMenu "Prog" "Development" Nop
|
||||
+ "" Nop
|
||||
+ "EditRes" Exec exec editres &
|
||||
+ "Lisp" Exec exec xterm -sb -bg grey -e clisp &
|
||||
+ "XXGdb" Exec exec xxgdb &
|
||||
+ "Environnement C" Exec exec xwpe &
|
||||
|
||||
# A set of NASTY time killers...
|
||||
AddToMenu "Games" "Games" Nop
|
||||
+ "" Nop
|
||||
+ "GnuChess" Exec exec xboard &
|
||||
+ "Lander" Exec exec xlander &
|
||||
+ "Xgalaga" Exec exec xgal &
|
||||
+ "Xeyes" Exec exec xeyes &
|
||||
+ "Xhextris" Exec exec xhextris &
|
||||
+ "Xlogo" Exec exec xlogo &
|
||||
+ "Xmahjongg" Exec exec xmahjongg &
|
||||
+ "Xtetris" Exec exec xtetris &
|
||||
+ "Xvier" Exec exec xvier &
|
||||
+ "Doom" Exec exec xdoom &
|
||||
|
||||
AddToMenu "ScreenSaver" "Screen Saver" Nop
|
||||
+ "" Nop
|
||||
+ "Bat" Exec exec xlock -nolock -nice 0 -mode bat &
|
||||
+ "Blank" Exec exec xlock -nolock -nice 0 -mode blank &
|
||||
+ "Blot" Exec exec xlock -nolock -nice 0 -mode blot &
|
||||
+ "Bob" Exec exec xlock -nolock -nice 0 -mode bob &
|
||||
+ "Bounce" Exec exec xlock -nolock -nice 0 -mode bounce &
|
||||
+ "Flame" Exec exec xlock -nolock -nice 0 -mode flame &
|
||||
+ "Galaxy" Exec exec xlock -nolock -nice 0 -mode galaxy &
|
||||
+ "Grav" Exec exec xlock -nolock -nice 0 -mode grav &
|
||||
+ "Helix" Exec exec xlock -nolock -nice 0 -mode helix &
|
||||
+ "Hop" Exec exec xlock -nolock -nice 0 -mode hop &
|
||||
+ "Hyper" Exec exec xlock -nolock -nice 0 -mode hyper &
|
||||
+ "Kaleid" Exec exec xlock -nolock -nice 0 -mode kaleid &
|
||||
+ "Life" Exec exec xlock -nolock -nice 0 -mode life &
|
||||
+ "Life3d" Exec exec xlock -nolock -nice 0 -mode life3d &
|
||||
+ "Maze" Exec exec xlock -nolock -nice 0 -mode maze &
|
||||
+ "Pyro" Exec exec xlock -nolock -nice 0 -mode pyro &
|
||||
+ "Qix" Exec exec xlock -nolock -nice 0 -mode qix &
|
||||
+ "Random" Exec exec xlock -nolock -nice 0 -mode random &
|
||||
+ "Rect" Exec exec xlock -nolock -nice 0 -mode rect &
|
||||
+ "Rock" Exec exec xlock -nolock -nice 0 -mode rock &
|
||||
+ "Rotor" Exec exec xlock -nolock -nice 0 -mode rotor &
|
||||
|
||||
# Menu of silly things every X setup should have
|
||||
AddToMenu "Toys" "Toys" Nop
|
||||
+ "" Nop
|
||||
+ "X-Eyes" Exec exec xeyes &
|
||||
+ "X-Roaches" Exec exec xroach &
|
||||
|
||||
# Here are the top-level menus hanging off GoodStuff. As you'll see,
|
||||
# they call other menus a lot. --tabaer@magnus
|
||||
|
||||
AddToMenu "Shells" "Shells" Nop
|
||||
+ "" Nop
|
||||
+ "80x25" PopUp 80x25
|
||||
+ "80x40" PopUp 80x40
|
||||
# This defines the most common window operations
|
||||
# As with the key bindings (see below), these were appropriated from
|
||||
# a stock SGI .4Dwmrc file
|
||||
|
||||
AddToMenu "Utilities" "Tools" Nop
|
||||
+ "" Nop
|
||||
+ "Clipboard" Exec exec xclipboard &
|
||||
+ "Lecture CD audio" Exec exec workman &
|
||||
+ "Eject CD Rom" Exec exec eject &
|
||||
+ "R<>glage son" Exec exec xmix &
|
||||
+ "Format disquette" Exec exec /sbin/formatdos &
|
||||
+ "MemInfo" Exec meminfo &
|
||||
+ "Restart fvwm" Restart fvwm
|
||||
+ "Shells" PopUp Shells
|
||||
+ "Pict viewer" PopUp Pict
|
||||
+ "Development" PopUp Prog
|
||||
+ "Modules" Popup Module-Popup
|
||||
+ "Demos" Popup Demos
|
||||
+ "ScreenSavers" Popup ScreenSaver
|
||||
|
||||
|
||||
AddToMenu "Demos" "Demos" Nop
|
||||
+ "" Nop
|
||||
+ "X Demos and Toys" PopUp Toys
|
||||
+ "X Games" PopUp Games
|
||||
|
||||
|
||||
|
||||
AddToMenu Window-Ops "Window Ops" Title
|
||||
+ "Move%mini.move.xpm%" Move-or-Raise2
|
||||
+ "Resize%mini.resize.xpm%" Resize-or-Raise2
|
||||
+ "Raise%mini.raise.xpm%" Raise
|
||||
+ "Lower%mini.lower.xpm%" Lower
|
||||
+ "(De)Iconify" Iconify
|
||||
+ "(Un)Stick" Stick
|
||||
+ "(Un)Maximize" maximize_func
|
||||
+ "" Nop
|
||||
+ "Delete%mini.destroy.xpm%" Delete
|
||||
+ "Close%mini.destroy.xpm%" Close
|
||||
+ "Destroy%mini.destroy.xpm%" Destroy
|
||||
+ "" Nop
|
||||
+ "Refresh Screen" Refresh
|
||||
AddToMenu Window-Ops2 "Move%mini.move.xpm%" Move-or-Raise2
|
||||
+ "Resize%mini.resize.xpm%" Resize-or-Raise2
|
||||
+ "Raise%mini.raise.xpm%" Raise
|
||||
+ "Lower%mini.lower.xpm%" Lower
|
||||
+ "(De)Iconify" Iconify
|
||||
+ "(Un)Stick" Stick
|
||||
+ "(Un)Maximize" maximize_func
|
||||
+ "" Nop
|
||||
+ "Delete%mini.destroy.xpm%" Delete
|
||||
+ "Close%mini.destroy.xpm%" Close
|
||||
+ "Destroy%mini.destroy.xpm%" Destroy
|
||||
+ "" Nop
|
||||
+ "ScrollBar" Module FvwmScroll 2 2
|
||||
+ "Print" PrintFunction
|
||||
|
||||
AddToMenu Module-Popup "Modules" Title
|
||||
+ "Button-Bar" Module FvwmButtons
|
||||
+ "Clean-Up" Module FvwmClean
|
||||
+ "Identify" Module FvwmIdent
|
||||
+ "SaveDesktop" Module FvwmSave
|
||||
+ "WinList" Module FvwmWinList
|
||||
+ "Background" Module FvwmBacker
|
||||
+ "IconBox" Module FvwmIconBox
|
||||
+ "Banner" Module FvwmBanner
|
||||
+ "Talk" Module FvwmConsole
|
||||
+ "Configuration" Module FvwmConfig
|
||||
|
||||
########################Functions ########################################
|
||||
|
||||
AddToFunc MailFunction "I" Next [$0] Iconify -1
|
||||
+ "I" Next [$0] focus
|
||||
+ "I" None [$0] Exec $0 $1
|
||||
|
||||
AddToFunc Move-or-Raise "I" Raise
|
||||
+ "M" Move
|
||||
+ "D" Maximize 100 100
|
||||
|
||||
AddToFunc Move-or-Raise2 "M" Raise
|
||||
+ "M" Move
|
||||
+ "D" Lower
|
||||
|
||||
AddToFunc Maximize-Func "M" Maximize 0 100
|
||||
+ "C" Maximize 0 80
|
||||
+ "D" Maximize 100 100
|
||||
|
||||
AddToFunc Move-or-Iconify "I" Raise
|
||||
+ "M" Move
|
||||
+ "D" Iconify
|
||||
|
||||
AddToFunc Resize-or-Raise "I" Raise
|
||||
+ "M" Resize
|
||||
+ "D" Lower
|
||||
|
||||
AddToFunc Resize-or-Raise2 "M" Raise
|
||||
+ "M" Resize
|
||||
+ "D" Lower
|
||||
|
||||
AddToFunc PrintFunction "I" Raise
|
||||
+ "I" Exec xdpr -id $w
|
||||
|
||||
AddToFunc Iconify-and-Raise "I" Iconify
|
||||
+ "I" Raise
|
||||
|
||||
AddToFunc Raise-or-Delete "D" Close
|
||||
|
||||
|
||||
########################## Window-Identifier ###############################
|
||||
# Just choose colors and a fonts
|
||||
*FvwmIdentBack MidnightBlue
|
||||
*FvwmIdentFore Yellow
|
||||
*FvwmIdentFont -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*
|
||||
|
||||
########################### Pager #########################################
|
||||
*FvwmPagerBack Grey85
|
||||
*FvwmPagerFore Black
|
||||
*FvwmPagerFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
|
||||
*FvwmPagerHilight Grey70
|
||||
*FvwmPagerGeometry 130x56-1500-1500
|
||||
*FvwmPagerLabel 0 FvwmPager
|
||||
*FvwmPagerSmallFont 5x8
|
||||
|
||||
|
||||
|
||||
*FvwmBackerDesk 0 xpmroot /usr/X11/include/X11/pixmaps/Xlogo.xpm
|
||||
*FvwmBackerDesk 1 xpmroot /usr/X11/include/X11/pixmaps/fond1.xpm
|
||||
|
||||
*FvwmScrollBack grey40
|
||||
*FvwmScrollFore green
|
||||
|
||||
############################################################
|
||||
############################################################
|
||||
# Note that icons are shown in the module
|
||||
# only if NoIcon commnand is applied.
|
||||
#Style "*" NoIcon
|
||||
|
||||
############################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#*FvwmAudioPlayCmd playsnd
|
||||
#*FvwmAudioDir /usr/lib/sounds
|
||||
#*FvwmAudioDelay 0
|
||||
#*FvwmAudio startup exit.raw
|
||||
#*FvwmAudio shutdown exit.raw
|
||||
#*FvwmAudio iconify icon.raw
|
||||
#*FvwmAudio deiconify deicon.raw
|
||||
#*FvwmAudio unknown defaut.raw
|
||||
#*FvwmAudio destroy_window close.raw
|
||||
|
||||
|
||||
|
||||
*FvwmWinListBack DarkOliveGreen
|
||||
*FvwmWinListFore PaleGoldenRod
|
||||
*FvwmWinListFont -*-new century schoolbook-bold-r-*-*-*-120-*-*-*-*-*-*
|
||||
*FvwmWinListAction Click1 Focus,Iconify -1,Focus
|
||||
*FvwmWinListAction Click2 Iconify
|
||||
*FvwmWinListAction Click3 Module "FvwmIdent" FvwmIdent
|
||||
*FvwmWinListUseSkipList
|
||||
*FvwmWinListUseIconNames
|
||||
*FvwmWinListGeometry -50-85
|
||||
# I like it achored
|
||||
*FvwmWinListNoAnchor
|
||||
@@ -1,7 +0,0 @@
|
||||
Write many new scripts for
|
||||
- printer manager
|
||||
- kernel modules
|
||||
- disk manager
|
||||
- customize Fvwm options
|
||||
- choose color (similar to FileBrowser)
|
||||
- ...
|
||||
@@ -1,204 +0,0 @@
|
||||
#include "Tools.h"
|
||||
|
||||
/***********************************************/
|
||||
/* Fonction pour CheckBox */
|
||||
/***********************************************/
|
||||
void InitCheckBox(struct XObj *xobj)
|
||||
{
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
/* Enregistrement des couleurs et de la police */
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->forecolor,&xobj->TabColor[fore]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->backcolor,&xobj->TabColor[back]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->licolor,&xobj->TabColor[li]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->shadcolor,&xobj->TabColor[shad]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#000000",&xobj->TabColor[black]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#FFFFFF",&xobj->TabColor[white]);
|
||||
|
||||
mask=0;
|
||||
Attr.background_pixel=xobj->TabColor[back].pixel;
|
||||
mask|=CWBackPixel;
|
||||
Attr.cursor=XCreateFontCursor(xobj->display,XC_hand2);
|
||||
mask|=CWCursor; /* Curseur pour la fenetre */
|
||||
|
||||
xobj->win=XCreateWindow(xobj->display,*xobj->ParentWin,
|
||||
xobj->x,xobj->y,xobj->width,xobj->height,0,
|
||||
CopyFromParent,InputOutput,CopyFromParent,
|
||||
mask,&Attr);
|
||||
xobj->gc=XCreateGC(xobj->display,xobj->win,0,NULL);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
XSetBackground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
if ((xobj->xfont=XLoadQueryFont(xobj->display,xobj->font))==NULL)
|
||||
fprintf(stderr,"Can't load font %s\n",xobj->font);
|
||||
else
|
||||
XSetFont(xobj->display,xobj->gc,xobj->xfont->fid);
|
||||
|
||||
XSetLineAttributes(xobj->display,xobj->gc,1,LineSolid,CapRound,JoinMiter);
|
||||
|
||||
/* Redimensionnement du widget */
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
xobj->height=asc+desc+5;
|
||||
xobj->width=XTextWidth(xobj->xfont,xobj->title,strlen(xobj->title))+30;
|
||||
XResizeWindow(xobj->display,xobj->win,xobj->width,xobj->height);
|
||||
}
|
||||
|
||||
void DestroyCheckBox(struct XObj *xobj)
|
||||
{
|
||||
XFreeFont(xobj->display,xobj->xfont);
|
||||
XFreeGC(xobj->display,xobj->gc);
|
||||
XDestroyWindow(xobj->display,xobj->win);
|
||||
}
|
||||
|
||||
void DrawCheckBox(struct XObj *xobj)
|
||||
{
|
||||
XSegment segm[2];
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
/* Dessin du rectangle arrondi */
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
DrawReliefRect(0,asc-11,15,15,xobj,xobj->TabColor[li].pixel,
|
||||
xobj->TabColor[shad].pixel,xobj->TabColor[black].pixel,0);
|
||||
|
||||
/* Calcul de la position de la chaine de charactere */
|
||||
DrawString(xobj->display,xobj->gc,xobj->win,23,
|
||||
asc,xobj->title,
|
||||
strlen(xobj->title),xobj->TabColor[fore].pixel,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[back].pixel,
|
||||
!xobj->flags[1]);
|
||||
/* Dessin de la croix */
|
||||
if (xobj->value)
|
||||
{
|
||||
XSetLineAttributes(xobj->display,xobj->gc,2,LineSolid,CapProjecting,JoinMiter);
|
||||
segm[0].x1=5;
|
||||
segm[0].y1=5+asc-11;
|
||||
segm[0].x2=9;
|
||||
segm[0].y2=9+asc-11;
|
||||
segm[1].x1=5;
|
||||
segm[1].y1=9+asc-11;
|
||||
segm[1].x2=9;
|
||||
segm[1].y2=5+asc-11;
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[black].pixel);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,segm,2);
|
||||
XSetLineAttributes(xobj->display,xobj->gc,1,LineSolid,CapRound,JoinMiter);
|
||||
}
|
||||
}
|
||||
|
||||
void EvtMouseCheckBox(struct XObj *xobj,XButtonEvent *EvtButton)
|
||||
{
|
||||
static XEvent event;
|
||||
int End=1;
|
||||
unsigned int modif;
|
||||
int x1,x2,y1,y2;
|
||||
Window Win1,Win2;
|
||||
Window WinBut=0;
|
||||
int In;
|
||||
XSegment segm[2];
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
while (End)
|
||||
{
|
||||
XNextEvent(xobj->display, &event);
|
||||
switch (event.type)
|
||||
{
|
||||
case EnterNotify:
|
||||
XQueryPointer(xobj->display,*xobj->ParentWin,
|
||||
&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
if (WinBut==0)
|
||||
{
|
||||
WinBut=Win2;
|
||||
/* Mouse on button */
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
DrawReliefRect(0,asc-11,15,15,xobj,xobj->TabColor[shad].pixel,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[black].pixel,0);
|
||||
In=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Win2==WinBut)
|
||||
{
|
||||
/* Mouse on button */
|
||||
DrawReliefRect(0,asc-11,15,15,xobj,xobj->TabColor[shad].pixel,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[black].pixel,0);
|
||||
In=1;
|
||||
}
|
||||
else if (In)
|
||||
{
|
||||
In=0;
|
||||
/* Mouse not on button */
|
||||
DrawReliefRect(0,asc-11,15,15,xobj,xobj->TabColor[li].pixel,
|
||||
xobj->TabColor[shad].pixel,xobj->TabColor[black].pixel,0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LeaveNotify:
|
||||
XQueryPointer(xobj->display,*xobj->ParentWin,
|
||||
&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
if (Win2==WinBut)
|
||||
{
|
||||
In=1;
|
||||
/* Mouse on button */
|
||||
DrawReliefRect(0,asc-11,15,15,xobj,xobj->TabColor[shad].pixel,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[black].pixel,0);
|
||||
}
|
||||
else if (In)
|
||||
{
|
||||
/* Mouse not on button */
|
||||
DrawReliefRect(0,asc-11,15,15,xobj,xobj->TabColor[li].pixel,
|
||||
xobj->TabColor[shad].pixel,xobj->TabColor[black].pixel,0);
|
||||
In=0;
|
||||
}
|
||||
break;
|
||||
case ButtonRelease:
|
||||
End=0;
|
||||
/* Mouse not on button */
|
||||
if (In)
|
||||
{
|
||||
/* Envoie d'un message vide de type SingleClic pour un clique souris */
|
||||
xobj->value=!xobj->value;
|
||||
DrawReliefRect(0,asc-11,15,15,xobj,xobj->TabColor[li].pixel,
|
||||
xobj->TabColor[shad].pixel,xobj->TabColor[black].pixel,0);
|
||||
SendMsg(xobj,SingleClic);
|
||||
}
|
||||
if (xobj->value)
|
||||
{
|
||||
XSetLineAttributes(xobj->display,xobj->gc,2,LineSolid,CapProjecting,JoinMiter);
|
||||
segm[0].x1=5;
|
||||
segm[0].y1=5+asc-11;
|
||||
segm[0].x2=9;
|
||||
segm[0].y2=9+asc-11;
|
||||
segm[1].x1=5;
|
||||
segm[1].y1=9+asc-11;
|
||||
segm[1].x2=9;
|
||||
segm[1].y2=5+asc-11;
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[black].pixel);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,segm,2);
|
||||
XSetLineAttributes(xobj->display,xobj->gc,1,LineSolid,CapRound,JoinMiter);
|
||||
}
|
||||
else
|
||||
{
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XFillRectangle(xobj->display,xobj->win,xobj->gc,3,asc-8,9,9);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EvtKeyCheckBox(struct XObj *xobj,XKeyEvent *EvtKey)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ProcessMsgCheckBox(struct XObj *xobj,unsigned long type,unsigned long *body)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
#include "Tools.h"
|
||||
|
||||
|
||||
/***********************************************/
|
||||
/* Fonction pour HDipstick */
|
||||
/* Cr<43>ation d'une jauge horizontale */
|
||||
/* plusieurs options */
|
||||
/***********************************************/
|
||||
void InitHDipstick(struct XObj *xobj)
|
||||
{
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
|
||||
/* Enregistrement des couleurs et de la police */
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->forecolor,&xobj->TabColor[fore]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->backcolor,&xobj->TabColor[back]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->licolor,&xobj->TabColor[li]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->shadcolor,&xobj->TabColor[shad]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#000000",&xobj->TabColor[black]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#FFFFFF",&xobj->TabColor[white]);
|
||||
|
||||
/* Minimum size */
|
||||
if (xobj->width<30)
|
||||
xobj->width=30;
|
||||
if (xobj->height<11)
|
||||
xobj->height=11;
|
||||
|
||||
mask=0;
|
||||
Attr.background_pixel=x11base->TabColor[back].pixel;
|
||||
mask|=CWBackPixel;
|
||||
xobj->win=XCreateWindow(xobj->display,*xobj->ParentWin,
|
||||
xobj->x,xobj->y,xobj->width,xobj->height,0,
|
||||
CopyFromParent,InputOutput,CopyFromParent,
|
||||
mask,&Attr);
|
||||
xobj->gc=XCreateGC(xobj->display,xobj->win,0,NULL);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
XSetBackground(xobj->display,xobj->gc,x11base->TabColor[back].pixel);
|
||||
XSetLineAttributes(xobj->display,xobj->gc,1,LineSolid,CapRound,JoinMiter);
|
||||
|
||||
if (xobj->value2>xobj->value3)
|
||||
xobj->value3=xobj->value2+50;
|
||||
if (xobj->value<xobj->value2)
|
||||
xobj->value=xobj->value2;
|
||||
if (xobj->value>xobj->value3)
|
||||
xobj->value=xobj->value3;
|
||||
}
|
||||
|
||||
void DestroyHDipstick(struct XObj *xobj)
|
||||
{
|
||||
XFreeGC(xobj->display,xobj->gc);
|
||||
XDestroyWindow(xobj->display,xobj->win);
|
||||
}
|
||||
|
||||
void DrawHDipstick(struct XObj *xobj)
|
||||
{
|
||||
int i;
|
||||
|
||||
i=(xobj->width-4)*(xobj->value-xobj->value2)/(xobj->value3-xobj->value2);
|
||||
|
||||
DrawReliefRect(0,0,xobj->width,xobj->height,xobj,
|
||||
x11base->TabColor[shad].pixel,x11base->TabColor[li].pixel,
|
||||
x11base->TabColor[black].pixel,-1);
|
||||
if (i!=0)
|
||||
{
|
||||
DrawReliefRect(2,2,i,xobj->height-4,xobj,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[shad].pixel,
|
||||
xobj->TabColor[black].pixel,-1);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XFillRectangle(xobj->display,xobj->win,xobj->gc,5,5,i-6,xobj->height-10);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void EvtMouseHDipstick(struct XObj *xobj,XButtonEvent *EvtButton)
|
||||
{
|
||||
}
|
||||
|
||||
void EvtKeyHDipstick(struct XObj *xobj,XKeyEvent *EvtKey)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ProcessMsgHDipstick(struct XObj *xobj,unsigned long type,unsigned long *body)
|
||||
{
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
#include "Tools.h"
|
||||
|
||||
|
||||
|
||||
/***********************************************/
|
||||
/* Fonction pour HScrollBar */
|
||||
/***********************************************/
|
||||
void DrawThumbH(struct XObj *xobj)
|
||||
{
|
||||
int x,y,w,h;
|
||||
XSegment segm;
|
||||
char str[20];
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
x=3+(xobj->width-36)*(xobj->value-xobj->value2)/(xobj->value3-xobj->value2);
|
||||
y=xobj->height/2-9;
|
||||
w=30;
|
||||
h=18;
|
||||
DrawReliefRect(x,y,w,h,xobj,xobj->TabColor[li].pixel,xobj->TabColor[shad].pixel,
|
||||
xobj->TabColor[black].pixel,-1);
|
||||
segm.x1=x+15;
|
||||
segm.y1=y+3;
|
||||
segm.x2=x+15;
|
||||
segm.y2=y+h-3;
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,&segm,1);
|
||||
segm.x1=x+16;
|
||||
segm.y1=y+3;
|
||||
segm.x2=x+16;
|
||||
segm.y2=y+h-3;
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,&segm,1);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
|
||||
sprintf(str,"%d",xobj->value);
|
||||
x=x+15-(XTextWidth(xobj->xfont,str,strlen(str))/2);
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
y=y-desc-4;
|
||||
DrawString(xobj->display,xobj->gc,xobj->win,x,y,str,
|
||||
strlen(str),xobj->TabColor[fore].pixel,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[back].pixel,
|
||||
!xobj->flags[1]);
|
||||
|
||||
}
|
||||
|
||||
void HideThumbH(struct XObj *xobj)
|
||||
{
|
||||
int x,y;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
x=4+(xobj->width-36)*(xobj->value-xobj->value2)/(xobj->value3-xobj->value2);
|
||||
y=xobj->height/2-8;
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XFillRectangle(xobj->display,xobj->win,xobj->gc,x,y,28,16);
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
XFillRectangle(xobj->display,xobj->win,xobj->gc,x-asc
|
||||
-desc,y-asc-10,90,asc+desc+2);
|
||||
}
|
||||
|
||||
void InitHScrollBar(struct XObj *xobj)
|
||||
{
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
int i;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
char str[20];
|
||||
|
||||
/* Enregistrement des couleurs et de la police */
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->forecolor,&xobj->TabColor[fore]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->backcolor,&xobj->TabColor[back]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->licolor,&xobj->TabColor[li]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->shadcolor,&xobj->TabColor[shad]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#000000",&xobj->TabColor[black]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#FFFFFF",&xobj->TabColor[white]);
|
||||
|
||||
mask=0;
|
||||
Attr.background_pixel=xobj->TabColor[back].pixel;
|
||||
mask|=CWBackPixel;
|
||||
Attr.cursor=XCreateFontCursor(xobj->display,XC_hand2);
|
||||
mask|=CWCursor; /* Curseur pour la fenetre */
|
||||
|
||||
xobj->win=XCreateWindow(xobj->display,*xobj->ParentWin,
|
||||
xobj->x,xobj->y,xobj->width,xobj->height,0,
|
||||
CopyFromParent,InputOutput,CopyFromParent,
|
||||
mask,&Attr);
|
||||
xobj->gc=XCreateGC(xobj->display,xobj->win,0,NULL);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
XSetBackground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
if ((xobj->xfont=XLoadQueryFont(xobj->display,xobj->font))==NULL)
|
||||
fprintf(stderr,"Can't load font %s\n",xobj->font);
|
||||
else
|
||||
XSetFont(xobj->display,xobj->gc,xobj->xfont->fid);
|
||||
|
||||
XSetLineAttributes(xobj->display,xobj->gc,1,LineSolid,CapRound,JoinMiter);
|
||||
|
||||
if ((xobj->value3-xobj->value2)<=0)
|
||||
xobj->value3=xobj->value2+10;
|
||||
if (!((xobj->value>=xobj->value2)&&(xobj->value<=xobj->value3)))
|
||||
xobj->value=xobj->value2;
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
xobj->height=(asc+desc)*2+30;
|
||||
sprintf(str,"%d",xobj->value2);
|
||||
i=XTextWidth(xobj->xfont,str,strlen(str));
|
||||
sprintf(str,"%d",xobj->value3);
|
||||
i=XTextWidth(xobj->xfont,str,strlen(str))+i+20;
|
||||
if (xobj->width<i)
|
||||
xobj->width=i;
|
||||
XResizeWindow(xobj->display,xobj->win,xobj->width,xobj->height);
|
||||
}
|
||||
|
||||
void DestroyHScrollBar(struct XObj *xobj)
|
||||
{
|
||||
XFreeFont(xobj->display,xobj->xfont);
|
||||
XFreeGC(xobj->display,xobj->gc);
|
||||
XDestroyWindow(xobj->display,xobj->win);
|
||||
}
|
||||
|
||||
void DrawHScrollBar(struct XObj *xobj)
|
||||
{
|
||||
int x,y,w,h;
|
||||
char str[20];
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
/* Calcul de la taille de l'ascenseur */
|
||||
x=0;
|
||||
y=xobj->height/2-12;
|
||||
w=xobj->width;
|
||||
h=24;
|
||||
DrawReliefRect(x,y,w,h,xobj,xobj->TabColor[shad].pixel,xobj->TabColor[li].pixel,
|
||||
xobj->TabColor[black].pixel,1);
|
||||
DrawThumbH(xobj);
|
||||
|
||||
/* Ecriture des valeurs */
|
||||
sprintf(str,"%d",xobj->value2);
|
||||
x=4;
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
y=y+asc+h;
|
||||
DrawString(xobj->display,xobj->gc,xobj->win,x,y,str,
|
||||
strlen(str),xobj->TabColor[fore].pixel,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[back].pixel,
|
||||
!xobj->flags[1]);
|
||||
sprintf(str,"%d",xobj->value3);
|
||||
x=w-XTextWidth(xobj->xfont,str,strlen(str))-4;
|
||||
DrawString(xobj->display,xobj->gc,xobj->win,x,y,str,
|
||||
strlen(str),xobj->TabColor[fore].pixel,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[back].pixel,
|
||||
!xobj->flags[1]);
|
||||
}
|
||||
|
||||
void EvtMouseHScrollBar(struct XObj *xobj,XButtonEvent *EvtButton)
|
||||
{
|
||||
static XEvent event;
|
||||
int x,y,w,h;
|
||||
int oldx=0;
|
||||
int oldvalue=-1;
|
||||
int newvalue;
|
||||
int x1,y1,x2,y2;
|
||||
Window Win1,Win2;
|
||||
unsigned int modif;
|
||||
|
||||
x=3+((xobj->width-36)*xobj->value)/(xobj->value3-xobj->value2);
|
||||
y=xobj->height/2-9;
|
||||
w=30;
|
||||
h=18;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
/* On suit les mouvements de la souris */
|
||||
XQueryPointer(xobj->display,*xobj->ParentWin,&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
x2=x2-xobj->x;
|
||||
if (x2<15) x2=15;
|
||||
if (x2>xobj->width-21) x2=xobj->width-21;
|
||||
if (oldx!=x2)
|
||||
{
|
||||
oldx=x2;
|
||||
/* calcule de xobj->value */
|
||||
newvalue=(x2-15)*xobj->width/(xobj->width-36)*(xobj->value3-xobj->value2)/(xobj->width)+xobj->value2;
|
||||
if (newvalue!=oldvalue)
|
||||
{
|
||||
HideThumbH(xobj);
|
||||
xobj->value=newvalue;
|
||||
DrawThumbH(xobj);
|
||||
oldvalue=newvalue;
|
||||
SendMsg(xobj,SingleClic);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (!XCheckTypedEvent(xobj->display,ButtonRelease,&event));
|
||||
}
|
||||
|
||||
void EvtKeyHScrollBar(struct XObj *xobj,XKeyEvent *EvtKey)
|
||||
{
|
||||
}
|
||||
|
||||
void ProcessMsgHScrollBar(struct XObj *xobj,unsigned long type,unsigned long *body)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
#include "Tools.h"
|
||||
|
||||
|
||||
/***********************************************/
|
||||
/* Fonction pour ItemDraw */
|
||||
/***********************************************/
|
||||
void InitItemDraw(struct XObj *xobj)
|
||||
{
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
int minHeight,minWidth;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
/* Enregistrement des couleurs et de la police */
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->forecolor,&xobj->TabColor[fore]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->backcolor,&xobj->TabColor[back]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->licolor,&xobj->TabColor[li]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->shadcolor,&xobj->TabColor[shad]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#000000",&xobj->TabColor[black]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#FFFFFF",&xobj->TabColor[white]);
|
||||
|
||||
mask=0;
|
||||
Attr.background_pixel=xobj->TabColor[back].pixel;
|
||||
mask|=CWBackPixel;
|
||||
|
||||
xobj->win=XCreateWindow(xobj->display,*xobj->ParentWin,
|
||||
xobj->x,xobj->y,xobj->width,xobj->height,0,
|
||||
CopyFromParent,InputOutput,CopyFromParent,
|
||||
mask,&Attr);
|
||||
xobj->gc=XCreateGC(xobj->display,xobj->win,0,NULL);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
XSetBackground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
if ((xobj->xfont=XLoadQueryFont(xobj->display,xobj->font))==NULL)
|
||||
fprintf(stderr,"Can't load font %s\n",xobj->font);
|
||||
else
|
||||
XSetFont(xobj->display,xobj->gc,xobj->xfont->fid);
|
||||
|
||||
XSetLineAttributes(xobj->display,xobj->gc,1,LineSolid,CapRound,JoinMiter);
|
||||
|
||||
/* Redimensionnement du widget */
|
||||
if (xobj->icon==NULL)
|
||||
{
|
||||
if (strlen(xobj->title)!=0)
|
||||
{
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
minHeight=asc+desc+2;
|
||||
minWidth=XTextWidth(xobj->xfont,xobj->title,strlen(xobj->title))+2;
|
||||
if (xobj->height < minHeight)
|
||||
xobj->height = minHeight;
|
||||
if (xobj->width < minWidth)
|
||||
xobj->width = minWidth;
|
||||
}
|
||||
}
|
||||
else if (strlen(xobj->title)==0)
|
||||
{
|
||||
if (xobj->height<xobj->icon_h)
|
||||
xobj->height=xobj->icon_h;
|
||||
if (xobj->width<xobj->icon_w)
|
||||
xobj->width=xobj->icon_w;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xobj->icon_w>XTextWidth(xobj->xfont,xobj->title,strlen(xobj->title))+2)
|
||||
{
|
||||
if (xobj->width<xobj->icon_w)
|
||||
xobj->width=xobj->icon_w;
|
||||
}
|
||||
else
|
||||
xobj->width=XTextWidth(xobj->xfont,xobj->title,strlen(xobj->title))+2;
|
||||
xobj->height=xobj->icon_h+2*(asc+desc+15);
|
||||
}
|
||||
XResizeWindow(xobj->display,xobj->win,xobj->width,xobj->height);
|
||||
}
|
||||
|
||||
void DestroyItemDraw(struct XObj *xobj)
|
||||
{
|
||||
XFreeFont(xobj->display,xobj->xfont);
|
||||
XFreeGC(xobj->display,xobj->gc);
|
||||
XDestroyWindow(xobj->display,xobj->win);
|
||||
}
|
||||
|
||||
void DrawItemDraw(struct XObj *xobj)
|
||||
{
|
||||
|
||||
/* Calcul de la position de la chaine de charactere */
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XFillRectangle(xobj->display,xobj->win,xobj->gc,0,0,xobj->width,xobj->height);
|
||||
DrawIconStr(0,xobj,False);
|
||||
}
|
||||
|
||||
void EvtMouseItemDraw(struct XObj *xobj,XButtonEvent *EvtButton)
|
||||
{
|
||||
}
|
||||
|
||||
void EvtKeyItemDraw(struct XObj *xobj,XKeyEvent *EvtKey)
|
||||
{
|
||||
}
|
||||
|
||||
void ProcessMsgItemDraw(struct XObj *xobj,unsigned long type,unsigned long *body)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,446 +0,0 @@
|
||||
#include "Tools.h"
|
||||
|
||||
#define BdWidth 2 /* Border width */
|
||||
#define SbWidth 15 /* ScrollBar width */
|
||||
|
||||
/***********************************************/
|
||||
/* Fonction pour Liste */
|
||||
/***********************************************/
|
||||
void InitList(struct XObj *xobj)
|
||||
{
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
int minw,minh,resize=0;
|
||||
int NbVisCell,NbCell;
|
||||
|
||||
/* Enregistrement des couleurs et de la police */
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->forecolor,&xobj->TabColor[fore]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->backcolor,&xobj->TabColor[back]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->licolor,&xobj->TabColor[li]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->shadcolor,&xobj->TabColor[shad]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#000000",&xobj->TabColor[black]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#FFFFFF",&xobj->TabColor[white]);
|
||||
|
||||
|
||||
mask=0;
|
||||
Attr.background_pixel=xobj->TabColor[back].pixel;
|
||||
mask|=CWBackPixel;
|
||||
Attr.cursor=XCreateFontCursor(xobj->display,XC_hand2);
|
||||
mask|=CWCursor; /* Curseur pour la fenetre */
|
||||
xobj->win=XCreateWindow(xobj->display,*xobj->ParentWin,
|
||||
xobj->x,xobj->y,xobj->width,xobj->height,0,
|
||||
CopyFromParent,InputOutput,CopyFromParent,
|
||||
mask,&Attr);
|
||||
|
||||
xobj->gc=XCreateGC(xobj->display,xobj->win,0,NULL);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
XSetBackground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XSetLineAttributes(xobj->display,xobj->gc,1,LineSolid,CapRound,JoinMiter);
|
||||
if ((xobj->xfont=XLoadQueryFont(xobj->display,xobj->font))==NULL)
|
||||
fprintf(stderr,"Can't load font %s\n",xobj->font);
|
||||
else
|
||||
XSetFont(xobj->display,xobj->gc,xobj->xfont->fid);
|
||||
|
||||
/* Calcul de la taille du widget */
|
||||
/* Taille minimum: une ligne ou ascenseur visible */
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
minh=8+3*BdWidth+3*(asc+desc+3);
|
||||
if (xobj->height<minh)
|
||||
{
|
||||
xobj->height=minh;
|
||||
resize=1;
|
||||
}
|
||||
minw=12+3*BdWidth+SbWidth+75;
|
||||
if (xobj->width<minw)
|
||||
{
|
||||
xobj->width=minw;
|
||||
resize=1;
|
||||
}
|
||||
if (resize)
|
||||
XResizeWindow(xobj->display,xobj->win,xobj->width,xobj->height);
|
||||
|
||||
/* Calcul de la premiere cellule visible */
|
||||
NbVisCell=(xobj->height-2-3*BdWidth)/(asc+desc+3);
|
||||
NbCell=CountOption(xobj->title);
|
||||
if (NbCell>NbVisCell)
|
||||
{
|
||||
if (xobj->value2>(NbCell-NbVisCell+1))
|
||||
xobj->value2=NbCell-NbVisCell+1;
|
||||
if ((xobj->value2<1)||(xobj->value2<0))
|
||||
xobj->value2=1;
|
||||
}
|
||||
else
|
||||
xobj->value2=1;
|
||||
}
|
||||
|
||||
void DrawVSbList(struct XObj *xobj,int NbCell,int NbVisCell,int press)
|
||||
{
|
||||
XRectangle r;
|
||||
int PosTh,SizeTh;
|
||||
|
||||
r.y=2+BdWidth;
|
||||
r.x=xobj->width-(6+BdWidth)-SbWidth;
|
||||
r.height=xobj->height-r.y-2*BdWidth;
|
||||
r.width=SbWidth+4;
|
||||
DrawReliefRect(r.x,r.y,r.width,r.height,xobj,xobj->TabColor[shad].pixel,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[fore].pixel,-1);
|
||||
|
||||
/* Calcul du rectangle pour les fleches*/
|
||||
r.x=r.x+2;
|
||||
r.y=r.y+2;
|
||||
r.width=r.width-4;
|
||||
r.height=r.height-4;
|
||||
|
||||
/* Dessin de la fleche haute */
|
||||
DrawArrowN(xobj,r.x+1,r.y+1,press==1);
|
||||
DrawArrowS(xobj,r.x+1,r.y+r.height-14,press==2);
|
||||
|
||||
/* Calcul du rectangle pour le pouce*/
|
||||
r.y=r.y+13;
|
||||
r.height=r.height-26;
|
||||
|
||||
/* Effacement */
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XFillRectangle(xobj->display,xobj->win,xobj->gc,r.x+1,r.y+1,r.width-2,r.height-2);
|
||||
|
||||
/* Dessin du pouce */
|
||||
if (NbVisCell<NbCell)
|
||||
SizeTh=(NbVisCell*(r.height-8)/NbCell)+8;
|
||||
else
|
||||
SizeTh=r.height;
|
||||
PosTh=(xobj->value2-1)*(r.height-8)/NbCell;
|
||||
DrawReliefRect(r.x,r.y+PosTh,r.width,SizeTh,xobj,xobj->TabColor[li].pixel,
|
||||
xobj->TabColor[shad].pixel,xobj->TabColor[fore].pixel,-1);
|
||||
}
|
||||
|
||||
void DrawCellule(struct XObj *xobj,int NbCell,int NbVisCell,int HeightCell,int asc)
|
||||
{
|
||||
XRectangle r;
|
||||
char *Title;
|
||||
int i;
|
||||
|
||||
r.x=4+BdWidth;
|
||||
r.y=r.x;
|
||||
r.width=xobj->width-r.x-10-2*BdWidth-SbWidth;
|
||||
r.height=xobj->height-r.y-4-2*BdWidth;
|
||||
|
||||
/* Dessin des cellules */
|
||||
XSetClipRectangles(xobj->display,xobj->gc,0,0,&r,1,Unsorted);
|
||||
for (i=xobj->value2;i<xobj->value2+NbVisCell;i++)
|
||||
{
|
||||
Title=GetMenuTitle(xobj->title,i);
|
||||
if (strlen(Title)!=0)
|
||||
if (xobj->value==i)
|
||||
{
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
XFillRectangle(xobj->display,xobj->win,xobj->gc,r.x+2,r.y+(i-xobj->value2)*HeightCell+2,
|
||||
xobj->width-2,HeightCell-2);
|
||||
DrawString(xobj->display,xobj->gc,xobj->win,5+r.x,(i-xobj->value2)*HeightCell+asc+2+r.y,Title,
|
||||
strlen(Title),xobj->TabColor[fore].pixel,xobj->TabColor[back].pixel,
|
||||
xobj->TabColor[shad].pixel,!xobj->flags[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XFillRectangle(xobj->display,xobj->win,xobj->gc,r.x+2,r.y+(i-xobj->value2)*HeightCell+2,
|
||||
xobj->width-2,HeightCell-2);
|
||||
DrawString(xobj->display,xobj->gc,xobj->win,5+r.x,(i-xobj->value2)*HeightCell+asc+2+r.y,Title,
|
||||
strlen(Title),xobj->TabColor[fore].pixel,xobj->TabColor[li].pixel,
|
||||
xobj->TabColor[back].pixel,!xobj->flags[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XFillRectangle(xobj->display,xobj->win,xobj->gc,r.x+2,r.y+(i-xobj->value2)*HeightCell+2,
|
||||
xobj->width-2,HeightCell-2);
|
||||
}
|
||||
}
|
||||
XSetClipMask(xobj->display,xobj->gc,None);
|
||||
}
|
||||
|
||||
void DestroyList(struct XObj *xobj)
|
||||
{
|
||||
XFreeGC(xobj->display,xobj->gc);
|
||||
XDestroyWindow(xobj->display,xobj->win);
|
||||
}
|
||||
|
||||
void DrawList(struct XObj *xobj)
|
||||
{
|
||||
int asc,desc,dir,HeightCell;
|
||||
XCharStruct struc;
|
||||
int NbVisCell,NbCell;
|
||||
XRectangle r;
|
||||
|
||||
/* Dessin du contour */
|
||||
DrawReliefRect(0,0,xobj->width,xobj->height,xobj,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[shad].pixel,xobj->TabColor[fore].pixel,-1);
|
||||
|
||||
/* Dessin du contour de la liste */
|
||||
r.x=2+BdWidth;
|
||||
r.y=r.x;
|
||||
r.width=xobj->width-r.x-4-2*BdWidth-SbWidth;
|
||||
r.height=xobj->height-r.y-2*BdWidth;
|
||||
DrawReliefRect(r.x,r.y,r.width,r.height,xobj,xobj->TabColor[shad].pixel,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[fore].pixel,-1);
|
||||
|
||||
/* Calcul du nombre de cellules visibles */
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
HeightCell=asc+desc+3;
|
||||
NbVisCell=r.height/HeightCell;
|
||||
NbCell=CountOption(xobj->title);
|
||||
if (NbCell>NbVisCell)
|
||||
{
|
||||
if (xobj->value2>(NbCell-NbVisCell+1))
|
||||
xobj->value2=NbCell-NbVisCell+1;
|
||||
if ((xobj->value2<1)||(xobj->value2<0))
|
||||
xobj->value2=1;
|
||||
}
|
||||
else
|
||||
xobj->value2=1;
|
||||
|
||||
|
||||
/* Dessin des cellules */
|
||||
DrawCellule(xobj,NbCell,NbVisCell,HeightCell,asc);
|
||||
|
||||
/* Dessin de l'ascenseur vertical */
|
||||
DrawVSbList(xobj,NbCell,NbVisCell,0);
|
||||
|
||||
}
|
||||
|
||||
void EvtMouseList(struct XObj *xobj,XButtonEvent *EvtButton)
|
||||
{
|
||||
XRectangle rect,rectT;
|
||||
XPoint pt;
|
||||
XCharStruct struc;
|
||||
int x1,y1,x2,y2;
|
||||
Window Win1,Win2;
|
||||
unsigned int modif;
|
||||
int In=1;
|
||||
static XEvent event;
|
||||
int asc,desc,dir;
|
||||
int NbVisCell,NbCell,HeightCell,NPosCell,PosMouse;
|
||||
fd_set in_fdset;
|
||||
|
||||
pt.x=EvtButton->x-xobj->x;
|
||||
pt.y=EvtButton->y-xobj->y;
|
||||
|
||||
/* Clic dans une cellule */
|
||||
rect.x=4+BdWidth;
|
||||
rect.y=rect.x;
|
||||
rect.width=xobj->width-rect.x-10-2*BdWidth-SbWidth;
|
||||
rect.height=xobj->height-rect.y-4-2*BdWidth;
|
||||
if(PtInRect(pt,rect))
|
||||
{
|
||||
/* Determination de la cellule */
|
||||
pt.y=pt.y-rect.y;
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
NPosCell=xobj->value2+(pt.y/(asc+desc+3));
|
||||
if (NPosCell>CountOption(xobj->title))
|
||||
NPosCell=0;
|
||||
if (NPosCell!=xobj->value)
|
||||
{
|
||||
xobj->value=NPosCell;
|
||||
DrawList(xobj);
|
||||
}
|
||||
/* if (IsItDoubleClic(xobj))
|
||||
SendMsg(xobj,DoubleClic);
|
||||
else*/
|
||||
SendMsg(xobj,SingleClic);
|
||||
return ;
|
||||
}
|
||||
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
HeightCell=asc+desc+3;
|
||||
NbVisCell=(xobj->height-6-BdWidth)/HeightCell;
|
||||
NbCell=CountOption(xobj->title);
|
||||
|
||||
/* Clic fleche haute asc vertical */
|
||||
rect.y=5+BdWidth;
|
||||
rect.x=xobj->width-(6+BdWidth)-SbWidth+3;
|
||||
rect.height=12;
|
||||
rect.width=12;
|
||||
if(PtInRect(pt,rect))
|
||||
{
|
||||
DrawVSbList(xobj,NbCell,NbVisCell,1);
|
||||
do
|
||||
{
|
||||
XQueryPointer(xobj->display,*xobj->ParentWin,&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
pt.y=y2-xobj->y;
|
||||
pt.x=x2-xobj->x;
|
||||
if (PtInRect(pt,rect))
|
||||
{
|
||||
if (In)
|
||||
{
|
||||
Wait(8);
|
||||
xobj->value2--;
|
||||
if (xobj->value2<1)
|
||||
xobj->value2=1;
|
||||
else
|
||||
{
|
||||
DrawCellule(xobj,NbCell,NbVisCell,HeightCell,asc);
|
||||
DrawVSbList(xobj,NbCell,NbVisCell,1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
In=1;
|
||||
DrawVSbList(xobj,NbCell,NbVisCell,1);
|
||||
xobj->value2--;
|
||||
if (xobj->value2<1)
|
||||
xobj->value2=1;
|
||||
else
|
||||
DrawCellule(xobj,NbCell,NbVisCell,HeightCell,asc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (In)
|
||||
{
|
||||
In=0;
|
||||
DrawVSbList(xobj,NbCell,NbVisCell,0);
|
||||
}
|
||||
}
|
||||
FD_ZERO(&in_fdset);
|
||||
FD_SET(x_fd,&in_fdset);
|
||||
select(32, SELECT_TYPE_ARG234 &in_fdset, NULL, NULL, NULL);
|
||||
}
|
||||
while (!XCheckTypedEvent(xobj->display,ButtonRelease,&event));
|
||||
DrawVSbList(xobj,NbCell,NbVisCell,0);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Clic flache basse asc vertical */
|
||||
rect.y=xobj->height-2*BdWidth-16;
|
||||
if(PtInRect(pt,rect))
|
||||
{
|
||||
DrawVSbList(xobj,NbCell,NbVisCell,2);
|
||||
do
|
||||
{
|
||||
XQueryPointer(xobj->display,*xobj->ParentWin,&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
pt.y=y2-xobj->y;
|
||||
pt.x=x2-xobj->x;
|
||||
if (PtInRect(pt,rect))
|
||||
{
|
||||
if (In)
|
||||
{
|
||||
Wait(8);
|
||||
if (xobj->value2<=NbCell-NbVisCell)
|
||||
{
|
||||
xobj->value2++;
|
||||
DrawCellule(xobj,NbCell,NbVisCell,HeightCell,asc);
|
||||
DrawVSbList(xobj,NbCell,NbVisCell,2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
In=1;
|
||||
DrawVSbList(xobj,NbCell,NbVisCell,2);
|
||||
if (xobj->value2<=NbCell-NbVisCell)
|
||||
{
|
||||
xobj->value2++;
|
||||
DrawCellule(xobj,NbCell,NbVisCell,HeightCell,asc);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (In)
|
||||
{
|
||||
In=0;
|
||||
DrawVSbList(xobj,NbCell,NbVisCell,0);
|
||||
}
|
||||
}
|
||||
FD_ZERO(&in_fdset);
|
||||
FD_SET(x_fd,&in_fdset);
|
||||
select(32, SELECT_TYPE_ARG234 &in_fdset, NULL, NULL, NULL);
|
||||
}
|
||||
while (!XCheckTypedEvent(xobj->display,ButtonRelease,&event));
|
||||
DrawVSbList(xobj,NbCell,NbVisCell,0);
|
||||
return;
|
||||
}
|
||||
|
||||
/* clic sur la zone pouce de l'ascenseur de l'ascenseur */
|
||||
rect.y=17+BdWidth;
|
||||
rect.x=xobj->width-(6+BdWidth)-SbWidth+2;
|
||||
rect.height=xobj->height-rect.y-19-2*BdWidth;
|
||||
rect.width=SbWidth;
|
||||
if(PtInRect(pt,rect))
|
||||
{
|
||||
/* Clic dans le pouce */
|
||||
rectT.x=rect.x;
|
||||
rectT.y=rect.y+(xobj->value2-1)*(rect.height-8)/NbCell;
|
||||
if (NbVisCell<NbCell)
|
||||
rectT.height=NbVisCell*(rect.height-8)/NbCell+8;
|
||||
rectT.width=rect.width;
|
||||
if(PtInRect(pt,rectT))
|
||||
{
|
||||
PosMouse=pt.y-rectT.y-HeightCell/2+2;
|
||||
do
|
||||
{
|
||||
XQueryPointer(xobj->display,*xobj->ParentWin,&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
/* Calcul de l'id de la premiere cellule */
|
||||
pt.y=y2-xobj->y-PosMouse;
|
||||
NPosCell=(pt.y-rect.y)*NbCell/(rect.height);
|
||||
|
||||
if (NPosCell<1) NPosCell=1;
|
||||
if (NbCell>NbVisCell)
|
||||
{
|
||||
if (NPosCell>(NbCell-NbVisCell+1))
|
||||
NPosCell=NbCell-NbVisCell+1;
|
||||
}
|
||||
else
|
||||
NPosCell=1;
|
||||
if (xobj->value2!=NPosCell)
|
||||
{
|
||||
xobj->value2=NPosCell;
|
||||
DrawCellule(xobj,NbCell,NbVisCell,HeightCell,asc);
|
||||
DrawVSbList(xobj,NbCell,NbVisCell,0);
|
||||
}
|
||||
FD_ZERO(&in_fdset);
|
||||
FD_SET(x_fd,&in_fdset);
|
||||
select(32, SELECT_TYPE_ARG234 &in_fdset, NULL, NULL, NULL);
|
||||
}
|
||||
while (!XCheckTypedEvent(xobj->display,ButtonRelease,&event));
|
||||
}
|
||||
else if (pt.y<rectT.y)
|
||||
{
|
||||
NPosCell=xobj->value2-NbVisCell;
|
||||
if (NPosCell<1) NPosCell=1;
|
||||
if (xobj->value2!=NPosCell)
|
||||
{
|
||||
xobj->value2=NPosCell;
|
||||
DrawCellule(xobj,NbCell,NbVisCell,HeightCell,asc);
|
||||
DrawVSbList(xobj,NbCell,NbVisCell,0);
|
||||
}
|
||||
}
|
||||
else if (pt.y>rectT.y+rectT.height)
|
||||
{
|
||||
NPosCell=xobj->value2+NbVisCell;
|
||||
if (NbCell>NbVisCell)
|
||||
{
|
||||
if (NPosCell>(NbCell-NbVisCell+1))
|
||||
NPosCell=NbCell-NbVisCell+1;
|
||||
}
|
||||
else NPosCell=1;
|
||||
if (xobj->value2!=NPosCell)
|
||||
{
|
||||
xobj->value2=NPosCell;
|
||||
DrawCellule(xobj,NbCell,NbVisCell,HeightCell,asc);
|
||||
DrawVSbList(xobj,NbCell,NbVisCell,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EvtKeyList(struct XObj *xobj,XKeyEvent *EvtKey)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ProcessMsgList(struct XObj *xobj,unsigned long type,unsigned long *body)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,227 +0,0 @@
|
||||
#include "Tools.h"
|
||||
|
||||
|
||||
/***********************************************/
|
||||
/* Fonction pour Menu */
|
||||
/***********************************************/
|
||||
void InitMenu(struct XObj *xobj)
|
||||
{
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
int i;
|
||||
char *Option;
|
||||
|
||||
/* Enregistrement des couleurs et de la police */
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->forecolor,&xobj->TabColor[fore]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->backcolor,&xobj->TabColor[back]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->licolor,&xobj->TabColor[li]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->shadcolor,&xobj->TabColor[shad]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#000000",&xobj->TabColor[black]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#FFFFFF",&xobj->TabColor[white]);
|
||||
|
||||
mask=0;
|
||||
Attr.background_pixel=xobj->TabColor[back].pixel;
|
||||
mask|=CWBackPixel;
|
||||
Attr.cursor=XCreateFontCursor(xobj->display,XC_hand2);
|
||||
mask|=CWCursor;
|
||||
xobj->win=XCreateWindow(xobj->display,*xobj->ParentWin,
|
||||
xobj->x,xobj->y,xobj->width,xobj->height,0,
|
||||
CopyFromParent,InputOutput,CopyFromParent,
|
||||
mask,&Attr);
|
||||
xobj->gc=XCreateGC(xobj->display,xobj->win,0,NULL);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
XSetBackground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
|
||||
XSetLineAttributes(xobj->display,xobj->gc,1,LineSolid,CapRound,JoinMiter);
|
||||
if ((xobj->xfont=XLoadQueryFont(xobj->display,xobj->font))==NULL)
|
||||
fprintf(stderr,"Can't load font %s\n",xobj->font);
|
||||
else
|
||||
XSetFont(xobj->display,xobj->gc,xobj->xfont->fid);
|
||||
|
||||
/* Size */
|
||||
Option=GetMenuTitle(xobj->title,0);
|
||||
xobj->width=XTextWidth(xobj->xfont,Option,strlen(Option))+6;
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
xobj->height=asc+desc+4;
|
||||
free(Option);
|
||||
|
||||
/* Position */
|
||||
xobj->y=3;
|
||||
xobj->x=2;
|
||||
i=0;
|
||||
while (xobj!=tabxobj[i])
|
||||
{
|
||||
if (tabxobj[i]->TypeWidget==Menu)
|
||||
{
|
||||
Option=GetMenuTitle(tabxobj[i]->title,0);
|
||||
xobj->x=xobj->x+XTextWidth(tabxobj[i]->xfont,Option,strlen(Option))+10;
|
||||
free(Option);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
XResizeWindow(xobj->display,xobj->win,xobj->width,xobj->height);
|
||||
XMoveWindow(xobj->display,xobj->win,xobj->x,xobj->y);
|
||||
}
|
||||
|
||||
void DestroyMenu(struct XObj *xobj)
|
||||
{
|
||||
XFreeFont(xobj->display,xobj->xfont);
|
||||
XFreeGC(xobj->display,xobj->gc);
|
||||
XDestroyWindow(xobj->display,xobj->win);
|
||||
}
|
||||
|
||||
void DrawMenu(struct XObj *xobj)
|
||||
{
|
||||
XSegment segm[2];
|
||||
int i;
|
||||
|
||||
/* Si c'est le premier menu, on dessine la bar de menu */
|
||||
if (xobj->x==2)
|
||||
{
|
||||
for (i=0;i<2;i++)
|
||||
{
|
||||
segm[0].x1=i;
|
||||
segm[0].y1=i;
|
||||
segm[0].x2=x11base->size.width-i-1;
|
||||
segm[0].y2=i;
|
||||
|
||||
segm[1].x1=i;
|
||||
segm[1].y1=i;
|
||||
segm[1].x2=i;
|
||||
segm[1].y2=xobj->height-i+5;
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
XDrawSegments(xobj->display,x11base->win,xobj->gc,segm,2);
|
||||
|
||||
segm[0].x1=1+i;
|
||||
segm[0].y1=xobj->height-i+5;
|
||||
segm[0].x2=x11base->size.width-i-1;
|
||||
segm[0].y2=xobj->height-i+5;
|
||||
|
||||
segm[1].x1=x11base->size.width-i-1;
|
||||
segm[1].y1=i;
|
||||
segm[1].x2=x11base->size.width-i-1;
|
||||
segm[1].y2=xobj->height-i+5;
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
XDrawSegments(xobj->display,x11base->win,xobj->gc,segm,2);
|
||||
}
|
||||
|
||||
}
|
||||
DrawIconStr(0,xobj,True);
|
||||
}
|
||||
|
||||
void EvtMouseMenu(struct XObj *xobj,XButtonEvent *EvtButton)
|
||||
{
|
||||
static XEvent event;
|
||||
unsigned int modif;
|
||||
int x1,x2,y1,y2,i,oldy;
|
||||
Window Win1,Win2,WinPop;
|
||||
char *str;
|
||||
int x,y,hOpt,yMenu,hMenu,wMenu;
|
||||
int oldvalue = 0,newvalue;
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
fd_set in_fdset;
|
||||
|
||||
DrawReliefRect(0,0,xobj->width,xobj->height,xobj,
|
||||
xobj->TabColor[shad].pixel,xobj->TabColor[li].pixel,xobj->TabColor[black].pixel,-1);
|
||||
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
hOpt=asc+desc+10;
|
||||
xobj->value3=CountOption(xobj->title);
|
||||
hMenu=(xobj->value3-1)*hOpt; /* Hauteur totale du menu */
|
||||
yMenu=xobj->y+xobj->height+1;
|
||||
wMenu=0;
|
||||
for (i=2;i<=xobj->value3;i++)
|
||||
{
|
||||
str=(char*)GetMenuTitle(xobj->title,i);
|
||||
if (wMenu<XTextWidth(xobj->xfont,str,strlen(str))+20)
|
||||
wMenu=XTextWidth(xobj->xfont,str,strlen(str))+20;
|
||||
free(str);
|
||||
}
|
||||
|
||||
/* Creation de la fenetre menu */
|
||||
XTranslateCoordinates(xobj->display,*xobj->ParentWin,
|
||||
XRootWindow(xobj->display,XDefaultScreen(xobj->display)),xobj->x,yMenu,&x,&y,&Win1);
|
||||
if (x<0) x=0;
|
||||
if (y<0) y=0;
|
||||
if (x+wMenu>XDisplayWidth(xobj->display,XDefaultScreen(xobj->display)))
|
||||
x=XDisplayWidth(xobj->display,XDefaultScreen(xobj->display))-wMenu;
|
||||
if (y+hMenu>XDisplayHeight(xobj->display,XDefaultScreen(xobj->display)))
|
||||
{
|
||||
y=y-hMenu-xobj->height;
|
||||
}
|
||||
|
||||
mask=0;
|
||||
Attr.background_pixel=xobj->TabColor[back].pixel;
|
||||
mask|=CWBackPixel;
|
||||
Attr.cursor=XCreateFontCursor(xobj->display,XC_hand2);
|
||||
mask|=CWCursor; /* Curseur pour la fenetre */
|
||||
Attr.override_redirect=True;
|
||||
mask|=CWOverrideRedirect;
|
||||
WinPop=XCreateWindow(xobj->display,XRootWindow(xobj->display,XDefaultScreen(xobj->display)),
|
||||
x,y,wMenu-5,hMenu,0,CopyFromParent,InputOutput,CopyFromParent,mask,&Attr);
|
||||
XMapRaised(xobj->display,WinPop);
|
||||
|
||||
/* Dessin du menu */
|
||||
DrawPMenu(xobj,WinPop,hOpt,2);
|
||||
do
|
||||
{
|
||||
XQueryPointer(xobj->display,XRootWindow(xobj->display,XDefaultScreen(xobj->display)),
|
||||
&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
/* Determiner l'option courante */
|
||||
y2=y2-y;
|
||||
x2=x2-x;
|
||||
{
|
||||
oldy=y2;
|
||||
/* calcule de xobj->value */
|
||||
if ((x2>0)&&(x2<wMenu)&&(y2>0)&&(y2<hMenu))
|
||||
newvalue=y2/hOpt+1;
|
||||
else
|
||||
newvalue=0;
|
||||
if (newvalue!=oldvalue)
|
||||
{
|
||||
SelectMenu(xobj,WinPop,hOpt,oldvalue,0);
|
||||
SelectMenu(xobj,WinPop,hOpt,newvalue,1);
|
||||
oldvalue=newvalue;
|
||||
}
|
||||
}
|
||||
FD_ZERO(&in_fdset);
|
||||
FD_SET(x_fd,&in_fdset);
|
||||
select(32, SELECT_TYPE_ARG234 &in_fdset, NULL, NULL, NULL);
|
||||
}
|
||||
while (!XCheckTypedEvent(xobj->display,ButtonRelease,&event));
|
||||
XDestroyWindow(xobj->display,WinPop);
|
||||
if (newvalue!=0)
|
||||
{
|
||||
xobj->value=newvalue;
|
||||
SendMsg(xobj,SingleClic);
|
||||
xobj->value=0;
|
||||
}
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XFillRectangle(xobj->display,xobj->win,xobj->gc,0,0,xobj->width,xobj->height);
|
||||
DrawIconStr(0,xobj,True);
|
||||
for (i=0;i<nbobj;i++)
|
||||
tabxobj[i]->DrawObj(tabxobj[i]);
|
||||
|
||||
}
|
||||
|
||||
void EvtKeyMenu(struct XObj *xobj,XKeyEvent *EvtKey)
|
||||
{
|
||||
}
|
||||
|
||||
void ProcessMsgMenu(struct XObj *xobj,unsigned long type,unsigned long *body)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
#include "Tools.h"
|
||||
|
||||
|
||||
/***********************************************/
|
||||
/* Fonction pour MiniScroll */
|
||||
/***********************************************/
|
||||
void InitMiniScroll(struct XObj *xobj)
|
||||
{
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
int i;
|
||||
|
||||
/* Enregistrement des couleurs et de la police */
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->forecolor,&xobj->TabColor[fore]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->backcolor,&xobj->TabColor[back]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->licolor,&xobj->TabColor[li]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->shadcolor,&xobj->TabColor[shad]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#000000",&xobj->TabColor[black]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#FFFFFF",&xobj->TabColor[white]);
|
||||
|
||||
|
||||
mask=0;
|
||||
Attr.background_pixel=xobj->TabColor[back].pixel;
|
||||
mask|=CWBackPixel;
|
||||
|
||||
/* La taille du widget est fixe */
|
||||
xobj->width=19;
|
||||
xobj->height=34;
|
||||
xobj->win=XCreateWindow(xobj->display,*xobj->ParentWin,
|
||||
xobj->x,xobj->y,xobj->width,xobj->height,1,
|
||||
CopyFromParent,InputOutput,CopyFromParent,
|
||||
mask,&Attr);
|
||||
xobj->gc=XCreateGC(xobj->display,xobj->win,0,NULL);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
XSetBackground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
if ((xobj->xfont=XLoadQueryFont(xobj->display,xobj->font))==NULL)
|
||||
fprintf(stderr,"Can't load font %s\n",xobj->font);
|
||||
else
|
||||
XSetFont(xobj->display,xobj->gc,xobj->xfont->fid);
|
||||
XSetLineAttributes(xobj->display,xobj->gc,1,LineSolid,CapRound,JoinMiter);
|
||||
if (xobj->value2>xobj->value3)
|
||||
{
|
||||
i=xobj->value2;
|
||||
xobj->value2=xobj->value3;
|
||||
xobj->value3=i;
|
||||
}
|
||||
if ((xobj->value<xobj->value2)||(xobj->value>xobj->value3))
|
||||
xobj->value=xobj->value2;
|
||||
}
|
||||
|
||||
void DestroyMiniScroll(struct XObj *xobj)
|
||||
{
|
||||
XFreeFont(xobj->display,xobj->xfont);
|
||||
XFreeGC(xobj->display,xobj->gc);
|
||||
XDestroyWindow(xobj->display,xobj->win);
|
||||
}
|
||||
|
||||
void DrawMiniScroll(struct XObj *xobj)
|
||||
{
|
||||
|
||||
DrawReliefRect(-1,-1,xobj->width+2,xobj->height+2,xobj,xobj->TabColor[li].pixel,
|
||||
xobj->TabColor[shad].pixel,xobj->TabColor[black].pixel,-1);
|
||||
|
||||
/* Dessin de la fleche du haut */
|
||||
DrawArrowN(xobj,3,3,0);
|
||||
DrawArrowS(xobj,3,18,0);
|
||||
|
||||
}
|
||||
|
||||
void EvtMouseMiniScroll(struct XObj *xobj,XButtonEvent *EvtButton)
|
||||
{
|
||||
static XEvent event;
|
||||
int x1,y1,x2,y2;
|
||||
Window Win1,Win2;
|
||||
unsigned int modif;
|
||||
int Pos=0;
|
||||
struct timeval *tv;
|
||||
long tus,ts;
|
||||
|
||||
do
|
||||
{
|
||||
XQueryPointer(xobj->display,*xobj->ParentWin,&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
/* Determiner l'option courante */
|
||||
y2=y2-xobj->y;
|
||||
x2=x2-xobj->x;
|
||||
if ((x2>0)&&(x2<xobj->width)&&(y2>0)&&(y2<xobj->height/2))
|
||||
{
|
||||
if (Pos==1)
|
||||
{
|
||||
tv=(struct timeval*)calloc(1,sizeof(struct timeval));
|
||||
gettimeofday(tv,NULL);
|
||||
tus=tv->tv_usec;
|
||||
ts=tv->tv_sec;
|
||||
while (((tv->tv_usec-tus)+(tv->tv_sec-ts)*1000000)<16667*8)
|
||||
gettimeofday(tv,NULL);
|
||||
free(tv);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawArrowN(xobj,3,3,1);
|
||||
Pos=1;
|
||||
}
|
||||
xobj->value++;
|
||||
if (xobj->value>xobj->value3)
|
||||
xobj->value=xobj->value2;
|
||||
SendMsg(xobj,SingleClic);
|
||||
|
||||
}
|
||||
else if ((x2>0)&&(x2<xobj->width)&&(y2>xobj->height/2)&&(y2<xobj->height))
|
||||
{
|
||||
if (Pos==-1)
|
||||
{
|
||||
tv=(struct timeval*)calloc(1,sizeof(struct timeval));
|
||||
gettimeofday(tv,NULL);
|
||||
tus=tv->tv_usec;
|
||||
ts=tv->tv_sec;
|
||||
while (((tv->tv_usec-tus)+(tv->tv_sec-ts)*1000000)<16667*8)
|
||||
gettimeofday(tv,NULL);
|
||||
free(tv);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawArrowS(xobj,3,18,1);
|
||||
Pos=-1;
|
||||
}
|
||||
xobj->value--;
|
||||
if (xobj->value<xobj->value2)
|
||||
xobj->value=xobj->value3;
|
||||
SendMsg(xobj,SingleClic);
|
||||
}
|
||||
else if (Pos!=0)
|
||||
{
|
||||
Pos=0;
|
||||
DrawArrowN(xobj,3,3,0);
|
||||
DrawArrowS(xobj,3,18,0);
|
||||
}
|
||||
}
|
||||
while (!XCheckTypedEvent(xobj->display,ButtonRelease,&event));
|
||||
DrawArrowN(xobj,3,3,0);
|
||||
DrawArrowS(xobj,3,18,0);
|
||||
}
|
||||
|
||||
void EvtKeyMiniScroll(struct XObj *xobj,XKeyEvent *EvtKey)
|
||||
{
|
||||
}
|
||||
|
||||
void ProcessMsgMiniScroll(struct XObj *xobj,unsigned long type,unsigned long *body)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,223 +0,0 @@
|
||||
#include "Tools.h"
|
||||
|
||||
/***********************************************/
|
||||
/***********************************************/
|
||||
/* Fonction pour PopupMenu */
|
||||
/***********************************************/
|
||||
/***********************************************/
|
||||
|
||||
|
||||
|
||||
void InitPopupMenu(struct XObj *xobj)
|
||||
{
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
int i;
|
||||
char *str;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
/* Enregistrement des couleurs et de la police */
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->forecolor,&xobj->TabColor[fore]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->backcolor,&xobj->TabColor[back]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->licolor,&xobj->TabColor[li]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->shadcolor,&xobj->TabColor[shad]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#000000",&xobj->TabColor[black]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#FFFFFF",&xobj->TabColor[white]);
|
||||
|
||||
|
||||
mask=0;
|
||||
Attr.background_pixel=xobj->TabColor[back].pixel;
|
||||
mask|=CWBackPixel;
|
||||
Attr.cursor=XCreateFontCursor(xobj->display,XC_hand2);
|
||||
mask|=CWCursor; /* Curseur pour la fenetre */
|
||||
|
||||
xobj->win=XCreateWindow(xobj->display,*xobj->ParentWin,
|
||||
xobj->x,xobj->y,xobj->width,xobj->height,0,
|
||||
CopyFromParent,InputOutput,CopyFromParent,
|
||||
mask,&Attr);
|
||||
xobj->gc=XCreateGC(xobj->display,xobj->win,0,NULL);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
XSetBackground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
if ((xobj->xfont=XLoadQueryFont(xobj->display,xobj->font))==NULL)
|
||||
fprintf(stderr,"Can't load font %s\n",xobj->font);
|
||||
else
|
||||
XSetFont(xobj->display,xobj->gc,xobj->xfont->fid);
|
||||
|
||||
XSetLineAttributes(xobj->display,xobj->gc,1,LineSolid,CapRound,JoinMiter);
|
||||
xobj->value3=CountOption(xobj->title);
|
||||
if (xobj->value>xobj->value3)
|
||||
xobj->value=xobj->value3;
|
||||
if (xobj->value<1)
|
||||
xobj->value=1;
|
||||
|
||||
/* Redimensionnement du widget */
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
xobj->height=asc+desc+12;
|
||||
xobj->width=30;
|
||||
for (i=1;i<=xobj->value3;i++)
|
||||
{
|
||||
str=(char*)GetMenuTitle(xobj->title,i);
|
||||
if (xobj->width<XTextWidth(xobj->xfont,str,strlen(str))+34)
|
||||
xobj->width=XTextWidth(xobj->xfont,str,strlen(str))+34;
|
||||
free(str);
|
||||
}
|
||||
XResizeWindow(xobj->display,xobj->win,xobj->width,xobj->height);
|
||||
}
|
||||
|
||||
void DestroyPopupMenu(struct XObj *xobj)
|
||||
{
|
||||
XFreeFont(xobj->display,xobj->xfont);
|
||||
XFreeGC(xobj->display,xobj->gc);
|
||||
XDestroyWindow(xobj->display,xobj->win);
|
||||
}
|
||||
|
||||
void DrawPopupMenu(struct XObj *xobj)
|
||||
{
|
||||
XSegment segm[4];
|
||||
char* str;
|
||||
int x,y;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
DrawReliefRect(0,0,xobj->width,xobj->height,xobj,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[shad].pixel,xobj->TabColor[black].pixel,0);
|
||||
|
||||
/* Dessin de la fleche */
|
||||
segm[0].x1=7;
|
||||
segm[0].y1=asc;
|
||||
segm[0].x2=19;
|
||||
segm[0].y2=asc;
|
||||
segm[1].x1=8;
|
||||
segm[1].y1=asc;
|
||||
segm[1].x2=13;
|
||||
segm[1].y2=5+asc;
|
||||
segm[2].x1=6;
|
||||
segm[2].y1=asc-1;
|
||||
segm[2].x2=19;
|
||||
segm[2].y2=0+asc-1;
|
||||
segm[3].x1=7;
|
||||
segm[3].y1=asc;
|
||||
segm[3].x2=12;
|
||||
segm[3].y2=5+asc;
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,segm,4);
|
||||
segm[0].x1=17;
|
||||
segm[0].y1=asc+1;
|
||||
segm[0].x2=13;
|
||||
segm[0].y2=5+asc;
|
||||
segm[1].x1=19;
|
||||
segm[1].y1=asc;
|
||||
segm[1].x2=14;
|
||||
segm[1].y2=5+asc;
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,segm,2);
|
||||
|
||||
/* Dessin du titre du popup menu */
|
||||
str=(char*)GetMenuTitle(xobj->title,xobj->value);
|
||||
x=25;
|
||||
y=asc+5;
|
||||
DrawString(xobj->display,xobj->gc,xobj->win,x,y,str,
|
||||
strlen(str),xobj->TabColor[fore].pixel,xobj->TabColor[li].pixel,
|
||||
xobj->TabColor[back].pixel,
|
||||
!xobj->flags[1]);
|
||||
|
||||
free(str);
|
||||
}
|
||||
|
||||
void EvtMousePopupMenu(struct XObj *xobj,XButtonEvent *EvtButton)
|
||||
{
|
||||
static XEvent event;
|
||||
int x,y,hOpt,yMenu,hMenu;
|
||||
int x1,y1,x2,y2,oldy;
|
||||
int oldvalue = 0,newvalue;
|
||||
Window Win1,Win2,WinPop;
|
||||
unsigned int modif;
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
hOpt=asc+desc+10;
|
||||
yMenu=xobj->y-((xobj->value-1)*hOpt);
|
||||
hMenu=xobj->value3*hOpt;
|
||||
|
||||
/* Creation de la fenetre menu */
|
||||
XTranslateCoordinates(xobj->display,*xobj->ParentWin,
|
||||
XRootWindow(xobj->display,XDefaultScreen(xobj->display)),xobj->x,yMenu,&x,&y,&Win1);
|
||||
if (x<0) x=0;
|
||||
if (y<0) y=0;
|
||||
if (x+xobj->width>XDisplayWidth(xobj->display,XDefaultScreen(xobj->display)))
|
||||
x=XDisplayWidth(xobj->display,XDefaultScreen(xobj->display))-xobj->width;
|
||||
if (y+hMenu>XDisplayHeight(xobj->display,XDefaultScreen(xobj->display)))
|
||||
y=XDisplayHeight(xobj->display,XDefaultScreen(xobj->display))-hMenu;
|
||||
mask=0;
|
||||
Attr.background_pixel=xobj->TabColor[back].pixel;
|
||||
mask|=CWBackPixel;
|
||||
Attr.cursor=XCreateFontCursor(xobj->display,XC_hand2);
|
||||
mask|=CWCursor; /* Curseur pour la fenetre */
|
||||
Attr.override_redirect=True;
|
||||
mask|=CWOverrideRedirect;
|
||||
WinPop=XCreateWindow(xobj->display,XRootWindow(xobj->display,XDefaultScreen(xobj->display)),
|
||||
x,y,xobj->width-2,hMenu,1,
|
||||
CopyFromParent,InputOutput,CopyFromParent,mask,&Attr);
|
||||
XMapRaised(xobj->display,WinPop);
|
||||
|
||||
/* Dessin du menu */
|
||||
DrawPMenu(xobj,WinPop,hOpt,1);
|
||||
do
|
||||
{
|
||||
XQueryPointer(xobj->display,XRootWindow(xobj->display,XDefaultScreen(xobj->display)),
|
||||
&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
/* Determiner l'option courante */
|
||||
y2=y2-y;
|
||||
x2=x2-x;
|
||||
{
|
||||
oldy=y2;
|
||||
/* calcule de xobj->value */
|
||||
if ((x2>0)&&(x2<xobj->width)&&(y2>0)&&(y2<hMenu))
|
||||
newvalue=y2/hOpt+1;
|
||||
else
|
||||
newvalue=0;
|
||||
if (newvalue!=oldvalue)
|
||||
{
|
||||
SelectMenu(xobj,WinPop,hOpt,oldvalue,0);
|
||||
SelectMenu(xobj,WinPop,hOpt,newvalue,1);
|
||||
oldvalue=newvalue;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (!XCheckTypedEvent(xobj->display,ButtonRelease,&event));
|
||||
XDestroyWindow(xobj->display,WinPop);
|
||||
if (newvalue!=0)
|
||||
{
|
||||
xobj->value=newvalue;
|
||||
SendMsg(xobj,SingleClic);
|
||||
}
|
||||
xobj->DrawObj(xobj);
|
||||
}
|
||||
|
||||
|
||||
void EvtKeyPopupMenu(struct XObj *xobj,XKeyEvent *EvtKey)
|
||||
{
|
||||
}
|
||||
|
||||
void ProcessMsgPopupMenu(struct XObj *xobj,unsigned long type,unsigned long *body)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,304 +0,0 @@
|
||||
#include "Tools.h"
|
||||
|
||||
/***********************************************/
|
||||
/***********************************************/
|
||||
/* Fonction pour PushButton */
|
||||
/***********************************************/
|
||||
/***********************************************/
|
||||
void InitPushButton(struct XObj *xobj)
|
||||
{
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
int i;
|
||||
char *str;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
/* Enregistrement des couleurs et de la police */
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->forecolor,&xobj->TabColor[fore]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->backcolor,&xobj->TabColor[back]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->licolor,&xobj->TabColor[li]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->shadcolor,&xobj->TabColor[shad]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#000000",&xobj->TabColor[black]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#FFFFFF",&xobj->TabColor[white]);
|
||||
|
||||
|
||||
mask=0;
|
||||
Attr.cursor=XCreateFontCursor(xobj->display,XC_hand2);
|
||||
mask|=CWCursor;
|
||||
Attr.background_pixel=xobj->TabColor[back].pixel;
|
||||
mask|=CWBackPixel;
|
||||
|
||||
|
||||
/* Epaisseur de la fenetre = 0 */
|
||||
xobj->win=XCreateWindow(xobj->display,*xobj->ParentWin,
|
||||
xobj->x,xobj->y,xobj->width,xobj->height,0,
|
||||
CopyFromParent,InputOutput,CopyFromParent,
|
||||
mask,&Attr);
|
||||
xobj->gc=XCreateGC(xobj->display,xobj->win,0,NULL);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
XSetBackground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
if ((xobj->xfont=XLoadQueryFont(xobj->display,xobj->font))==NULL)
|
||||
{
|
||||
fprintf(stderr,"Can't load font %s\n",xobj->font);
|
||||
}
|
||||
else
|
||||
XSetFont(xobj->display,xobj->gc,xobj->xfont->fid);
|
||||
XSetLineAttributes(xobj->display,xobj->gc,1,LineSolid,CapRound,JoinMiter);
|
||||
|
||||
/* Redimensionnement du widget */
|
||||
str=(char*)GetMenuTitle(xobj->title,1);
|
||||
if (xobj->icon==NULL)
|
||||
{
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
i=asc+desc+12;
|
||||
if (xobj->height<i)
|
||||
xobj->height=i;
|
||||
i=XTextWidth(xobj->xfont,str,strlen(str))+16;
|
||||
if (xobj->width<i)
|
||||
xobj->width=i;
|
||||
}
|
||||
else if (strlen(str)==0)
|
||||
{
|
||||
if (xobj->height<xobj->icon_h+10)
|
||||
xobj->height=xobj->icon_h+10;
|
||||
if (xobj->width<xobj->icon_w+10)
|
||||
xobj->width=xobj->icon_w+10;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xobj->icon_w+10>XTextWidth(xobj->xfont,str,strlen(str))+16)
|
||||
i=xobj->icon_w+10;
|
||||
else
|
||||
i=XTextWidth(xobj->xfont,str,strlen(str))+16;
|
||||
if (xobj->width<i)
|
||||
xobj->width=i;
|
||||
i=xobj->icon_h+2*(asc+desc+10);
|
||||
if (xobj->height<i)
|
||||
xobj->height=i;
|
||||
}
|
||||
XResizeWindow(xobj->display,xobj->win,xobj->width,xobj->height);
|
||||
xobj->value3=CountOption(xobj->title);
|
||||
}
|
||||
|
||||
void DestroyPushButton(struct XObj *xobj)
|
||||
{
|
||||
XFreeFont(xobj->display,xobj->xfont);
|
||||
XFreeGC(xobj->display,xobj->gc);
|
||||
XDestroyWindow(xobj->display,xobj->win);
|
||||
}
|
||||
|
||||
|
||||
void DrawPushButton(struct XObj *xobj)
|
||||
{
|
||||
DrawReliefRect(0,0,xobj->width,xobj->height,xobj,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[shad].pixel,xobj->TabColor[black].pixel,0);
|
||||
DrawIconStr(0,xobj,True);
|
||||
}
|
||||
|
||||
void EvtMousePushButton(struct XObj *xobj,XButtonEvent *EvtButton)
|
||||
{
|
||||
static XEvent event;
|
||||
int End=1;
|
||||
unsigned int modif;
|
||||
int x1,x2,y1,y2,i,j,oldy;
|
||||
Window Win1,Win2,WinPop;
|
||||
Window WinBut=0;
|
||||
int In = 0;
|
||||
char *str;
|
||||
int x,y,hOpt,yMenu,hMenu,wMenu;
|
||||
int oldvalue = 0,newvalue;
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
|
||||
if (EvtButton->button==Button1)
|
||||
{
|
||||
j=xobj->height/2+3;
|
||||
i=(xobj->width-XTextWidth(xobj->xfont,xobj->title,strlen(xobj->title)))/2;
|
||||
|
||||
while (End)
|
||||
{
|
||||
XNextEvent(xobj->display, &event);
|
||||
switch (event.type)
|
||||
{
|
||||
case EnterNotify:
|
||||
XQueryPointer(xobj->display,*xobj->ParentWin,
|
||||
&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
if (WinBut==0)
|
||||
{
|
||||
WinBut=Win2;
|
||||
DrawReliefRect(0,0,xobj->width,xobj->height,xobj,
|
||||
xobj->TabColor[shad].pixel,xobj->TabColor[li].pixel,xobj->TabColor[black].pixel,0);
|
||||
DrawIconStr(1,xobj,True);
|
||||
In=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Win2==WinBut)
|
||||
{
|
||||
DrawReliefRect(0,0,xobj->width,xobj->height,xobj,
|
||||
xobj->TabColor[shad].pixel,xobj->TabColor[li].pixel,xobj->TabColor[black].pixel,0);
|
||||
DrawIconStr(1,xobj,True);
|
||||
In=1;
|
||||
}
|
||||
else if (In)
|
||||
{
|
||||
In=0;
|
||||
DrawReliefRect(0,0,xobj->width,xobj->height,xobj,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[shad].pixel,xobj->TabColor[black].pixel,0);
|
||||
DrawIconStr(0,xobj,True);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LeaveNotify:
|
||||
XQueryPointer(xobj->display,*xobj->ParentWin,
|
||||
&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
if (Win2==WinBut)
|
||||
{
|
||||
In=1;
|
||||
DrawReliefRect(0,0,xobj->width,xobj->height,xobj,
|
||||
xobj->TabColor[shad].pixel,xobj->TabColor[li].pixel,xobj->TabColor[black].pixel,0);
|
||||
DrawIconStr(1,xobj,True);
|
||||
}
|
||||
else if (In)
|
||||
{
|
||||
DrawReliefRect(0,0,xobj->width,xobj->height,xobj,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[shad].pixel,xobj->TabColor[black].pixel,0);
|
||||
DrawIconStr(0,xobj,True);
|
||||
In=0;
|
||||
}
|
||||
break;
|
||||
case ButtonRelease:
|
||||
End=0;
|
||||
DrawReliefRect(0,0,xobj->width,xobj->height,xobj,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[shad].pixel,xobj->TabColor[black].pixel,0);
|
||||
DrawIconStr(0,xobj,True);
|
||||
if (In)
|
||||
{
|
||||
/* Envoie d'un message vide de type SingleClic pour un clique souris */
|
||||
xobj->value=1;
|
||||
SendMsg(xobj,SingleClic);
|
||||
xobj->value=0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (EvtButton->button==Button3) /* affichage du popup menu */
|
||||
if (xobj->value3>1)
|
||||
{
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
hOpt=asc+desc+10;
|
||||
hMenu=(xobj->value3-1)*hOpt; /* Hauteur totale du menu */
|
||||
yMenu=xobj->y+xobj->height;
|
||||
wMenu=0;
|
||||
for (i=2;i<=xobj->value3;i++)
|
||||
{
|
||||
str=(char*)GetMenuTitle(xobj->title,i);
|
||||
if (wMenu<XTextWidth(xobj->xfont,str,strlen(str))+34)
|
||||
wMenu=XTextWidth(xobj->xfont,str,strlen(str))+34;
|
||||
free(str);
|
||||
}
|
||||
|
||||
/* Creation de la fenetre menu */
|
||||
XTranslateCoordinates(xobj->display,*xobj->ParentWin,
|
||||
XRootWindow(xobj->display,XDefaultScreen(xobj->display)),xobj->x,yMenu,&x,&y,&Win1);
|
||||
if (x<0) x=0;
|
||||
if (y<0) y=0;
|
||||
if (x+wMenu>XDisplayWidth(xobj->display,XDefaultScreen(xobj->display)))
|
||||
x=XDisplayWidth(xobj->display,XDefaultScreen(xobj->display))-wMenu;
|
||||
if (y+hMenu>XDisplayHeight(xobj->display,XDefaultScreen(xobj->display)))
|
||||
{
|
||||
/*y=XDisplayHeight(xobj->display,XDefaultScreen(xobj->display))-hMenu;*/
|
||||
y=y-hMenu-xobj->height;
|
||||
}
|
||||
|
||||
mask=0;
|
||||
Attr.background_pixel=xobj->TabColor[back].pixel;
|
||||
mask|=CWBackPixel;
|
||||
Attr.cursor=XCreateFontCursor(xobj->display,XC_hand2);
|
||||
mask|=CWCursor; /* Curseur pour la fenetre */
|
||||
Attr.override_redirect=True;
|
||||
mask|=CWOverrideRedirect;
|
||||
WinPop=XCreateWindow(xobj->display,XRootWindow(xobj->display,XDefaultScreen(xobj->display)),
|
||||
x,y,wMenu-5,hMenu,1,
|
||||
CopyFromParent,InputOutput,CopyFromParent,mask,&Attr);
|
||||
XMapRaised(xobj->display,WinPop);
|
||||
|
||||
/* Dessin du menu */
|
||||
DrawPMenu(xobj,WinPop,hOpt,2);
|
||||
do
|
||||
{
|
||||
XQueryPointer(xobj->display,XRootWindow(xobj->display,XDefaultScreen(xobj->display)),
|
||||
&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
/* Determiner l'option courante */
|
||||
y2=y2-y;
|
||||
x2=x2-x;
|
||||
{
|
||||
oldy=y2;
|
||||
/* calcule de xobj->value */
|
||||
if ((x2>0)&&(x2<wMenu)&&(y2>0)&&(y2<hMenu))
|
||||
newvalue=y2/hOpt+1;
|
||||
else
|
||||
newvalue=0;
|
||||
if (newvalue!=oldvalue)
|
||||
{
|
||||
SelectMenu(xobj,WinPop,hOpt,oldvalue,0);
|
||||
SelectMenu(xobj,WinPop,hOpt,newvalue,1);
|
||||
oldvalue=newvalue;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (!XCheckTypedEvent(xobj->display,ButtonRelease,&event));
|
||||
XDestroyWindow(xobj->display,WinPop);
|
||||
if (newvalue!=0)
|
||||
{
|
||||
xobj->value=newvalue;
|
||||
SendMsg(xobj,SingleClic);
|
||||
xobj->value=0;
|
||||
}
|
||||
xobj->DrawObj(xobj);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void EvtKeyPushButton(struct XObj *xobj,XKeyEvent *EvtKey)
|
||||
{
|
||||
char car[11];
|
||||
char *carks2;
|
||||
char *carks;
|
||||
KeySym ks;
|
||||
int Size;
|
||||
|
||||
Size=XLookupString(EvtKey,car,10,&ks,NULL);
|
||||
car[Size]='\0';
|
||||
carks2=XKeysymToString(ks);
|
||||
if (carks2!=NULL)
|
||||
{
|
||||
carks=(char*)calloc(sizeof(char),30);
|
||||
sprintf(carks,"%s",carks2);
|
||||
if (strcmp(carks,"Return")==0)
|
||||
{
|
||||
xobj->value=1;
|
||||
SendMsg(xobj,SingleClic);
|
||||
xobj->value=0;
|
||||
}
|
||||
free(carks);
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessMsgPushButton(struct XObj *xobj,unsigned long type,unsigned long *body)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,188 +0,0 @@
|
||||
#include "Tools.h"
|
||||
|
||||
|
||||
|
||||
/***********************************************/
|
||||
/* Fonction pour RadioButton */
|
||||
/***********************************************/
|
||||
void InitRadioButton(struct XObj *xobj)
|
||||
{
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
/* Enregistrement des couleurs et de la police */
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->forecolor,&xobj->TabColor[fore]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->backcolor,&xobj->TabColor[back]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->licolor,&xobj->TabColor[li]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->shadcolor,&xobj->TabColor[shad]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#000000",&xobj->TabColor[black]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#FFFFFF",&xobj->TabColor[white]);
|
||||
|
||||
mask=0;
|
||||
Attr.cursor=XCreateFontCursor(xobj->display,XC_hand2);
|
||||
mask|=CWCursor; /* Curseur pour la fenetre */
|
||||
Attr.background_pixel=xobj->TabColor[back].pixel;
|
||||
mask|=CWBackPixel;
|
||||
|
||||
xobj->win=XCreateWindow(x11base->display,*xobj->ParentWin,
|
||||
xobj->x,xobj->y,xobj->width,xobj->height,0,
|
||||
CopyFromParent,InputOutput,CopyFromParent,
|
||||
mask,&Attr);
|
||||
|
||||
xobj->gc=XCreateGC(xobj->display,xobj->win,0,NULL);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
XSetBackground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
|
||||
if ((xobj->xfont=XLoadQueryFont(xobj->display,xobj->font))==NULL)
|
||||
{
|
||||
fprintf(stderr,"Can't load font %s\n",xobj->font);
|
||||
}
|
||||
else
|
||||
XSetFont(xobj->display,xobj->gc,xobj->xfont->fid);
|
||||
|
||||
XSetLineAttributes(xobj->display,xobj->gc,1,LineSolid,CapRound,JoinMiter);
|
||||
|
||||
/* Redimensionnement du widget */
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
xobj->height=asc+desc+5;
|
||||
xobj->width=XTextWidth(xobj->xfont,xobj->title,strlen(xobj->title))+20;
|
||||
XResizeWindow(xobj->display,xobj->win,xobj->width,xobj->height);
|
||||
|
||||
}
|
||||
|
||||
void DestroyRadioButton(struct XObj *xobj)
|
||||
{
|
||||
XFreeFont(xobj->display,xobj->xfont);
|
||||
XFreeGC(xobj->display,xobj->gc);
|
||||
XDestroyWindow(xobj->display,xobj->win);
|
||||
}
|
||||
|
||||
void DrawRadioButton(struct XObj *xobj)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
j=xobj->height/2+3;
|
||||
i=16;
|
||||
/* Dessin du cercle arrondi */
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
XDrawArc(xobj->display,xobj->win,xobj->gc,1,j-11,11,11,45*64,180*64);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
XDrawArc(xobj->display,xobj->win,xobj->gc,1,j-11,11,11,225*64,180*64);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[white].pixel);
|
||||
XFillArc(xobj->display,xobj->win,xobj->gc,2,j-10,9,9,0*64,360*64);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[black].pixel);
|
||||
XDrawArc(xobj->display,xobj->win,xobj->gc,2,j-10,9,9,0*64,360*64);
|
||||
if (xobj->value)
|
||||
{
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[black].pixel);
|
||||
XFillArc(xobj->display,xobj->win,xobj->gc,3,j-9,7,7,0*64,360*64);
|
||||
}
|
||||
|
||||
/* Calcul de la position de la chaine de charactere */
|
||||
DrawString(xobj->display,xobj->gc,xobj->win,i,j,xobj->title,
|
||||
strlen(xobj->title),xobj->TabColor[fore].pixel,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[back].pixel,
|
||||
!xobj->flags[1]);
|
||||
}
|
||||
|
||||
void EvtMouseRadioButton(struct XObj *xobj,XButtonEvent *EvtButton)
|
||||
{
|
||||
static XEvent event;
|
||||
int End=1;
|
||||
unsigned int modif;
|
||||
int x1,x2,y1,y2,i,j;
|
||||
Window Win1,Win2;
|
||||
Window WinBut=0;
|
||||
int In = 0;
|
||||
|
||||
j=xobj->height/2+3;
|
||||
i=(xobj->width-XTextWidth(xobj->xfont,xobj->title,strlen(xobj->title)))/2;
|
||||
|
||||
while (End)
|
||||
{
|
||||
XNextEvent(xobj->display, &event);
|
||||
switch (event.type)
|
||||
{
|
||||
case EnterNotify:
|
||||
XQueryPointer(xobj->display,*xobj->ParentWin,
|
||||
&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
if (WinBut==0)
|
||||
{
|
||||
WinBut=Win2;
|
||||
/* Mouse on button */
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XFillArc(xobj->display,xobj->win,xobj->gc,3,j-9,7,7,0*64,360*64);
|
||||
In=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Win2==WinBut)
|
||||
{
|
||||
/* Mouse on button */
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XFillArc(xobj->display,xobj->win,xobj->gc,3,j-9,7,7,0*64,360*64);
|
||||
In=1;
|
||||
}
|
||||
else if (In)
|
||||
{
|
||||
In=0;
|
||||
/* Mouse not on button */
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[white].pixel);
|
||||
XFillArc(xobj->display,xobj->win,xobj->gc,3,j-9,7,7,0*64,360*64);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LeaveNotify:
|
||||
XQueryPointer(xobj->display,*xobj->ParentWin,
|
||||
&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
if (Win2==WinBut)
|
||||
{
|
||||
In=1;
|
||||
/* Mouse on button */
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XFillArc(xobj->display,xobj->win,xobj->gc,3,j-9,7,7,0*64,360*64);
|
||||
}
|
||||
else if (In)
|
||||
{
|
||||
/* Mouse not on button */
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[white].pixel);
|
||||
XFillArc(xobj->display,xobj->win,xobj->gc,3,j-9,7,7,0*64,360*64);
|
||||
In=0;
|
||||
}
|
||||
break;
|
||||
case ButtonRelease:
|
||||
End=0;
|
||||
/* Mouse not on button */
|
||||
if (In)
|
||||
{
|
||||
/* Envoie d'un message vide de type SingleClic pour un clique souris */
|
||||
xobj->value=1;
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[black].pixel);
|
||||
XFillArc(xobj->display,xobj->win,xobj->gc,3,j-9,7,7,0*64,360*64);
|
||||
SendMsg(xobj,SingleClic);
|
||||
}
|
||||
else if (xobj->value)
|
||||
{
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[black].pixel);
|
||||
XFillArc(xobj->display,xobj->win,xobj->gc,3,j-9,7,7,0*64,360*64);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EvtKeyRadioButton(struct XObj *xobj,XKeyEvent *EvtKey)
|
||||
{
|
||||
}
|
||||
|
||||
void ProcessMsgRadioButton(struct XObj *xobj,unsigned long type,unsigned long *body)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
#include "Tools.h"
|
||||
|
||||
|
||||
/***********************************************/
|
||||
/* Fonction pour Rectangle */
|
||||
/***********************************************/
|
||||
void InitRectangle(struct XObj *xobj)
|
||||
{
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
|
||||
/* Enregistrement des couleurs et de la police */
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->forecolor,&xobj->TabColor[fore]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->backcolor,&xobj->TabColor[back]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->licolor,&xobj->TabColor[li]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->shadcolor,&xobj->TabColor[shad]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#000000",&xobj->TabColor[black]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#FFFFFF",&xobj->TabColor[white]);
|
||||
|
||||
xobj->gc=XCreateGC(xobj->display,*xobj->ParentWin,0,NULL);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
XSetBackground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XSetLineAttributes(xobj->display,xobj->gc,1,LineSolid,CapRound,JoinMiter);
|
||||
|
||||
mask=0;
|
||||
xobj->win=XCreateWindow(xobj->display,*xobj->ParentWin,
|
||||
-1000,-1000,xobj->width,xobj->height,0,
|
||||
CopyFromParent,InputOutput,CopyFromParent,
|
||||
mask,&Attr);
|
||||
}
|
||||
|
||||
void DestroyRectangle(struct XObj *xobj)
|
||||
{
|
||||
XFreeGC(xobj->display,xobj->gc);
|
||||
XDestroyWindow(xobj->display,xobj->win);
|
||||
}
|
||||
|
||||
void DrawRectangle(struct XObj *xobj)
|
||||
{
|
||||
XSegment segm[4];
|
||||
|
||||
segm[0].x1=xobj->x;
|
||||
segm[0].y1=xobj->y;
|
||||
segm[0].x2=xobj->width+xobj->x-1;
|
||||
segm[0].y2=xobj->y;
|
||||
|
||||
segm[1].x1=xobj->x;
|
||||
segm[1].y1=xobj->y;
|
||||
segm[1].x2=xobj->x;
|
||||
segm[1].y2=xobj->height+xobj->y-1;
|
||||
|
||||
segm[2].x1=2+xobj->x;
|
||||
segm[2].y1=xobj->height-2+xobj->y;
|
||||
segm[2].x2=xobj->width-2+xobj->x;
|
||||
segm[2].y2=xobj->height-2+xobj->y;
|
||||
|
||||
segm[3].x1=xobj->width-2+xobj->x;
|
||||
segm[3].y1=2+xobj->y;
|
||||
segm[3].x2=xobj->width-2+xobj->x;
|
||||
segm[3].y2=xobj->height-2+xobj->y;
|
||||
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
XDrawSegments(xobj->display,*xobj->ParentWin,xobj->gc,segm,4);
|
||||
|
||||
|
||||
segm[0].x1=1+xobj->x;
|
||||
segm[0].y1=1+xobj->y;
|
||||
segm[0].x2=xobj->width-1+xobj->x;
|
||||
segm[0].y2=1+xobj->y;
|
||||
|
||||
segm[1].x1=1+xobj->x;
|
||||
segm[1].y1=1+xobj->y;
|
||||
segm[1].x2=1+xobj->x;
|
||||
segm[1].y2=xobj->height-1+xobj->y;
|
||||
|
||||
segm[2].x1=1+xobj->x;
|
||||
segm[2].y1=xobj->height-1+xobj->y;
|
||||
segm[2].x2=xobj->width-1+xobj->x;
|
||||
segm[2].y2=xobj->height-1+xobj->y;
|
||||
|
||||
segm[3].x1=xobj->width-1+xobj->x;
|
||||
segm[3].y1=1+xobj->y;
|
||||
segm[3].x2=xobj->width-1+xobj->x;
|
||||
segm[3].y2=xobj->height-1+xobj->y;
|
||||
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
XDrawSegments(xobj->display,*xobj->ParentWin,xobj->gc,segm,4);
|
||||
|
||||
}
|
||||
|
||||
void EvtMouseRectangle(struct XObj *xobj,XButtonEvent *EvtButton)
|
||||
{
|
||||
}
|
||||
|
||||
void EvtKeyRectangle(struct XObj *xobj,XKeyEvent *EvtKey)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ProcessMsgRectangle(struct XObj *xobj,unsigned long type,unsigned long *body)
|
||||
{
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
#include "Tools.h"
|
||||
|
||||
extern int fd[2];
|
||||
|
||||
/***********************************************/
|
||||
/* Fonction pour Swallow */
|
||||
/***********************************************/
|
||||
|
||||
void DrawRelief(struct XObj *xobj)
|
||||
{
|
||||
XSegment segm[2];
|
||||
int i;
|
||||
|
||||
if (xobj->value!=0)
|
||||
{
|
||||
for (i=1;i<4;i++)
|
||||
{
|
||||
segm[0].x1=xobj->x-i;
|
||||
segm[0].y1=xobj->y-i;
|
||||
segm[0].x2=xobj->x+xobj->width+i-2;
|
||||
segm[0].y2=xobj->y-i;
|
||||
segm[1].x1=xobj->x-i;
|
||||
segm[1].y1=xobj->y-i;
|
||||
segm[1].x2=xobj->x-i;
|
||||
segm[1].y2=xobj->y+xobj->height+i-2;
|
||||
if (xobj->value==-1)
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
else
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
XDrawSegments(xobj->display,*xobj->ParentWin,xobj->gc,segm,2);
|
||||
|
||||
segm[0].x1=xobj->x-i;
|
||||
segm[0].y1=xobj->y+xobj->height+i-1;
|
||||
segm[0].x2=xobj->x+xobj->width+i-1;
|
||||
segm[0].y2=xobj->y+xobj->height+i-1;
|
||||
segm[1].x1=xobj->x+xobj->width+i-1;
|
||||
segm[1].y1=xobj->y-i;
|
||||
segm[1].x2=xobj->x+xobj->width+i-1;
|
||||
segm[1].y2=xobj->y+xobj->height+i-1;
|
||||
if (xobj->value==-1)
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
else
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
XDrawSegments(xobj->display,*xobj->ParentWin,xobj->gc,segm,2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void InitSwallow(struct XObj *xobj)
|
||||
{
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
|
||||
/* Enregistrement des couleurs et de la police */
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->forecolor,&xobj->TabColor[fore]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->backcolor,&xobj->TabColor[back]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->licolor,&xobj->TabColor[li]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->shadcolor,&xobj->TabColor[shad]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#000000",&xobj->TabColor[black]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#FFFFFF",&xobj->TabColor[white]);
|
||||
|
||||
mask=0;
|
||||
xobj->win=XCreateWindow(xobj->display,*xobj->ParentWin,
|
||||
-1000,-1000,xobj->width,xobj->height,0,
|
||||
CopyFromParent,InputOutput,CopyFromParent,
|
||||
mask,&Attr);
|
||||
|
||||
/* Redimensionnement du widget */
|
||||
if (xobj->height<30)
|
||||
xobj->height=30;
|
||||
if (xobj->width<30)
|
||||
xobj->width=30;
|
||||
|
||||
if (xobj->swallow!=NULL)
|
||||
{
|
||||
SendText(fd,xobj->swallow,0);
|
||||
}
|
||||
else
|
||||
fprintf(stderr,"Error\n");
|
||||
|
||||
}
|
||||
|
||||
void DestroySwallow(struct XObj *xobj)
|
||||
{
|
||||
XSetCloseDownMode(xobj->display,DestroyAll);
|
||||
/* Arrete le programme swallow */
|
||||
if (xobj->win!=None)
|
||||
XKillClient(xobj->display, xobj->win);
|
||||
}
|
||||
|
||||
void DrawSwallow(struct XObj *xobj)
|
||||
{
|
||||
DrawRelief(xobj);
|
||||
}
|
||||
|
||||
void EvtMouseSwallow(struct XObj *xobj,XButtonEvent *EvtButton)
|
||||
{
|
||||
}
|
||||
|
||||
void EvtKeySwallow(struct XObj *xobj,XKeyEvent *EvtKey)
|
||||
{
|
||||
}
|
||||
|
||||
/* Recupere le pointeur de la fenetre Swallow */
|
||||
void CheckForHangon(struct XObj *xobj,unsigned long *body)
|
||||
{
|
||||
char *cbody;
|
||||
|
||||
cbody=(char*)calloc(100,sizeof(char));
|
||||
sprintf(cbody,"%s",(char *)&body[3]);
|
||||
if(strcmp(cbody,xobj->title)==0)
|
||||
{
|
||||
xobj->win = (Window)body[0];
|
||||
free(xobj->title);
|
||||
xobj->title=(char*)calloc(sizeof(char),20);
|
||||
sprintf(xobj->title,"No window");
|
||||
XUnmapWindow(xobj->display,xobj->win);
|
||||
XSetWindowBorderWidth(xobj->display,xobj->win,0);
|
||||
}
|
||||
free(cbody);
|
||||
}
|
||||
|
||||
void swallow(struct XObj *xobj,unsigned long *body)
|
||||
{
|
||||
|
||||
if(xobj->win == (Window)body[0])
|
||||
{
|
||||
XReparentWindow(xobj->display,xobj->win,*xobj->ParentWin,xobj->x,xobj->y);
|
||||
XResizeWindow(xobj->display,xobj->win,xobj->width,xobj->height);
|
||||
XMapWindow(xobj->display,xobj->win);
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessMsgSwallow(struct XObj *xobj,unsigned long type,unsigned long *body)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case M_MAP:
|
||||
swallow(xobj,body);
|
||||
break;
|
||||
case M_RES_NAME:
|
||||
break;
|
||||
case M_RES_CLASS:
|
||||
break;
|
||||
case M_WINDOW_NAME:
|
||||
CheckForHangon(xobj,body);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,409 +0,0 @@
|
||||
#include "Tools.h"
|
||||
|
||||
|
||||
/***********************************************/
|
||||
/* Fonction for TextField */
|
||||
/***********************************************/
|
||||
void InitTextField(struct XObj *xobj)
|
||||
{
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes Attr;
|
||||
int i;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
/* Enregistrement des couleurs et de la police */
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->forecolor,&xobj->TabColor[fore]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->backcolor,&xobj->TabColor[back]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->licolor,&xobj->TabColor[li]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,xobj->shadcolor,&xobj->TabColor[shad]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#000000",&xobj->TabColor[black]);
|
||||
MyAllocNamedColor(xobj->display,*xobj->colormap,"#FFFFFF",&xobj->TabColor[white]);
|
||||
|
||||
mask=0;
|
||||
Attr.cursor=XCreateFontCursor(xobj->display,XC_xterm);
|
||||
mask|=CWCursor; /* Curseur pour la fenetre */
|
||||
Attr.background_pixel=xobj->TabColor[back].pixel;
|
||||
mask|=CWBackPixel;
|
||||
|
||||
xobj->win=XCreateWindow(xobj->display,*xobj->ParentWin,
|
||||
xobj->x,xobj->y,xobj->width,xobj->height,0,
|
||||
CopyFromParent,InputOutput,CopyFromParent,
|
||||
mask,&Attr);
|
||||
xobj->gc=XCreateGC(xobj->display,xobj->win,0,NULL);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
XSetBackground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
if ((xobj->xfont=XLoadQueryFont(xobj->display,xobj->font))==NULL)
|
||||
fprintf(stderr,"Can't load font %s\n",xobj->font);
|
||||
else
|
||||
XSetFont(xobj->display,xobj->gc,xobj->xfont->fid);
|
||||
|
||||
XSetLineAttributes(xobj->display,xobj->gc,1,LineSolid,CapRound,JoinMiter);
|
||||
/* value2 repr<70>sente la fin de la zone selectionnee */
|
||||
if (xobj->value>strlen(xobj->title))
|
||||
xobj->value=strlen(xobj->title);
|
||||
xobj->value2=xobj->value;
|
||||
|
||||
/* Redimensionnement du widget */
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
xobj->height=asc+desc+10;
|
||||
i=XTextWidth(xobj->xfont,xobj->title,strlen(xobj->title))+40;
|
||||
if (xobj->width<i)
|
||||
xobj->width=i;
|
||||
XResizeWindow(xobj->display,xobj->win,xobj->width,xobj->height);
|
||||
|
||||
}
|
||||
|
||||
void DestroyTextField(struct XObj *xobj)
|
||||
{
|
||||
XFreeFont(xobj->display,xobj->xfont);
|
||||
XFreeGC(xobj->display,xobj->gc);
|
||||
XDestroyWindow(xobj->display,xobj->win);
|
||||
}
|
||||
|
||||
/* Dessin du curseur du texte */
|
||||
void DrawPointTxt(struct XObj *xobj,unsigned int color)
|
||||
{
|
||||
#define dec 2
|
||||
int x,y;
|
||||
XSegment segm[2];
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
x=XTextWidth(xobj->xfont,xobj->title,xobj->value)+5;
|
||||
y=asc+5;
|
||||
|
||||
segm[0].x1=x;
|
||||
segm[0].y1=y;
|
||||
segm[0].x2=x-dec;
|
||||
segm[0].y2=y+dec;
|
||||
segm[1].x1=x;
|
||||
segm[1].y1=y;
|
||||
segm[1].x2=x+dec;
|
||||
segm[1].y2=y+dec;
|
||||
XSetForeground(xobj->display,xobj->gc,color);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,segm,2);
|
||||
}
|
||||
|
||||
/* Dessin du contenu du champs texte */
|
||||
void DrawTextField(struct XObj *xobj)
|
||||
{
|
||||
int x1,y1;
|
||||
int x2,l;
|
||||
int desc,dir,asc;
|
||||
XCharStruct struc;
|
||||
|
||||
l=strlen(xobj->title);
|
||||
if (xobj->value>l)
|
||||
xobj->value=l;
|
||||
if (xobj->value2>l)
|
||||
xobj->value2=l;
|
||||
DrawReliefRect(0,0,xobj->width,xobj->height,xobj,
|
||||
xobj->TabColor[shad].pixel,xobj->TabColor[li].pixel,xobj->TabColor[black].pixel,1);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XFillRectangle(xobj->display,xobj->win,xobj->gc,3,3,xobj->width-6,xobj->height-6);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&y1,&desc,&struc);
|
||||
XDrawImageString(xobj->display,xobj->win,xobj->gc,5,y1+5,xobj->title,strlen(xobj->title));
|
||||
|
||||
/* Dessin de la zone selectionnee */
|
||||
XSetFunction(xobj->display,xobj->gc,GXinvert);
|
||||
if (xobj->value2>xobj->value) /* Curseur avant la souris */
|
||||
{
|
||||
x1=XTextWidth(xobj->xfont,&xobj->title[0],xobj->value);
|
||||
x2=XTextWidth(xobj->xfont,&xobj->title[xobj->value],xobj->value2-xobj->value);
|
||||
}
|
||||
else /* Curseur apres la souris */
|
||||
{
|
||||
x1=XTextWidth(xobj->xfont,&xobj->title[0],xobj->value2);
|
||||
x2=XTextWidth(xobj->xfont,&xobj->title[xobj->value2],xobj->value-xobj->value2);
|
||||
}
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
XFillRectangle(xobj->display,xobj->win,xobj->gc,x1+5,7,x2,y1+desc-2);
|
||||
XSetFunction(xobj->display,xobj->gc,GXcopy);
|
||||
|
||||
/* Dessin du point d'insertion */
|
||||
DrawPointTxt(xobj,xobj->TabColor[fore].pixel);
|
||||
}
|
||||
|
||||
void EvtMouseTextField(struct XObj *xobj,XButtonEvent *EvtButton)
|
||||
{
|
||||
unsigned int modif;
|
||||
int x1,x2,y1,y2,i;
|
||||
Window Win1,Win2;
|
||||
int PosCurs=0;
|
||||
int SizeBuf;
|
||||
char *str;
|
||||
int NewPos;
|
||||
Atom type;
|
||||
XEvent event;
|
||||
int ButPress=1;
|
||||
int format;
|
||||
unsigned long longueur,octets_restant;
|
||||
unsigned char *donnees="";
|
||||
XRectangle rect;
|
||||
|
||||
/* On deplace le curseur a la position de la souris */
|
||||
/* On recupere la position de la souris */
|
||||
switch (EvtButton->button)
|
||||
{
|
||||
case Button1:
|
||||
XQueryPointer(xobj->display,*xobj->ParentWin,&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
x2=x2-xobj->x;
|
||||
PosCurs=0;
|
||||
while ((PosCurs<strlen(xobj->title))&&(x2>XTextWidth(xobj->xfont,xobj->title,PosCurs)+8))
|
||||
PosCurs++;
|
||||
DrawPointTxt(xobj,xobj->TabColor[back].pixel);
|
||||
xobj->value=PosCurs;
|
||||
xobj->value2=PosCurs;
|
||||
DrawPointTxt(xobj,xobj->TabColor[fore].pixel);
|
||||
DrawTextField(xobj);
|
||||
|
||||
while (ButPress)
|
||||
{
|
||||
XNextEvent(xobj->display, &event);
|
||||
switch (event.type)
|
||||
{
|
||||
case MotionNotify:
|
||||
XQueryPointer(xobj->display,*xobj->ParentWin,&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
x2=x2-xobj->x;
|
||||
PosCurs=0;
|
||||
while ((PosCurs<strlen(xobj->title))&&(x2>XTextWidth(xobj->xfont,xobj->title,PosCurs)+8))
|
||||
PosCurs++;
|
||||
/* Limitation de la zone de dessin */
|
||||
if (PosCurs>xobj->value2)
|
||||
{
|
||||
rect.x=XTextWidth(xobj->xfont,xobj->title,xobj->value2);
|
||||
rect.y=0;
|
||||
rect.width=XTextWidth(xobj->xfont,xobj->title,PosCurs+1)-rect.x+1;
|
||||
rect.height=xobj->height;
|
||||
XSetClipRectangles(xobj->display,xobj->gc,0,0,&rect,1,Unsorted);
|
||||
xobj->value2=PosCurs;
|
||||
DrawTextField(xobj);
|
||||
XSetClipMask(xobj->display,xobj->gc,None);
|
||||
}
|
||||
else
|
||||
if (PosCurs<xobj->value2)
|
||||
{
|
||||
rect.x=XTextWidth(xobj->xfont,xobj->title,PosCurs)-1;
|
||||
rect.y=0;
|
||||
rect.width=XTextWidth(xobj->xfont,xobj->title,xobj->value2+1)-rect.x+2;
|
||||
rect.height=xobj->height;
|
||||
XSetClipRectangles(xobj->display,xobj->gc,0,0,&rect,1,Unsorted);
|
||||
xobj->value2=PosCurs;
|
||||
DrawTextField(xobj);
|
||||
XSetClipMask(xobj->display,xobj->gc,None);
|
||||
}
|
||||
|
||||
break;
|
||||
case ButtonRelease:
|
||||
ButPress=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
XSetClipMask(xobj->display,xobj->gc,None);
|
||||
/* Enregistrement de la selection dans le presse papier */
|
||||
/* Le programme devient proprietaire de la selection */
|
||||
if (xobj->value!=xobj->value2)
|
||||
{
|
||||
str=(char*)GetText(xobj,xobj->value2);
|
||||
for (i=0;i<=7;i++)
|
||||
XStoreBuffer(xobj->display,str,strlen(str),i);
|
||||
Scrapt=(char*)realloc((void*)Scrapt,(strlen(str)+2)*sizeof(char));
|
||||
Scrapt=strcpy(Scrapt,str);
|
||||
free(str);
|
||||
x11base->HaveXSelection=True;
|
||||
XSetSelectionOwner(x11base->display,XA_PRIMARY,x11base->win,EvtButton->time);
|
||||
SelectOneTextField(xobj);
|
||||
}
|
||||
break;
|
||||
|
||||
case Button2: /* Colle le texte */
|
||||
/* Si l'application possede pas la selection, elle la demande */
|
||||
/* sinon elle lit son presse papier */
|
||||
if (!x11base->HaveXSelection)
|
||||
{
|
||||
/* Demande de la selection */
|
||||
XConvertSelection(xobj->display,XA_PRIMARY,XA_STRING,propriete,*xobj->ParentWin,
|
||||
EvtButton->time);
|
||||
while (!(XCheckTypedEvent(xobj->display,SelectionNotify,&event)))
|
||||
;
|
||||
if (event.xselection.property!=None)
|
||||
if (event.xselection.selection==XA_PRIMARY)
|
||||
{
|
||||
XGetWindowProperty(xobj->display,event.xselection.requestor,event.xselection.property,0,
|
||||
8192,False,event.xselection.target,&type,&format,&longueur,&octets_restant,
|
||||
&donnees);
|
||||
if (longueur>0)
|
||||
{
|
||||
Scrapt=(char*)realloc((void*)Scrapt,(longueur+1)*sizeof(char));
|
||||
Scrapt=strcpy(Scrapt,donnees);
|
||||
XDeleteProperty(xobj->display,event.xselection.requestor,event.xselection.property);
|
||||
XFree(donnees);
|
||||
}
|
||||
}
|
||||
}
|
||||
SizeBuf=strlen(Scrapt);
|
||||
if (SizeBuf>0)
|
||||
{
|
||||
NewPos=InsertText(xobj,Scrapt,SizeBuf);
|
||||
DrawPointTxt(xobj,xobj->TabColor[back].pixel);
|
||||
xobj->value=NewPos;
|
||||
xobj->value2=NewPos;
|
||||
DrawPointTxt(xobj,xobj->TabColor[fore].pixel);
|
||||
DrawTextField(xobj);
|
||||
SendMsg(xobj,SingleClic);
|
||||
}
|
||||
break;
|
||||
|
||||
case Button3: /* Appuie sur le troisieme bouton */
|
||||
XQueryPointer(xobj->display,*xobj->ParentWin,&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
x2=x2-xobj->x;
|
||||
PosCurs=0;
|
||||
while ((PosCurs<strlen(xobj->title))&&
|
||||
(x2>XTextWidth(xobj->xfont,xobj->title,PosCurs)+8))
|
||||
PosCurs++;
|
||||
if ((PosCurs<xobj->value) && (xobj->value<xobj->value2))
|
||||
xobj->value=xobj->value2;
|
||||
if ((PosCurs>xobj->value) && (xobj->value>xobj->value2))
|
||||
xobj->value=xobj->value2;
|
||||
xobj->value2=PosCurs;
|
||||
DrawTextField(xobj);
|
||||
|
||||
while (ButPress)
|
||||
{
|
||||
XNextEvent(xobj->display, &event);
|
||||
switch (event.type)
|
||||
{
|
||||
case MotionNotify:
|
||||
XQueryPointer(xobj->display,*xobj->ParentWin,&Win1,&Win2,&x1,&y1,&x2,&y2,&modif);
|
||||
x2=x2-xobj->x;
|
||||
while ((PosCurs<strlen(xobj->title))&&(x2>XTextWidth(xobj->xfont,xobj->title,PosCurs)+8))
|
||||
PosCurs++;
|
||||
if (PosCurs>xobj->value2)
|
||||
{
|
||||
rect.x=XTextWidth(xobj->xfont,xobj->title,xobj->value2);
|
||||
rect.y=0;
|
||||
rect.width=XTextWidth(xobj->xfont,xobj->title,PosCurs+1)-rect.x+1;
|
||||
rect.height=xobj->height;
|
||||
XSetClipRectangles(xobj->display,xobj->gc,0,0,&rect,1,Unsorted);
|
||||
xobj->value2=PosCurs;
|
||||
DrawTextField(xobj);
|
||||
XSetClipMask(xobj->display,xobj->gc,None);
|
||||
}
|
||||
else
|
||||
if (PosCurs<xobj->value2)
|
||||
{
|
||||
rect.x=XTextWidth(xobj->xfont,xobj->title,PosCurs)-1;
|
||||
rect.y=0;
|
||||
rect.width=XTextWidth(xobj->xfont,xobj->title,xobj->value2+1)-rect.x+2;
|
||||
rect.height=xobj->height;
|
||||
XSetClipRectangles(xobj->display,xobj->gc,0,0,&rect,1,Unsorted);
|
||||
xobj->value2=PosCurs;
|
||||
DrawTextField(xobj);
|
||||
XSetClipMask(xobj->display,xobj->gc,None);
|
||||
}
|
||||
PosCurs=0;
|
||||
break;
|
||||
case ButtonRelease:
|
||||
ButPress=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (xobj->value!=xobj->value2)
|
||||
{
|
||||
str=(char*)GetText(xobj,xobj->value2);
|
||||
for (i=0;i<=7;i++)
|
||||
XStoreBuffer(xobj->display,str,strlen(str),i);
|
||||
Scrapt=(char*)realloc((void*)Scrapt,(strlen(str)+2)*sizeof(char));
|
||||
Scrapt=strcpy(Scrapt,str);
|
||||
free(str);
|
||||
x11base->HaveXSelection=True;
|
||||
XSetSelectionOwner(x11base->display,XA_PRIMARY,x11base->win,EvtButton->time);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void EvtKeyTextField(struct XObj *xobj,XKeyEvent *EvtKey)
|
||||
{
|
||||
int i,x2;
|
||||
char car[11];
|
||||
char* carks2;
|
||||
char* carks = NULL;
|
||||
KeySym ks;
|
||||
int Size;
|
||||
int NewPos;
|
||||
|
||||
/* Recherche du charactere */
|
||||
i=XLookupString(EvtKey,car,10,&ks,NULL);
|
||||
NewPos=xobj->value;
|
||||
car[i]='\0';
|
||||
carks2=XKeysymToString(ks);
|
||||
|
||||
if (carks2!=NULL)
|
||||
{
|
||||
carks=(char*)calloc(sizeof(char),30);
|
||||
sprintf(carks,"%s",carks2);
|
||||
if (strcmp(carks,"Right")==0)
|
||||
{
|
||||
NewPos++;
|
||||
if (NewPos>strlen(xobj->title))
|
||||
NewPos=strlen(xobj->title);
|
||||
}
|
||||
else if (strcmp(carks,"Left")==0)
|
||||
{
|
||||
NewPos--;
|
||||
if (NewPos<0)
|
||||
NewPos=0;
|
||||
}
|
||||
else if (strcmp(carks,"Return")==0)
|
||||
{
|
||||
;
|
||||
}
|
||||
else if ((strcmp(carks,"Delete")==0)||(strcmp(carks,"BackSpace")==0))
|
||||
{
|
||||
if (NewPos>0)
|
||||
{
|
||||
Size=strlen(xobj->title);
|
||||
memmove(&xobj->title[NewPos-1],&xobj->title[NewPos],
|
||||
Size-NewPos+1);
|
||||
xobj->title=(char*)realloc(xobj->title,(Size)*sizeof(char));
|
||||
NewPos--;
|
||||
SendMsg(xobj,SingleClic);
|
||||
}
|
||||
}
|
||||
else if (i!=0) /* Cas d'un caractere normal */
|
||||
{
|
||||
/* Insertion du caractere dans le titre */
|
||||
Size=strlen(xobj->title);
|
||||
xobj->title=(char*)realloc(xobj->title,(2+Size)*sizeof(char));
|
||||
memmove(&xobj->title[NewPos+1],&xobj->title[NewPos],
|
||||
Size-NewPos+1);
|
||||
xobj->title[NewPos]=car[0];
|
||||
NewPos++;
|
||||
SendMsg(xobj,SingleClic);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((xobj->value!=NewPos)||(xobj->value2!=NewPos))
|
||||
{
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
x2=XTextWidth(xobj->xfont,xobj->title,strlen(xobj->title));
|
||||
XFillRectangle(xobj->display,xobj->win,xobj->gc,x2+4,4,xobj->width-x2-8,xobj->height-8);
|
||||
xobj->value=NewPos;
|
||||
xobj->value2=NewPos;
|
||||
DrawPointTxt(xobj,xobj->TabColor[fore].pixel);
|
||||
DrawTextField(xobj);
|
||||
}
|
||||
free(carks);
|
||||
}
|
||||
|
||||
void ProcessMsgTextField(struct XObj *xobj,unsigned long type,unsigned long *body)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,572 +0,0 @@
|
||||
#include "Tools.h"
|
||||
|
||||
/***********************************************/
|
||||
/* Fonction d'ecriture en relief */
|
||||
/***********************************************/
|
||||
void DrawString(Display *dpy,GC gc,Window win,int x,int y,char *str,
|
||||
int strl,unsigned long ForeC,unsigned long HiC,
|
||||
unsigned long BackC,int WithRelief)
|
||||
{
|
||||
if (WithRelief)
|
||||
{
|
||||
XSetBackground(dpy,gc,BackC);
|
||||
XSetForeground(dpy,gc,HiC);
|
||||
XDrawImageString(dpy,win,gc,x+1,y+1,str,strl);
|
||||
XSetForeground(dpy,gc,ForeC);
|
||||
XDrawString(dpy,win,gc,x,y,str,strl);
|
||||
}
|
||||
else
|
||||
{
|
||||
XSetBackground(dpy,gc,BackC);
|
||||
XSetForeground(dpy,gc,ForeC);
|
||||
XDrawImageString(dpy,win,gc,x,y+1,str,strl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************/
|
||||
/* Retourne le titre de l'option id du menu */
|
||||
/**************************************************/
|
||||
char* GetMenuTitle(char *str,int id)
|
||||
{
|
||||
int i=1;
|
||||
int w=0;
|
||||
int w2=0;
|
||||
char* TempStr;
|
||||
|
||||
while ((str[w+w2]!='\0')&&(str[w+w2]!='|'))
|
||||
w2++;
|
||||
|
||||
while ((i<id)&&(str[w]!='\0'))
|
||||
{
|
||||
i++;
|
||||
if (str[w+w2]=='|') w2++;
|
||||
w=w+w2;
|
||||
w2=0;
|
||||
while ((str[w+w2]!='\0')&&(str[w+w2]!='|'))
|
||||
w2++;
|
||||
}
|
||||
TempStr=(char*)calloc(sizeof(char),w2+1);
|
||||
TempStr=strncpy(TempStr,&str[w],w2);
|
||||
return TempStr;
|
||||
}
|
||||
|
||||
/***********************************************************/
|
||||
/* Dessine le contenu de la fenetre du popup-menu */
|
||||
/***********************************************************/
|
||||
void DrawPMenu(struct XObj *xobj,Window WinPop,int h,int StrtOpt)
|
||||
{
|
||||
XSegment segm[2];
|
||||
int i;
|
||||
char *str;
|
||||
int x,y;
|
||||
int width,height;
|
||||
Window Root;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
XGetGeometry(xobj->display,WinPop,&Root,&x,&y,&width,&height,&i,&i);
|
||||
for (i=0;i<2;i++)
|
||||
{
|
||||
segm[0].x1=i;
|
||||
segm[0].y1=i;
|
||||
segm[0].x2=width-i-1;
|
||||
segm[0].y2=i;
|
||||
|
||||
segm[1].x1=i;
|
||||
segm[1].y1=i;
|
||||
segm[1].x2=i;
|
||||
segm[1].y2=height-i-1;
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
XDrawSegments(xobj->display,WinPop,xobj->gc,segm,2);
|
||||
|
||||
segm[0].x1=1+i;
|
||||
segm[0].y1=height-i-1;
|
||||
segm[0].x2=width-i-1;
|
||||
segm[0].y2=height-i-1;
|
||||
|
||||
segm[1].x1=width-i-1;
|
||||
segm[1].y1=i;
|
||||
segm[1].x2=width-i-1;
|
||||
segm[1].y2=height-i-1;
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
XDrawSegments(xobj->display,WinPop,xobj->gc,segm,2);
|
||||
}
|
||||
/* Ecriture des options */
|
||||
x=0;
|
||||
for (i=StrtOpt;i<=xobj->value3;i++)
|
||||
{
|
||||
str=(char*)GetMenuTitle(xobj->title,i);
|
||||
if (x<XTextWidth(xobj->xfont,str,strlen(str)))
|
||||
x=XTextWidth(xobj->xfont,str,strlen(str));
|
||||
free(str);
|
||||
}
|
||||
for (i=StrtOpt;i<=xobj->value3;i++)
|
||||
{
|
||||
str=(char*)GetMenuTitle(xobj->title,i);
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
y=h*(i-StrtOpt)+asc+4;
|
||||
DrawString(xobj->display,xobj->gc,WinPop,width-x-8,y,str,
|
||||
strlen(str),xobj->TabColor[fore].pixel,
|
||||
xobj->TabColor[li].pixel,xobj->TabColor[back].pixel,
|
||||
!xobj->flags[1]);
|
||||
free(str);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************/
|
||||
/* Dessine l'option active d'un menu */
|
||||
/***********************************************************/
|
||||
void SelectMenu(struct XObj *xobj,Window WinPop,int hOpt,int newvalue,int Show)
|
||||
{
|
||||
XSegment segm[2];
|
||||
int i;
|
||||
int x,y;
|
||||
int width,height;
|
||||
Window Root;
|
||||
|
||||
XGetGeometry(xobj->display,WinPop,&Root,&x,&y,&width,&height,&i,&i);
|
||||
y=hOpt*(newvalue-1);
|
||||
for (i=0;i<2;i++)
|
||||
{
|
||||
segm[0].x1=i+2;
|
||||
segm[0].y1=i+y+2;
|
||||
segm[0].x2=width-i-3;
|
||||
segm[0].y2=i+y+2;
|
||||
|
||||
segm[1].x1=i+2;
|
||||
segm[1].y1=i+y+2;
|
||||
segm[1].x2=i+2;
|
||||
segm[1].y2=y+hOpt-4-i;
|
||||
if (Show)
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
else
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XDrawSegments(xobj->display,WinPop,xobj->gc,segm,2);
|
||||
|
||||
segm[0].x1=i+3;
|
||||
segm[0].y1=y-i-3+hOpt;
|
||||
segm[0].x2=width-i-3;
|
||||
segm[0].y2=y-i-3+hOpt;
|
||||
|
||||
segm[1].x1=width-i-3;
|
||||
segm[1].y1=i+y+2;
|
||||
segm[1].x2=width-i-3;
|
||||
segm[1].y2=i+y-4+hOpt;
|
||||
if (Show)
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
else
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XDrawSegments(xobj->display,WinPop,xobj->gc,segm,2);
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************/
|
||||
/* Compte le nombre d'option contenu dans un menu */
|
||||
/**************************************************/
|
||||
int CountOption(char *str)
|
||||
{
|
||||
int i=1;
|
||||
int w=0;
|
||||
|
||||
while (str[w]!='\0')
|
||||
{
|
||||
if (str[w]=='|') i++;
|
||||
w++;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************/
|
||||
/* Dessine l'icone et le titre du widget */
|
||||
/*****************************************/
|
||||
void DrawIconStr(int offset,struct XObj *xobj,int DoRedraw)
|
||||
{
|
||||
int i,j;
|
||||
char *str;
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
XTextExtents(xobj->xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
if (DoRedraw)
|
||||
{
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XFillRectangle(xobj->display,xobj->win,xobj->gc,4,4,xobj->width-8,xobj->height-8);
|
||||
}
|
||||
|
||||
if (xobj->iconPixmap==None) /* Si l'icone n'existe pas */
|
||||
{
|
||||
str=GetMenuTitle(xobj->title,1);
|
||||
j=xobj->height/2+(asc+desc)/2+offset-3;
|
||||
i=(xobj->width-XTextWidth(xobj->xfont,str,strlen(str)))/2+offset;
|
||||
DrawString(xobj->display,xobj->gc,xobj->win,i,j,str,
|
||||
strlen(str),xobj->TabColor[fore].pixel,xobj->TabColor[li].pixel,
|
||||
xobj->TabColor[back].pixel,!xobj->flags[1]);
|
||||
free(str);
|
||||
}
|
||||
else /* Si l'icone existe */
|
||||
{
|
||||
if (xobj->title!=NULL)
|
||||
{
|
||||
str=GetMenuTitle(xobj->title,1);
|
||||
if (strlen(str)!=0)
|
||||
{
|
||||
i=(xobj->width-XTextWidth(xobj->xfont,str,strlen(str)))/2+offset;
|
||||
j=((xobj->height - xobj->icon_h)/4)*3 + xobj->icon_h+offset+(asc+desc)/2-3;
|
||||
DrawString(xobj->display,xobj->gc,xobj->win,i,j,str,
|
||||
strlen(str),xobj->TabColor[fore].pixel,xobj->TabColor[li].pixel,
|
||||
xobj->TabColor[back].pixel,!xobj->flags[1]);
|
||||
}
|
||||
free(str);
|
||||
}
|
||||
/* Dessin de l'icone */
|
||||
if (xobj->icon_maskPixmap!=None)
|
||||
XSetClipMask(xobj->display,xobj->gc,xobj->icon_maskPixmap);
|
||||
j=(xobj->height - xobj->icon_h)/2+offset;
|
||||
i=(xobj->width - xobj->icon_w)/2+offset;
|
||||
XSetClipOrigin(xobj->display,xobj->gc,i,j);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
XCopyArea(xobj->display,xobj->iconPixmap,xobj->win,xobj->gc,0,0,
|
||||
xobj->icon_w,xobj->icon_h,i,j);
|
||||
XSetClipMask(xobj->display,xobj->gc,None);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************/
|
||||
/* Fonction de dessin d'un rectangle en relief */
|
||||
/***********************************************/
|
||||
void DrawReliefRect(int x,int y,int width,int height,struct XObj *xobj,
|
||||
unsigned int LiC, unsigned int ShadC,unsigned int ForeC,int RectIn)
|
||||
{
|
||||
XSegment segm[2];
|
||||
int i;
|
||||
int j;
|
||||
|
||||
/* XSetForeground(xobj->display,xobj->gc,xobj->TabColor[back].pixel);
|
||||
XFillRectangle(xobj->display,xobj->win,xobj->gc,x,y,width,height);*/
|
||||
width--;
|
||||
height--;
|
||||
|
||||
for (i=1;i<3;i++)
|
||||
{
|
||||
j=-1-i;
|
||||
segm[0].x1=i+x;
|
||||
segm[0].y1=i+y;
|
||||
segm[0].x2=i+x;
|
||||
segm[0].y2=height+j+y+1;
|
||||
segm[1].x1=i+x;
|
||||
segm[1].y1=i+y;
|
||||
segm[1].x2=width+j+x+1;
|
||||
segm[1].y2=i+y;
|
||||
XSetForeground(xobj->display,xobj->gc,LiC);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,segm,2);
|
||||
|
||||
segm[0].x1=width+j+x+1;
|
||||
segm[0].y1=i+1+y;
|
||||
segm[0].x2=width+j+x+1;
|
||||
segm[0].y2=height+j+y+1;
|
||||
segm[1].x1=i+1+x;
|
||||
segm[1].y1=height+j+y+1;
|
||||
segm[1].x2=width+j+x+1;
|
||||
segm[1].y2=height+j+y+1;
|
||||
XSetForeground(xobj->display,xobj->gc,ShadC);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,segm,2);
|
||||
}
|
||||
XSetForeground(xobj->display,xobj->gc,ForeC);
|
||||
if (RectIn==1) /* Rectangle a l'interieur */
|
||||
XDrawRectangle(xobj->display,xobj->win,xobj->gc,x+3,y+3,
|
||||
width-6,height-6);
|
||||
else if (RectIn==0) /* Rectangle a l'exterieur */
|
||||
XDrawRectangle(xobj->display,xobj->win,xobj->gc,x,y,width,height);
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[fore].pixel);
|
||||
}
|
||||
|
||||
/***********************************************/
|
||||
/* Calcul ascent de la police */
|
||||
/***********************************************/
|
||||
int GetAscFont(XFontStruct *xfont)
|
||||
{
|
||||
int asc,desc,dir;
|
||||
XCharStruct struc;
|
||||
|
||||
XTextExtents(xfont,"lp",strlen("lp"),&dir,&asc,&desc,&struc);
|
||||
return asc;
|
||||
}
|
||||
|
||||
/***********************************************/
|
||||
/* Insertion d'un str dans le titre d'un objet */
|
||||
/***********************************************/
|
||||
int InsertText(struct XObj *xobj,char *str,int SizeStr)
|
||||
{
|
||||
int Size;
|
||||
int NewPos;
|
||||
int i;
|
||||
|
||||
/* Insertion du caractere dans le titre */
|
||||
NewPos=xobj->value;
|
||||
Size=strlen(xobj->title);
|
||||
xobj->title=(char*)realloc(xobj->title,(1+SizeStr+Size)*sizeof(char));
|
||||
memmove(&xobj->title[NewPos+SizeStr],&xobj->title[NewPos],
|
||||
Size-NewPos+1);
|
||||
for (i=NewPos;i<NewPos+SizeStr;i++)
|
||||
xobj->title[i]=str[i-NewPos];
|
||||
NewPos=NewPos+SizeStr;
|
||||
return NewPos;
|
||||
}
|
||||
|
||||
/******************************************************/
|
||||
/* Lecture d'un morceau de texte de xobj->value <20> End */
|
||||
/******************************************************/
|
||||
char *GetText(struct XObj *xobj,int End)
|
||||
{
|
||||
char *str;
|
||||
int a,b;
|
||||
|
||||
if (End>xobj->value)
|
||||
{
|
||||
a=xobj->value;
|
||||
b=End;
|
||||
}
|
||||
else
|
||||
{
|
||||
b=xobj->value;
|
||||
a=End;
|
||||
}
|
||||
str=(char*)calloc(b-a+2,1);
|
||||
memcpy(str,&xobj->title[a],b-a);
|
||||
str[b-a+1]='\0';
|
||||
return str;
|
||||
}
|
||||
|
||||
void UnselectAllTextField(struct XObj **txobj)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<nbobj;i++)
|
||||
if (txobj[i]->TypeWidget==TextField)
|
||||
if (txobj[i]->value2!=txobj[i]->value)
|
||||
{
|
||||
txobj[i]->value2=txobj[i]->value;
|
||||
txobj[i]->DrawObj(txobj[i]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void SelectOneTextField(struct XObj *xobj)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<nbobj;i++)
|
||||
if ((tabxobj[i]->TypeWidget==TextField)&&(xobj!=tabxobj[i]))
|
||||
if (tabxobj[i]->value2!=tabxobj[i]->value)
|
||||
{
|
||||
tabxobj[i]->value2=tabxobj[i]->value;
|
||||
tabxobj[i]->DrawObj(tabxobj[i]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
/* Dessine une fleche direction nord */
|
||||
/************************************************************/
|
||||
void DrawArrowN(struct XObj *xobj,int x,int y,int Press)
|
||||
{
|
||||
XSegment segm[4];
|
||||
|
||||
segm[0].x1=5+x;
|
||||
segm[0].y1=1+y;
|
||||
segm[0].x2=0+x;
|
||||
segm[0].y2=12+y;
|
||||
segm[1].x1=5+x;
|
||||
segm[1].y1=3+y;
|
||||
segm[1].x2=1+x;
|
||||
segm[1].y2=12+y;
|
||||
if (Press==1)
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
else
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,segm,2);
|
||||
|
||||
segm[0].x1=2+x;
|
||||
segm[0].y1=11+y;
|
||||
segm[0].x2=11+x;
|
||||
segm[0].y2=11+y;
|
||||
segm[1].x1=1+x;
|
||||
segm[1].y1=12+y;
|
||||
segm[1].x2=12+x;
|
||||
segm[1].y2=12+y;
|
||||
|
||||
segm[2].x1=6+x;
|
||||
segm[2].y1=0+y;
|
||||
segm[2].x2=12+x;
|
||||
segm[2].y2=12+y;
|
||||
segm[3].x1=6+x;
|
||||
segm[3].y1=2+y;
|
||||
segm[3].x2=10+x;
|
||||
segm[3].y2=11+y;
|
||||
if (Press==1)
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
else
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,segm,4);
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
/* Dessine une fleche direction sud */
|
||||
/************************************************************/
|
||||
void DrawArrowS(struct XObj *xobj,int x,int y,int Press)
|
||||
{
|
||||
XSegment segm[4];
|
||||
|
||||
segm[0].x1=0+x;
|
||||
segm[0].y1=0+y;
|
||||
segm[0].x2=12+x;
|
||||
segm[0].y2=0+y;
|
||||
segm[1].x1=1+x;
|
||||
segm[1].y1=1+y;
|
||||
segm[1].x2=11+x;
|
||||
segm[1].y2=1+y;
|
||||
|
||||
segm[2].x1=1+x;
|
||||
segm[2].y1=1+y;
|
||||
segm[2].x2=5+x;
|
||||
segm[2].y2=10+y;
|
||||
segm[3].x1=2+x;
|
||||
segm[3].y1=1+y;
|
||||
segm[3].x2=5+x;
|
||||
segm[3].y2=8+y;
|
||||
if (Press==1)
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
else
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,segm,4);
|
||||
|
||||
segm[0].x1=6+x;
|
||||
segm[0].y1=11+y;
|
||||
segm[0].x2=12+x;
|
||||
segm[0].y2=1+y;
|
||||
segm[1].x1=6+x;
|
||||
segm[1].y1=10+y;
|
||||
segm[1].x2=10+x;
|
||||
segm[1].y2=2+y;
|
||||
if (Press==1)
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
else
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,segm,2);
|
||||
}
|
||||
|
||||
void DrawArrowE(struct XObj *xobj,int x,int y,int Press)
|
||||
{
|
||||
XSegment segm[4];
|
||||
|
||||
segm[0].x1=12+x;
|
||||
segm[0].y1=6+y;
|
||||
segm[0].x2=1+x;
|
||||
segm[0].y2=12+y;
|
||||
segm[1].x1=10+x;
|
||||
segm[1].y1=6+y;
|
||||
segm[1].x2=2+x;
|
||||
segm[1].y2=10+y;
|
||||
if (Press==1)
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
else
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,segm,2);
|
||||
|
||||
segm[0].x1=0+x;
|
||||
segm[0].y1=0+y;
|
||||
segm[0].x2=0+x;
|
||||
segm[0].y2=12+y;
|
||||
segm[1].x1=1+x;
|
||||
segm[1].y1=0+y;
|
||||
segm[1].x2=1+x;
|
||||
segm[1].y2=11+y;
|
||||
|
||||
segm[2].x1=0+x;
|
||||
segm[2].y1=0+y;
|
||||
segm[2].x2=11+x;
|
||||
segm[2].y2=5+y;
|
||||
segm[3].x1=0+x;
|
||||
segm[3].y1=1+y;
|
||||
segm[3].x2=9+x;
|
||||
segm[3].y2=5+y;
|
||||
if (Press==1)
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
else
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,segm,4);
|
||||
}
|
||||
|
||||
void DrawArrowW(struct XObj *xobj,int x,int y,int Press)
|
||||
{
|
||||
XSegment segm[4];
|
||||
|
||||
segm[0].x1=2+x;
|
||||
segm[0].y1=5+y;
|
||||
segm[0].x2=12+x;
|
||||
segm[0].y2=0+y;
|
||||
segm[1].x1=4+x;
|
||||
segm[1].y1=5+y;
|
||||
segm[1].x2=10+x;
|
||||
segm[1].y2=2+y;
|
||||
if (Press==1)
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
else
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,segm,2);
|
||||
|
||||
segm[0].x1=0+x;
|
||||
segm[0].y1=6+y;
|
||||
segm[0].x2=12+x;
|
||||
segm[0].y2=12+y;
|
||||
segm[1].x1=2+x;
|
||||
segm[1].y1=6+y;
|
||||
segm[1].x2=11+x;
|
||||
segm[1].y2=10+y;
|
||||
|
||||
segm[2].x1=12+x;
|
||||
segm[2].y1=1+y;
|
||||
segm[2].x2=12+x;
|
||||
segm[2].y2=12+y;
|
||||
segm[3].x1=11+x;
|
||||
segm[3].y1=2+y;
|
||||
segm[3].x2=11+x;
|
||||
segm[3].y2=11+y;
|
||||
if (Press==1)
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[li].pixel);
|
||||
else
|
||||
XSetForeground(xobj->display,xobj->gc,xobj->TabColor[shad].pixel);
|
||||
XDrawSegments(xobj->display,xobj->win,xobj->gc,segm,4);
|
||||
}
|
||||
|
||||
int PtInRect(XPoint pt,XRectangle rect)
|
||||
{
|
||||
return ((pt.x>=rect.x)&&(pt.y>=rect.y)&&
|
||||
(pt.x<=rect.x+rect.width)&&(pt.y<=rect.y+rect.height));
|
||||
}
|
||||
|
||||
/* Arret pendant t*1/60 de secondes */
|
||||
void Wait(int t)
|
||||
{
|
||||
struct timeval *tv;
|
||||
long tus,ts;
|
||||
|
||||
tv=(struct timeval*)calloc(1,sizeof(struct timeval));
|
||||
gettimeofday(tv,NULL);
|
||||
tus=tv->tv_usec;
|
||||
ts=tv->tv_sec;
|
||||
while (((tv->tv_usec-tus)+(tv->tv_sec-ts)*1000000)<16667*t)
|
||||
gettimeofday(tv,NULL);
|
||||
free(tv);
|
||||
}
|
||||
|
||||
int IsItDoubleClic(struct XObj *xobj)
|
||||
{
|
||||
XEvent Event;
|
||||
XFlush(xobj->display);
|
||||
Wait(12);
|
||||
return (XCheckTypedEvent(xobj->display,ButtonPress,&Event));
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user