Import Upstream version 1.0.0pre12

This commit is contained in:
openKylinBot 2022-05-14 03:32:57 +08:00
commit c0cdb4dbf0
57 changed files with 22538 additions and 0 deletions

1
AUTHORS Normal file
View File

@ -0,0 +1 @@
Jonathan Atkins <jcatki@home.com> http://jonatkins.org

59
BUGS Normal file
View File

@ -0,0 +1,59 @@
KNOWN BUGS for current version.
Please only report with new bugs, patches or suggestions, not these bugs!
Really weird things can happen...like keys still acting like they're pressed.
- If the focus is changed while wheeling actions are going on...hoo boy.
- If the modifier(s) are let up while wheeling actions are going on...hoo boy.
- To reset virtually stuck keys press and release all of them once, that works!
Non-wheel-fifo users that have things like the following in the imwheelrc:
Shift_L, Up, Button4
- will find that to send the Button4, imwheel must ungrab the mouse buttons
meaning that REAL mouse button events have a chance to slip through.
this results in unknown behaviour.
- the best solution is to find keys that do the same function, and use them
in your imwheelrc, instead of sending ButtonN events.
Memory footprint too big, says one person...
- Mine runs at about 1620 bytes well what am I gonna do!
@Exclude not excluding (at least since 0.9), may still not work in 0.9.7
- Method#1 users who use xv need this...
- could someone else please play with this. XWheel won't care about this
problem as it is now, because it will be more integrated into the low level.
Configuration dialog doesn't grab wheel actions for Method#1
- Oops...it's not that useful anyways.
OLD FIXED BUGS! It's always nice to see what's been fixed!
See Changes file for bug updates...keeping track in two places sucked eggs!
Wheel stops working after a canceled configuration box.
- FIXED in 0.9.6, appeared along with configurator in 0.9
configuration now regrabs the mouse buttons after a canceled configuration
Crashes with a segfault after some wheeling
- FIXED in 0.9 (second version)
No button event passthrough for clients with .Xdefaults support activated.
XV Grabber dies! It can't grab the mouse!
- FIXED in v0.7, was there from v0.1! Added @Exclude command.
Segfaulting on no rc files...
- FIXED in v0.6, introduced in v0.4, along with config files...
Segfaulting on NULL window title,class or resource names...
- FIXED in v0.5, introduced in v0.4, along with config files...
Netscape doesn't respond to more than one up and down at a time.
- FIXED in v0.3! try the alt sequences! they work as designed!
xman does not respond.
- FIXED in v0.4
All KDE clients reported to not respond.
- reported FIXED in v0.3
May cause some windows to hate the synthetic keys being pressed...
-- FIXED in v0.3, all keys are nonsynthetic...just check it out in xev!!

339
COPYING Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

398
ChangeLog Normal file
View File

@ -0,0 +1,398 @@
1.0.0.pre4:
"\(root\)" works for non-wheel-fifos, as long as @Exclude isn't used.
instead use :
"\(root\)"
,Up,Button4
,Down,Button5
etc... in your imwheelrc.
added mid-sequence keyups, put a - befreo the keysym for a keyup like this:
".*"
,Up,Shift_L|R|-R|-Shift_L|O|-O|F|-F|L|-L|Return
this will type "Rofl" and press return, in all apps, on wheel up.
make sure not to press something twice in a row without releasing it.
1.0.0.pre3:
added the --root-window (-r) option, for WM wheeling in the root of the
XServer. use pattern "\(root\)" in the imwheelrc file.
1.0.0pre2:
added --config (-c) option, open config window at start
added Button sending via XTest, use Button# as keysym in imwheelrc.
one less error on failing to open an empty filename
Thumb1 and Thumb2 (two thumb buttons) (Thumb == Thumb1)
README is no longer going to be updated, use the manpage after installation.
1.0.0pre1:
updated for gcc3.0
fixed configure dialog for XServer depth >16bits.
(please report if the configure dialog still fails for you now)
removed ye olde Makefile.unix
0.9.9:
Documentation needs updating with the features from this release...argh!
Made some more comments in the stderr output...plus hints.
Fixed a segfault on freeing a few strings that were not allocated.
Added -g option for focus event tracking, so we at least try to regrab
whenever the focused (ungrabbed) window is left.
this was code from Patrick Reinelt <preinelt@kullen.rwth-aachen.de>
-g toggles it on an off, but it is on by default, as it may help some
people out there.
pre6
This may be the last update to the 0.9.9, pending any bugs.
CVS dirs removed in make dist process...
Upgraded GPM to version 1.19.3 and generated the patch as usual.
Added Artec UM530P driver (-t um530p) to gpm.
This is the imps2 init code without the second half.
Thanks to: Vicente Aguilar <vaguilar@linuxfreak.com>
Fixed some references to O_SYNC for FreeBSD users, who don't have it!
Reduced the fontspec in cfg.c to be more forgiving, may avert a SegFault!
Added an RPM Source spec file...it might work, I dunno!
imwheelrc now installs into /etc for "make install"
Added -Igetopt for when included getopt is used.
Added a transpose (-x) option to swap the X/Y axis.
Useful for S-48 OEM gpm driver, also use -b 54 option...
This is for fifo use only, which is working fine in XFree86 4.0.1
Added more sanity checks in configure.in
getopt.h missing causes the included one to be used
XFree86 only checked for Linux systems
Added Linux Touch Panel Drivers for the Fujitsu Lifebook B112/B142
GPM driver to imwheel's gpm (-t b112)
Thanks to Harald Hoyer <Harald.Hoyer@Parzelle.De> <HarryH@Royal.Net>
who had the patches for gpm on his site http://parzelle.de/
Added Logitech OEM S-48 & Firstmouse+ to gpm (-t zilog)
This works for a Logitech OEM S-48 that I received as a donation
Thanks to A. Norman <norman@physics.wm.edu> posting his sourcecode!
His site is at:
http://www.physics.wm.edu/~norman/Mouse_Diag/index.html
Added a script to convert the Right-handedly oriented imwheelrc file to
Left handed (converts _L to _R in the imwheelrc)
It's simple so patterns matching the _L string will be changed to _R
watch out for that I suppose...but I haven't seen anything like
that in other places of the rc file.
The script is called lefty.sh, execute it before "make install" if you
are a left handed person or you prefer the right side control keys.
pre5
Replaced strsep usage for intel solaris people.
Fixed the fact that a missing "(null)" section would cause a segfault.
Fixed an UNGRAB(Exclude) handling code error.
Optimized the UNGRAB/GRAB search, now we don't go looking for a reason not
to UNGRAB all the time!
Added --buttons or -b option, whichs allows you to set the button mapping.
Default mapping looks like this: "45678"
You can limit it to just 4 and 5 by doing: imwheel -b 45
This also allows some people to fix the mapping for weirdo mice ;)
Here's a reference table for what the numbers mean:
index default button action in imwheel
1 4 Wheel/Stick Up
2 5 Wheel/Stick Down
3 6 Wheel/Stick Left
4 7 Wheel/Stick Right
5 8 Thumb Button
So that "imwheel -b 86754" does the following:
Button 8 is Wheel/Stick Up to imwheel
Button 6 is Wheel/Stick Down to imwheel
Button 7 is Wheel/Stick Left to imwheel
Button 5 is Wheel/Stick Right to imwheel
Button 4 is Thumb Button to imwheel
Use xev while NOT running imwheel (run "imwheel -kq" first) to find out
what buttons are what on your mouse!
Fixed the non-functional Configure Dialog (XGrabButton wasn't working right)
pre4
Fixed == tests to = in configure.in, per many complaints. (worked for me ;)
Updated gpm to version 1.19.2, people kept asking...
pre3
Fixed security bug, where a user may symlink to a file they cannot open as
themselves, then get the first line of that file using the debug mode.
This could allow the root password of the shadow to be exposed for any
user who has access to a set-uid-root imwheel.
Apparently Mandrake (and others perhaps) use a suid-root perl script to
execute the imwheel program, perhaps meaning to be more safe. In
reality I do not install imwheel as root, nor do I actively support it,
nor take any responsibility for those who do install it as a suid-root
or suid any other user, and who then have a security breach. I'm also
happy that my friend, Rob C. Ludwick, pointed the hole out to me, as
no-one on the mailing list he saw this being discussed on bothered to
write me! Also, about the distros suid perl script jazz...this is the
second time you've caused me pain, and I'm bitter, and I have no remorse
for you if you shall perish one million deaths through your foolishness
of suid-root wrappers.
One other note, imwheel already DOES check that any process it is looking
to kill is actually an imwheel process. If this needs improvement
then somebody send in a patch. I currently consider the possibility
impossible. (Yes, I like English!)
pre2
Added @Priority to allow for people who want visible control over what is
more important than whatever else. See imwheelrc for more. (tested)
Fixed the @Exclude bug, where if @Exclude was used with a ".*" regex then
all windows were excluded, even those defined in the imwheelrc.
The new priority command can help users tell imwheel how much they'd
really like to exclude and what doesn't need to be, otherwise position
in the imwheelrc is all that makes the difference now. (tested)
Fixed the configuration errors, where variables were unquoted and spaces
may have freaked m4 and the shell out!
pre1
fixed getenv("HOME") type security hole. (tested)
inclusion of imwheelrc, but no "make install" installation yet.
--------------------------------------------------------------------------------
0.9.8
finished configure "make dist" handling of unselected stuff.
seems to work well for all beta testers (at least 5 people wrote back)
pre4
fixed @Exclude (tested myself of course, waiting for feedback)
fixed PIDFILE crap from making the configure.in wrongly...
hey - I'm still learning autoconfig and friends... ;)
pre3
configure (full autoconf, automake, autoheader dealie)
updated gpm to version 1.19.0
added -v and --version option, for just the version header of the help
there will be NO MORE none gpm releases until gpm includes my patch in the
main distribution! configure doesn't play nice doing dual distros...
pre2
updated gpm to version 1.18.1
pre1
tfxmms - in gpm - the Serial Trackman FX marble button 4 as stick motion
toggle and complete mouse driver.
sensitivity option in imwheel - uses a summation of motion after
thresholding, to determine when to go!
@Repeat command (like @Exclude) in imwheelrc files - resends the button to X
this may not work for non-gpm wheelfifo users, who should rather use
@Exclude for now.
minor code cleanups - no bugfixes there! just making code better looking.
--------------------------------------------------------------------------------
0.9.7
Added --force option to force usage of event data instead of looking for
the focused window using XGetInputFocus. This may work better for some
window managers than others. In fvwm2 I do not use the force option,
whereas in window maker it may be mandatory. I know it's silly but when
you use the force option you are using the ICCCM method of grabbing the
current client window, whereas the deffault operation uses the original
XGetInputFocus method. All you need to know is that if the debug output
keeps showing the the window title as null, then toggle this option and
it may work correctly. Please report back to me on window managers and
whether the force option was required or not to work correctly with
imwheel. This method was sparked by Brian Craft <bcboy@cisco.com>.
Fixed a bug where if the winid was not being copied into a correctly sized
space, therefore causing segfaults when reading an rc like this...
".*\.[pP][dD][fF]"
Alt_L,Up,Up
Note that the window match string is longer than the keydef line. This
is when this bug would rear it's ugly head. It was a dead-in-the-head
bug that I'm sorry I ever caused to anyone who suffered while making a
customized rc file. I'm just amazed that I never ran into it in my time!
This bug was noted by Karoly Segesdi <vrm@scene-hu.com> if not
by others as well! (But he got me closest to finding the problem by
giving me an imwheelrc file that consistently caused a segfault)
Fixed a bug where imwheel whould exit when the fifo it was reading for the
wheel-fifo method was closed and reopened and then written from the other
side (from gpm or jam restarting).
Upgraded to gpm-1.18.0
Added marblefx support to gpm from Ric Klaren <klaren@cs.utwente.nl>,
untested as I don't have a marblefx. It looked good though!
Added Primax CyberNavigator [1] mouse to gpm from Alexios Chouchoulas
<alexios@vennea.demon.co.uk>. This is also untested for the same reason.
Added left handers Method#1 xmodmap config sent in from
Marc-Aurèle DARCHE <ma.darche@stellarx.com> to README and manpage.
And of course other misc. bugfixes, etc...that I've forgotten over time!
--------------------------------------------------------------------------------
0.9.6
Initial support & drivers (gpm & imwheel) for IBM ScrollPoint Mouse
It is the mm+ps2 mouse type in gpm
the IBM ScrollPoint PS/2 mouse uses the MouseManPlus Protocol in XFree86
Support for up and down only for now...I must do a bit before other
directions are considered! (for stick type mice thingers.)
Pressing continuously will only result in one action. Release and press
again to scroll another notch. (the regular scroll events come in too
fast to be useful yet...)
THANKS!!!!! TO Felix Klock for the ScrollPoint Mouse he MAILED ME!!!
This driver is due to the initiative and sacrifice of a few bucks to get
support for a mouse this guy loves...and from what I've read on newgroups
many others also love! Well you owe the possibility of this driver to
Bryan for mailing me a mouse to be able to actually hack on the real
thing. Now continued support is guaranteed as well!
mail your appreciation to Felix S Klock at pnkfelix@mit.edu
He paid $23 or so for the mouse plus shipping to me (with normal 32cent
stamps no less...due to the effects of the 1cent price increase in stamps
I'm sure he was kinda glad to be rid of some of his 32cent stash to make
room for the 33cent ones!) Please consider sending him a dollar for his
effort since you are reaping the rewards... (and hey send me a dollar! :)
Added mdump, a program to dump the mouse port, and anything else you want
with a bitwise breakdown and a 3 byte per line dump. Other interpretation
is added for assumptions of what may be happening with mouse motions.
I used this program to create the mm+ps2 driver for gpm. It is not
installed by 'make install' so copy it yourself if you're interested.
the first arg on the command-line is taken to be the path of the mouse
device, which defaults to /dev/mouse. The second arg is how many bytes
to dump per grab. This defaults to 3 but 4 is another common value to try.
The third arg is not parsed but if present the first byte will be bit
dumped like the rest of the bytes in a packet.
You can also use this program to see the MHz speed for your mouse!
e.g.: mdump /dev/psaux 4 1 (for imps2 mouse device type)
mdump /dev/psaux 3 1 (for ps2/mouseman+ mouse device types)
Added to mouse-mode setup programs for the intellimouse and mouseman plus.
running these programs sends the right control codes to the mouse to
activate the intellimouse or mouseman plus protocol. The intellimouse and
mouseman plus both default to ps2 mode. the intellimouse and mouse man
plus both support the imps2 protocol. some mouse man plus type mice may
not be intellimouse capable, but the IBM scrollpoint was capable of this
mode, restricting it to up and down wheel emulation on it's stick. To
reset mouse run setps2. setimps2 is for the intellimouse protocol.
setmmplus is for the mouseman plus protocol. us getmdt to see the mouse's
reponse to the mouse device type probe. The codes I've seen are as
follows (<nn> is in hex format):
<00> mouseman plus (3 byte packets)
<03> intellimouse (4 byte packets)
<00> plain ps2 (3 byte packets)
when mouse is this, <AA> is received also after an <FA>
Any <FA> type codes are ignored mouse responses, usually confirmation of
the mouse receiving the controls the program sends it.
All these debugging programs default to the /dev/mouse device node unless a
path is passed in as the first argument.
None of the debugging programs have been tested with serial mice.
Fixed a missed regrab of the mouse after the configurator is closed.
Pid file is only used if user is using the /dev/gpmwheel FIFO. (Method #2)
Killing pids according to pidfile now checks to make sure the process is
truely an imwheel process, and only kills it if it is an imwheel process.
It also will only kill if using the /dev/gpmwheel FIFO.
Imwheel funtions correctly on multiple displays by using the -display
option or setting the DISPLAY environment variable (use export/setenv!)
Thanks to Arnd Bergmann <arnd@uni.de> we now have gpm support for the
Knopex Wineasy 4D mouse. And due to his patches and them prompting me to
update lotsa code we have support for intellimouse serial, as well as
support for sideways actions. This is only available through the FIFO.
You must use Method#2 (a variant of which that is) that uses the wheel
FIFO as set up by gpm. XWindows cannot handle the 7 buttons correctly,
it can only handle 5, which means only up and down will work with
Method #1!
Added FreeBSD support, see the FREEBSD file for more. It requires no
changes to compile and install.
Added threshhold option for stick users of method #2 (it requires gpm)
Use the -t or --threshhold option to set a threshhold from 0-7.
The default is 2, it works well.
Added no-middle-button option (-n) to gpm. Use this if you have trouble
with unintentional middle button clicks while wheeling/sticking, and you
would rather use Emulate3Buttons chording in X (XFree86 at least...)
Added conditional compile for gpm-imwheel directory.
Added a full manpage.
--------------------------------------------------------------------------------
0.9.5
Finished off configure dialog to spec, it's just a helper, not an editor!
Updated gpm to version 1.16.0, now sticking with stable versions.
- hopefully I'll get a patch and send it to the gpm team for some
integration, thus releasing me from this task...
- the gpm library is still untested in the console...should work though!
see note in version 0.8 below.
Added suid option to "make install" for users other than root to be able
to run with a pid file. The default action is yes if nothing is entered
at the prompt. I felt that 'yes' had to be the default action to avoid a
bunch of newbie email. This doesn't allow users to install imwheel as
root, and it's not a security risk. this is for sys-admins, or at least
root users to be able to get all their users using the pid file for the
daemon and also for them to be able to kill off old daemons started by
other users before.
Added -p option for no pidfile stuff, be careful though, this allows any
user to start imwheel regardless of a previous imwheel process!
Added -D for debug output anytime (no recompiling for those bug reports!)
- use the -d option to avoid backgrounding the process!
Fixed silly free(NULL) crap...(heh, betchyall loved that one!)
added rxvt stuff to imwheelrc file.
added EMACS file (an email from an avid wheeler! oh, and it's about emacs!)
--------------------------------------------------------------------------------
0.9:
Configuration helper almost done. (still need to sample wheel actions!)
- use up,down,up in the root window to activate!
- all functions in window are fully functional.
- restart does restart imwheel and thus reread the rc files
- grab windows by clicking the snapshot and then on the desired window
- more to come!
More options and abilities:
- daemon mode
-d to NOT detach and daemonize!
- kill any existing imwheel
-k to kill any existing imwheel as a restart
- quit after rc files
-q, used best with -k to kill any imwheel process and quit
More configuration options:
- added 2 separately configurable delays
fixes netscape dropping keys! (it must queue only one key...)
first delay is the delay between repetitions (keyup->keydown)
second delay is the delay between pressing and releasing
(keydown->keyup)
see the new imwheelrc for the netscape values that work for me!
--------------------------------------------------------------------------------
0.8:
Modified gpm 1.15 beta2 for wheel support. I dunno about the gpm user
library and wheel stuff, but it may work with GPM_B_UP and GPM_B_DOWN.
use the -W (and -w for non-IM mice) for use with "imwheel --wheel-fifo"
IMWheel interfaces with /dev/gpmwheel, use the "--wheel-fifo" option, or
"-W /dev/gpmwheel", the -- option has /dev/gpmwheel as the default.
Don't forget to reconfigure your mouse pointer in XConfig...
--------------------------------------------------------------------------------
0.7:
No segfaults! Thank God! New functionality!
New Command structure started, and Exclude command added.
- Exclude ungrabs mouse for selected windows.
More commands may now be added as needed!
XV's window grabber was dying because it needed to grab all buttons...
- use the line "@Exclude" in an "xv grab" window section. See imwheelrc
--------------------------------------------------------------------------------
0.6:
Argh...another bugfix for segfaults...now you don't need an rc file.
--------------------------------------------------------------------------------
0.5:
Argh...a bugfix for segfaults...this time it doesn't care about windows that
don't have either title, resource, or class names set (leaving them NULL)
Thanks for all the positive response and encouragement.
Multi-rep scrolling actions can cause less then you expected to happen.
- Be patient, it works most of the time. There is no way I can find to fix
this, so help may be needed! You will find XSync in use, but I believe
that has a minimal effectiveness...makes it work better than before though
Moving out of windows and losing focus may cause weird things to happen!
- Press and release all modifier keys (alt,ctrl,shift,etc.) to reset input.
--------------------------------------------------------------------------------
0.4:
finally! Config file support is added, completing the keyboard config setup.
/etc/imwheelrc and/or $HOME/.imwheelrc files are used for configuration.
built-ins are still available for unconfigured windows.
anybody want to make a client to make configuration a breeze? Contact me!
all clients that have keyboard input can be used with configuration!
no new options.
more code moving, now two files, whopee you say! but it made development
easier!
got reports that KDE compatabilty has been achieved by v0.3
--------------------------------------------------------------------------------
0.3:
added options engine.
added -f or --flip-buttons option to flip behavior, useful for 4 button mice
changed engine, now using XTest extension instead of XSendEvent crap.
- still grabbing buttons which may be part of the incompatibility with KDE.
added other mice that should work as well, according to XFree86 docs.
added a grab reset sequence, but it seems to be a nop...
- run imwheel again if it dies and leaves your server going funky...
cleaned out junk from old engine, new code is cleaner...I think so anyways!
XTest extension now required (not checked in code...I may do that)
More clients work than ever!
Reps for sideways motion (alt-wheel actions) now work in netscape...
- only when there are sideways scrollbars
- May work everywhere, i dunno!
- It works in all tested clients that use cursor left/right keys for actions
--------------------------------------------------------------------------------
0.2:
cleaned up exit on bad display opening.
changed library directory to X11R6 instead of X11
received confirmation of compatability with Logitech MouseMan+ from:
"Markus Martensson" <mortis@acc.umu.se>
modifier combinations of Shift,Control, and Alt(Meta) changes behavior.
repetition of keystrokes
still no setup files...
still no change in clients...
--------------------------------------------------------------------------------
0.1:
first release
streamlined version, unused code is compiled out.
no setup, hardcoded page up and page down!
no exclusion for specific windows either.

110
EMACS Normal file
View File

@ -0,0 +1,110 @@
From - Sat Dec 19 00:50:58 1998
Received: from mail.iol.ie (mail2.mail.iol.ie [194.125.2.193])
by solaris1.mysolution.com (8.8.5/8.8.5) with ESMTP id UAA19253
for <jcatki@mysolution.com>; Sat, 21 Nov 1998 20:29:45 -0500 (EST)
Received: from sto-kerrig.ie (dialup-003.clonmel.iol.ie [194.125.43.195]) by mail.iol.ie
Sendmail (v8.9.1) with ESMTP id BAA26997 for <jcatki@mysolution.com>;
Sun, 22 Nov 1998 01:35:28 GMT
Received: from sto-kerrig.ie (IDENT:sneakums@sto-kerrig.ie [127.0.0.1])
by sto-kerrig.ie (8.9.1/8.9.1) with ESMTP id VAA04923
for <jcatki@mysolution.com>; Sat, 21 Nov 1998 21:14:36 GMT
Message-Id: <199811212114.VAA04923@sto-kerrig.ie>
Date: Sat, 21 Nov 1998 21:14:33 +0000
Content-Type: text
Status: OR
X-Mozilla-Status: 8001
X-Mozilla-Status2: 00000000
X-UIDL: 18c7143e5bfe082df1a908f7bd6ccdcb
From: Paul J Collins <sneakums@usa.net>
To: jcatki@mysolution.com
Subject: emacs imwheel settings
I've been messing with imwheel with a Logitech Mouseman Wheel, and
I've finally gotten nice smooth scrolling with Emacs.
Add the following to your .emacs:
;;; For imwheel
(setq imwheel-scroll-interval 3)
(defun imwheel-scroll-down-some-lines ()
(interactive)
(scroll-down imwheel-scroll-interval))
(defun imwheel-scroll-up-some-lines ()
(interactive)
(scroll-up imwheel-scroll-interval))
(global-set-key [?\M-\C-\)] 'imwheel-scroll-up-some-lines)
(global-set-key [?\M-\C-\(] 'imwheel-scroll-down-some-lines)
;;; end imwheel section
Add the following to your ~/.imwheelrc:
"emacs"
Shift_L, Up, Page_Up
Shift_L, Down, Page_Down
None, Down, Control_L|Alt_L|Shift_L|parenright
None, Up, Control_L|Alt_L|Shift_L|parenleft
Leaving out the Shift_L part makes emacs think you've typed C-M-9 and
C-M-0. Holding down left shift (you can add right if you like) will
scroll by pages, and with no modifiers, scrolling is by
imwheel-scroll-interval lines. For modes such as mail summary
buffers, it is easy to bind C-M-( and C-M-) to next-message, or
whatever.
Cheers
----------------p!
--
Paul Collins <sneakums@usa.net> Public Key On Keyserver.
INGREDIENTS: AQUA, ALUMINIUM ZIRCONIUM TETRACHLOROHYDREX GLY, ALCOHOL
DENAT, DIMETHICONE, PROPYLENE GLYCOL, CYCLOMETHICONE, DIMETHICONE
COPOLYOL, PARFUM.
--------------------------------------------------------------------------------
From - Tue Mar 30 02:19:44 1999
Received: from pi.novedia.de (nit.cs.tu-berlin.de [130.149.16.233])
by solaris1.mysolution.com (8.8.5/8.8.5) with ESMTP id KAA08475
for <jcatki@mysolution.com>; Mon, 29 Mar 1999 10:58:59 -0500 (EST)
Received: (from fm@localhost)
by pi.novedia.de (8.8.8/8.8.8) id SAA20776;
Mon, 29 Mar 1999 18:05:57 +0200
From: Frank Meissner <Frank.Meissner@novedia.de>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Date: Mon, 29 Mar 1999 18:05:57 +0200 (CEST)
To: Paul J Collins <sneakums@usa.net>, jcatki@mysolution.com
Subject: XEmacs-Keybinding-Syntax in EMACS, imwheel-package
X-Mailer: VM 6.43 under 20.4 "Emerald" XEmacs Lucid
Message-ID: <14079.41844.191690.742135@pi.novedia.de>
Content-Type: text/plain; charset=us-ascii
X-Mozilla-Status: 8001
X-Mozilla-Status2: 00000000
X-UIDL: 4a6ee4a74675e43bc0f9ec33957bc78d
Hi,
just a small addition to the EMACS-File, because for someone it may be
hard to get the keybindings right (I had to try two times and got one
help request from a co-worker)
The correct syntax for keybinding in xemacs is the following:
(define-key global-map [(control \))] 'imwheel-scroll-up-some-lines)
(define-key global-map [(control \()] 'imwheel-scroll-down-some-lines)
Perhaps you could add this to the EMACS-File.
Anything else goes really well, even Quake accepts the
wheel. Allthough I did'nt get the killer-keybinding or -alias, perhaps
you have a hint? Anyway, thanks for the great package and greetings
from berlin.
Frank
--
SIGTHTBABW: a signal sent from Unix to its programmers at random
intervals to make them remember that There Has To Be A Better Way.

32
FREEBSD Normal file
View File

@ -0,0 +1,32 @@
Antal Novak <afn@weevil.net> sent these instructions for imwheel on FreeBSD,
plus a few patches...ENJOY! (slightly edited for content and to fit your screen)
I currenly have FreeBSD-3.0 (although this should work with 2.2.6, or even
earlier) and a Microsoft IntelliMouse PS/2.
I did the following to get it to work:
1) To run moused, use the -t sysmouse (NOT PS/2!!!) argument for a ps/2
mouse, or -t intellimouse for the serial version (note, i've never tried
the serial version, so i'm not *positive* it will work... I'd like some
feedback on this if possible)
2) Run imwheel using method #1 as described in the imwheel README.
However, your XF86Config *must* be set up as follows (since there is no
FreeBSD XFree86 support for IMPS/2 because it can't preinitialize the ps/2
port):
Section "Pointer"
Protocol "IntelliMouse"
Device "/dev/sysmouse"
ZAxisMapping 4 5
EndSection
You can add other options if you want; however, it is important that you use
the IntelliMouse protocol and read from /dev/sysmouse (this is the passthrough
device for moused). Basically, the way moused works is that you can use *ANY*
protocol for reading /dev/sysmouse. Therefore, since we can't use IMPS/2, we
simply use IntelliMouse, so X thinks it's a serial IntelliMouse, and everything
is passed through!
Oh yeah, one final note, gpm is NOT needed (nor will it even compile) on
FreeBSD.

182
INSTALL Normal file
View File

@ -0,0 +1,182 @@
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

27
M-BA47 Normal file
View File

@ -0,0 +1,27 @@
Logitech Mouseman Wheel
This mouse wheel clicks on rolling, but the clicks are NOT the actual
move, the mouse is using the wheel without the clicks, thus making the wheel at
rest sometimes sensitive to minot non-click wheeling. This can result in
seemingly spurious wheelings but they are a result of defective design in the
methodology of the mouse wheel sensing. Complain to Logitech, not me!
init with mm+ps2 protocol
Thumb Down (Nothing Else Happened!)
2520670 ( 0MHz) : C8( -56)D2( -46)=11010010=-3, 2) 10( 16)=00010000= 1, 0)
7257 (137MHz) : 08( 8)00( 0)=00000000= 0, 0) 00( 0)=00000000= 0, 0)
Thumb Up (Nothing Else Happened!)
1616259 ( 0MHz) : C8( -56)D2( -46)=11010010=-3, 2) 00( 0)=00000000= 0, 0)
6060 (165MHz) : C8( -56)D2( -46)=11010010=-3, 2) 00( 0)=00000000= 0, 0)
10291 ( 97MHz) : C8( -56)D2( -46)=11010010=-3, 2) 00( 0)=00000000= 0, 0)
10278 ( 97MHz) : 08( 8)00( 0)=00000000= 0, 0) 00( 0)=00000000= 0, 0)
Byte 1
C8h=200d=310o=11001000b
^--always there = 0x08
Byte 2
D2h=210d=322o=11010010b
DEh=222d=336o=11011110b

51
Makefile.am Normal file
View File

@ -0,0 +1,51 @@
SUBDIRS=jax @getopt@ @mdetect@ @gpm_imwheel@
bin_PROGRAMS=imwheel
AM_CFLAGS=@CFLAGS@ @GETOPT_INCS@ @X_CFLAGS@ -I@srcdir@/jax -I. -Wall
imwheel_SOURCES=imwheel.c util.c cfg.c util.h imwheel.h cfg.h
imwheel_LDADD=@GETOPT_LIBS@ -L$(top_builddir)/jax -ljax @X_LIBS@
imwheel_DEPENDENCIES=imwheel.o util.o cfg.o jax/libjax.a
EXTRA_PROGRAMS=setimps2 setmmplus setps2 getmdt mdump setps2rate
noinst_PROGRAMS=@extras@ @mdump@
man_MANS=imwheel.1
EXTRA_DIST=BUGS FREEBSD EMACS M-BA47 BUGS see imwheel.1.html imwheel.1 TODO imwheelrc @extras_dist@ @mdump_dist@ lefty.sh imwheel.spec slack.sh
dist-hook:
-for DIR in @gpm_dist@ @mdetect_dist@ @getopt_dist@ ; \
do \
make -C $$DIR distclean ; \
cp -Rfp @srcdir@/$$DIR $(distdir)/$$DIR ; \
find $(distdir) -name CVS -exec rm -rvf '{}' ';' ; \
done
ETCDIR=/etc/X11/imwheel
install-exec-hook:
if SUID
progname=$(DESTDIR)$(bindir)/`echo imwheel|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'` ; \
chown @suid@ $$progname ; \
chmod u+s $$progname
endif
$(mkinstalldirs) $(ETCDIR)
-[ -f /etc/imwheelrc ] && mv /etc/imwheelrc $(ETCDIR)/imwheelrc || true
-[ -f /etc/X11/imwheelrc ] && mv /etc/X11/imwheelrc $(ETCDIR)/imwheelrc || true
-[ -f $(ETCDIR)/imwheelrc ] && install -m 644 imwheelrc $(ETCDIR)/imwheelrc.new || install -m 644 imwheelrc $(ETCDIR)/imwheelrc
extras: $(EXTRA_PROGRAMS)
if NO_GPM_DOC
Makefile.am: .premake
.premake:
@#Start
@touch .premake
@rm -f @gpm_imwheel@/doc/Makefile
all: .postmake
distclean: .postmake
.postmake:
@#End
@rm -f .premake
endif

803
Makefile.in Normal file
View File

@ -0,0 +1,803 @@
# Makefile.in generated by automake 1.9 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
SOURCES = getmdt.c $(imwheel_SOURCES) mdump.c setimps2.c setmmplus.c setps2.c setps2rate.c
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
bin_PROGRAMS = imwheel$(EXEEXT)
EXTRA_PROGRAMS = setimps2$(EXEEXT) setmmplus$(EXEEXT) setps2$(EXEEXT) \
getmdt$(EXEEXT) mdump$(EXEEXT) setps2rate$(EXEEXT)
noinst_PROGRAMS = @extras@ @mdump@
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
TODO depcomp install-sh missing mkinstalldirs
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
getmdt_SOURCES = getmdt.c
getmdt_OBJECTS = getmdt.$(OBJEXT)
getmdt_LDADD = $(LDADD)
am_imwheel_OBJECTS = imwheel.$(OBJEXT) util.$(OBJEXT) cfg.$(OBJEXT)
imwheel_OBJECTS = $(am_imwheel_OBJECTS)
mdump_SOURCES = mdump.c
mdump_OBJECTS = mdump.$(OBJEXT)
mdump_LDADD = $(LDADD)
setimps2_SOURCES = setimps2.c
setimps2_OBJECTS = setimps2.$(OBJEXT)
setimps2_LDADD = $(LDADD)
setmmplus_SOURCES = setmmplus.c
setmmplus_OBJECTS = setmmplus.$(OBJEXT)
setmmplus_LDADD = $(LDADD)
setps2_SOURCES = setps2.c
setps2_OBJECTS = setps2.$(OBJEXT)
setps2_LDADD = $(LDADD)
setps2rate_SOURCES = setps2rate.c
setps2rate_OBJECTS = setps2rate.$(OBJEXT)
setps2rate_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = getmdt.c $(imwheel_SOURCES) mdump.c setimps2.c setmmplus.c \
setps2.c setps2rate.c
DIST_SOURCES = getmdt.c $(imwheel_SOURCES) mdump.c setimps2.c \
setmmplus.c setps2.c setps2rate.c
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
install-recursive installcheck-recursive installdirs-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
man1dir = $(mandir)/man1
NROFF = nroff
MANS = $(man_MANS)
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GETOPT_INCS = @GETOPT_INCS@
GETOPT_LIBS = @GETOPT_LIBS@
GPM_DIR = @GPM_DIR@
HAVE_GPM_SRC = @HAVE_GPM_SRC@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
NO_GPM_DOC_FALSE = @NO_GPM_DOC_FALSE@
NO_GPM_DOC_TRUE = @NO_GPM_DOC_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SUID_FALSE = @SUID_FALSE@
SUID_TRUE = @SUID_TRUE@
VERSION = @VERSION@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
extras = @extras@
extras_dist = @extras_dist@
getopt = @getopt@
getopt_dist = @getopt_dist@
gpm_dist = @gpm_dist@
gpm_imwheel = @gpm_imwheel@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mdetect = @mdetect@
mdetect_dist = @mdetect_dist@
mdump = @mdump@
mdump_dist = @mdump_dist@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
suid = @suid@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
SUBDIRS = jax @getopt@ @mdetect@ @gpm_imwheel@
AM_CFLAGS = @CFLAGS@ @GETOPT_INCS@ @X_CFLAGS@ -I@srcdir@/jax -I. -Wall
imwheel_SOURCES = imwheel.c util.c cfg.c util.h imwheel.h cfg.h
imwheel_LDADD = @GETOPT_LIBS@ -L$(top_builddir)/jax -ljax @X_LIBS@
imwheel_DEPENDENCIES = imwheel.o util.o cfg.o jax/libjax.a
man_MANS = imwheel.1
EXTRA_DIST = BUGS FREEBSD EMACS M-BA47 BUGS see imwheel.1.html imwheel.1 TODO imwheelrc @extras_dist@ @mdump_dist@ lefty.sh imwheel.spec slack.sh
ETCDIR = /etc/X11/imwheel
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
.SUFFIXES: .c .o .obj
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
cd $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
clean-noinstPROGRAMS:
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
getmdt$(EXEEXT): $(getmdt_OBJECTS) $(getmdt_DEPENDENCIES)
@rm -f getmdt$(EXEEXT)
$(LINK) $(getmdt_LDFLAGS) $(getmdt_OBJECTS) $(getmdt_LDADD) $(LIBS)
imwheel$(EXEEXT): $(imwheel_OBJECTS) $(imwheel_DEPENDENCIES)
@rm -f imwheel$(EXEEXT)
$(LINK) $(imwheel_LDFLAGS) $(imwheel_OBJECTS) $(imwheel_LDADD) $(LIBS)
mdump$(EXEEXT): $(mdump_OBJECTS) $(mdump_DEPENDENCIES)
@rm -f mdump$(EXEEXT)
$(LINK) $(mdump_LDFLAGS) $(mdump_OBJECTS) $(mdump_LDADD) $(LIBS)
setimps2$(EXEEXT): $(setimps2_OBJECTS) $(setimps2_DEPENDENCIES)
@rm -f setimps2$(EXEEXT)
$(LINK) $(setimps2_LDFLAGS) $(setimps2_OBJECTS) $(setimps2_LDADD) $(LIBS)
setmmplus$(EXEEXT): $(setmmplus_OBJECTS) $(setmmplus_DEPENDENCIES)
@rm -f setmmplus$(EXEEXT)
$(LINK) $(setmmplus_LDFLAGS) $(setmmplus_OBJECTS) $(setmmplus_LDADD) $(LIBS)
setps2$(EXEEXT): $(setps2_OBJECTS) $(setps2_DEPENDENCIES)
@rm -f setps2$(EXEEXT)
$(LINK) $(setps2_LDFLAGS) $(setps2_OBJECTS) $(setps2_LDADD) $(LIBS)
setps2rate$(EXEEXT): $(setps2rate_OBJECTS) $(setps2rate_DEPENDENCIES)
@rm -f setps2rate$(EXEEXT)
$(LINK) $(setps2rate_LDFLAGS) $(setps2rate_OBJECTS) $(setps2rate_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getmdt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imwheel.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mdump.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setimps2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setmmplus.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setps2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setps2rate.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
uninstall-info-am:
install-man1: $(man1_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
1*) ;; \
*) ext='1' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
done
uninstall-man1:
@$(NORMAL_UNINSTALL)
@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
1*) ;; \
*) ext='1' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
done
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(mkdir_p) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
distdir) \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile $(PROGRAMS) $(MANS) config.h
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \
mostlyclean-am
@NO_GPM_DOC_FALSE@distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am: install-man
install-exec-am: install-binPROGRAMS
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-info: install-info-recursive
install-man: install-man1
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man
uninstall-info: uninstall-info-recursive
uninstall-man: uninstall-man1
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
check-am clean clean-binPROGRAMS clean-generic \
clean-noinstPROGRAMS clean-recursive ctags ctags-recursive \
dist dist-all dist-bzip2 dist-gzip dist-hook dist-shar \
dist-tarZ dist-zip distcheck distclean distclean-compile \
distclean-generic distclean-hdr distclean-recursive \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-exec \
install-exec-am install-exec-hook install-info install-info-am \
install-man install-man1 install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-binPROGRAMS uninstall-info-am \
uninstall-man uninstall-man1
dist-hook:
-for DIR in @gpm_dist@ @mdetect_dist@ @getopt_dist@ ; \
do \
make -C $$DIR distclean ; \
cp -Rfp @srcdir@/$$DIR $(distdir)/$$DIR ; \
find $(distdir) -name CVS -exec rm -rvf '{}' ';' ; \
done
install-exec-hook:
@SUID_TRUE@ progname=$(DESTDIR)$(bindir)/`echo imwheel|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'` ; \
@SUID_TRUE@ chown @suid@ $$progname ; \
@SUID_TRUE@ chmod u+s $$progname
$(mkinstalldirs) $(ETCDIR)
-[ -f /etc/imwheelrc ] && mv /etc/imwheelrc $(ETCDIR)/imwheelrc || true
-[ -f /etc/X11/imwheelrc ] && mv /etc/X11/imwheelrc $(ETCDIR)/imwheelrc || true
-[ -f $(ETCDIR)/imwheelrc ] && install -m 644 imwheelrc $(ETCDIR)/imwheelrc.new || install -m 644 imwheelrc $(ETCDIR)/imwheelrc
extras: $(EXTRA_PROGRAMS)
@NO_GPM_DOC_TRUE@Makefile.am: .premake
@NO_GPM_DOC_TRUE@.premake:
@NO_GPM_DOC_TRUE@ @#Start
@NO_GPM_DOC_TRUE@ @touch .premake
@NO_GPM_DOC_TRUE@ @rm -f @gpm_imwheel@/doc/Makefile
@NO_GPM_DOC_TRUE@all: .postmake
@NO_GPM_DOC_TRUE@distclean: .postmake
@NO_GPM_DOC_TRUE@.postmake:
@NO_GPM_DOC_TRUE@ @#End
@NO_GPM_DOC_TRUE@ @rm -f .premake
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

101
NEWS Normal file
View File

@ -0,0 +1,101 @@
You might be looking for the ChangeLog file...
Testing Results: (Thanks to all who have responded, keep up the great work!)
Mice that are reported working (XF86-Mouse gpm-type):
Intellimouse PS/2 (IMPS/2 or imps2/MouseSystems)
- including Intellieye mice, except any thumb buttons on the Pro version
for that you need X support for buttons 5 and 6 or jam...
Intellimouse Serial (Intellimouse ms3)
Logitech PS/2 (MouseManPlusPS/2 mm+ps2) Serial (MouseManPlus mman)
- Trackman Marble FX (gpm -t tmmfx w/Method#2)
serial mouse driver, works like in windows.
- Marble FX (gpm -t marblefx w/Method#2)
new driver in gpm may give FULL functionality using Method #2
this works like in windows, click on/off for wheel functions
other setups may only leave you with the Up dir, see also imwheel -4
- Marble +
- Pilot Mouse+
- Cordless Wheel Mouse (Method #1 @least)
- Mouseman Wheel (Method #1 @least)
- Cordless Wheel Mouse PS/2 (gpm -t mm+ps2 w/Method#2)
- Firstmouse
- Logitech M-BA47 (imps2 for non OEM-color label on mouse)
Genius PS/2
- NetMouse Pro PS/2
- NewScroll/PS2 (1:IMPS/2 or 2:imps2/MouseSystems)
- Trust Ami Mouse Scroll Pro Excellence series
- WinEasy 4D
- Primax CyberNavigator [1] mouse
- Ami Mouse Scroll Pro (Excellence Series)
says Jay at predator1710@gmx.net
- Arowana PS/2 WheelMouse
says frank.van.geirt@pandora.be
- Dexxa Optical Pro (PS/2)
uses imps/2 type drivers
Mice I support due to having them:
Intellimouse PS/2
IBM ScrollPoint PS/2
Works Great With:
Netscape (3.04, 4.0x, 4.5) (click to change wheel focus)
- All Netscape clients: Mail, Composer, etc...
- click to focus on frames. (Forms work now like they should!)
XLess
GVim (Lesstif)
XiTerm
ETerm
NXTerm
rxvt
- rxvt/src/feature.h has several scroll-related options
- you may want to compile rxvt without scroll wheel support
Acroread 3.1 and up
xterm (including scrolling the xterm itself!)
- scrolling XTerm (instead of typing in it) is possible when the config
file is set up. The included imwheelrc has a setting that uses alt
for scrolling the actual scrollbar on the xterm!
- shift up and down work in bash!
- if using vim or less, the plain/shifted/controled wheel works as
expected!
MGV
ghostview
some lesstif/motif windows, like file selectors... (click to focus!)
KDE stuff (what? well...anything that has key responses!)
XMan (requires an .imwheelrc configuration as included in archive)
Staroffice 4.0 and up
XV (window grab...may need help, read on)
- Needs configuration, see @Exclude command notes in README, unless...
- if used with wheel fifos in gpm and imwheel, it's fine!
emacs (see EMACS file for some help if you want it!)
KDE (kfm, kmail, etc...)
Any client that accepts keyboard control should be configurable,
if not, work without configuration but with the built-in defaults!
Not Working At All:
XFree86 4.0 support for /dev/gpmdata or /dev/jam_*:* FIFO mouse devices
- use the ZAxis method, and if your mouse doesn't work...try again.
or fallback to the 3.2+ server distros - argh.
Clients that don't expect any keys at all.
- There is no way to do this, except maybe X server ICC...but I don't
know any of that stuff, I only know about it, and it's C code calls.
Console
- I'm looking into this, now that I tangled with gpm for wheel info!
QTronix (?) mouse - which one??? we need the init code apparently.
May work, But it depends on which Method and which client:
Wheel buttons in KDE clients when using wheel-fifo.
- I mean KDE client that use actual wheel mouse stuff, won't...
since the wheel is not going through the XServer at all!
unless they expect pageup/pagedown too...
in method #1 you can exclude these windows and they should work!
XServers that may work if used with the included gpm and imwheel wheel fifo:
XInside's Accelerated-X (There is no wheel support in AccelX!)
- you must use the included gpm and imwheel with the wheel fifo options!
XServers that are thought so far to be useless with a wheel mouse:
Any win32 XServer software that has no XTest extension.
- XVision has support I think, I'll test it at work, if I ever boot into
NT again. I haven't run NT in 5 weeks now, and I don't intend to!

537
README Normal file
View File

@ -0,0 +1,537 @@
www.FreshMeat.net appindex# 903164189
Overview
""""""""
This is a not so short little ditty that does the simple conversion of mouse
button presses into key presses. By grabbing only the 4th and 5th mouse buttons
the program is able to receive input from the Intellimouse series mice. There
is also a modified version of gpm included that has, already, support for the
Intellimouse, and I added a wheel fifo. The user library may also be used,
although this may need to be debugged. See the gpm section below for more.
The wheel button can always be used as middle button, this program does not
affect how the XServer, nor GPM, react towards it. A mouse with a wheel button
is a 3 button mouse, and should be configured as such!
Required
""""""""
XFree86 >= 3.3.2 (or other XServer with wheel to mouse button support)
not version 4.0.0 for gpm or jam use, FIFO support is broken there.
it is fixed in 4.0.1 so upgrade if you are on 4.0.0
Intellimouse or Logitech MouseMan+ (other wheel mice work too...)
to compile from source:
The X11 include files and libraries. (Not the X server development packages)
Installation
""""""""""""
configure --help
configure (and any options you want to set)
make
make install
**********************************************************************
**********************************************************************
**** ****
**** READ THE MANPAGE FOR UP TO DATE DOCS! ****
**** everything after this point may help, but is not up to date. ****
**** ****
**********************************************************************
**********************************************************************
The mouse must be setup in XF86Config to send the mouse buttons 4 and 5 for
wheel actions. To do this:
[ METHOD #1 : XGrabButton ]
1) edit /etc/XF86Config with your favorite editor (I suggest vim! It's crunchy)
a. add the following line to the "Pointer" section.
for 1 wheel:
ZAxisMapping 4 5
for two wheels or a stick:
ZAxisMapping 4 5 6 7
b. Make sure your Protocol is set to either "IMPS/2" for a PS/2 mouse
or for serial mice set it to "IntelliMouse" or "Auto".
It should work for the following mice, which have wheels, knobs, or
buttons that are mappable with ZAxisMapping (according to XFree86
documentation):
ASCII (serial, PS/2)
Genius NetScroll (PS/2)
Genius NetMouse and NetMouse Pro (serial, PS/2)
Logitech MouseMan+ and FirstMouse+ (serial, PS/2)
Half functionality may be obtained from the following mice that have
at least a fourth button capability:
ALPS Glide-Point (serial, PS/2) ('Tapping' is button 4)
The half functionality will only go up and left, unless you include the
-4 option on the command-line.
c. Here's my current setup for an example of a PS/2 Intellimouse:
Section "Pointer"
Protocol "IMPS/2" #change for your mouse type.
Device "/dev/psaux" #change for your device.
BaudRate 1200 #This is probably not needed!
Resolution 100 #And neither is this!
ZAxisMapping 4 5 #This is necessary!
Buttons 3 #Use this instead of Emulate3 stuff!
EndSection
d. Restart XWindows if you need to!
2) make
3) make install
This will currently install to /usr/local/bin, so edit the Makefile to
change this behavior.
Don't forget to choose whether you want imwheel to be setuid root. This is
required for any users who need to use imwheel and the pidfile stuff to track
running imwheels.
4) After XWindows is started run imwheel like this:
imwheel -k
imwheel will automatically background itself this way.
I added the -k to force any old imwheel processes to stop. This will not
cause imwheel to die if there are no previous imwheels.
XFree86 Settings:
Make sure Emulate3 phrases are either deleted or commented out to use the
wheel button as the middle button(2), and then the right button is button 3.
STUPID FACT:
Obviously this method can be used for a real 5(+) button mouse as
well...but why?! The 4th and 5th buttons may be used as if they were the wheel
rolling up and down, but this will remove the regular functionality of the 4th
and 5th buttons, unless you "exclude" the windows in which you need the 4th and
5th buttons.
[ METHOD #2 : wheel fifo ]
This method is REQUIRED for Accelerated-X or any other server without wheel
mouse support built in. It is also the recommended method by me! This method
will currently support ONLY the ps/2 Intellipoint Mice, not the serial version,
nor any other mice for that fact...unless you want to add support in gpm
yourself or send me a mouse so that I can implement it in gpm. To add a new
mouse to this method no change to imwheel is required.
1) Edit /etc/XF86Config with your favorite editor (I suggest vim! It's crunchy)
OR use XF86Setup. That's easier!
b. Make sure your Protocol is set to "MouseSystems"
Mouse support is dependent on gpm. Right now I KNOW imps2 works!
others that may work for you include mm+ps2, marblefx, pcnps2, and ms3.
try others if these don't work or another matches your mouse better.
c. Here's my current setup for an example of a PS/2 Intellimouse:
Section "Pointer"
Protocol "MouseSystems" #gpm -R is MouseSystems!
Device "/dev/gpmdata" #this is the gpm -R output
BaudRate 1200 #works for me...
Resolution 100 #i dunno...works again!
Buttons 3 #use this,it's better than Emulate3!
#if you set this higher...more
#configuration is REQUIRED
EndSection
d. Restart XWindows if you need to!
2) make
3) make install
This will currently install to /usr/local/bin, so edit the Makefile to
change this behavior.
if you want ALL the gpm stuff enter that directory and "make install" there.
The usual install only installs the gpm executable.
Don't forget to choose whether you want imwheel to be setuid root. This is
required for any users who need to use imwheel and the pidfile stuff to track
running imwheels.
4) After XWindows is started run :
imwheel -k --wheel-fifo
imwheel will automatically background itself this way.
I added the -k to force any old imwheel processes to stop. This will not
cause imwheel to die if there are no previous imwheels.
NOTE: the @Exclude command has no bearing in this method, and is ignored.
mainly because by excluding a window in this method there is nothing
sent to the window for the wheel, whereas in the other mode
exclusion turns off the button grabbing and allows the usual button 4 and
5 events again for those clients that either need to grab all the buttons
or want to receive the buttons 4 and/or 5 for their own purposes.
gpm
"""
The included gpm is stable, a patch is included as well, and I will try to keep
up with the next stable versions. Using the included gpm is only necessary if
you are going to use method #2 from above. To use gpm and imwheel together you
must run gpm and imwheel as follows:
gpm -W -R -t mousetype(see above for known working types)
NOTE: gpm may be killed and restarted with imwheel running, imwheel and gpm
can both handle this interruption just fine. When gpm is dead, both
the XServer and imwheel will not respond to the mouse. You will need
to run gpm again!
Other options may be added of course!! use -w to force wheel. use gpm -h to see
them.
imwheel -k -W /dev/gpmwheel
or
imwheel -k --wheel-fifo
or
imwheel -k --wheel-fifo /dev/gpmwheel
or
imwheel -k --wheel-fifo /dev/jam_imwheel:0 # number zero may be higher
if you want ALL the gpm stuff enter that directory and "make install" there.
The usual install only installs the gpm executable.
NOTE : gpm will create the fifo if it needs to, imwheel will not.
/dev/gpmwheel is simple it output a 4 or 5 (byte not char!) for up and down.
You may use it in other programs if imwheel is not used...but why? od the fifo
to watch your wheel at work (od is an octal dumper!), it requires a line for
output so wheel a lot to see your mouse actions! The gpm currently included is
a hacked beta, which may sound bad, but it's been very stable for my imps2.
JAM
"""
For jam to work with imwheel you will have to place the imwheel output
module in the mice/file that you are using for your mouse. see the mice/imps2
file for an example. See also the JAM documentation. JAM will then output
imwheel compatible streams on the /dev/jam_imwheel:* set of FIFOs, see JAM docs
on multiple FIFO outputs. JAM is the only way to use multiple running
imwheels, one for each DISPLAY you may have, for multiple displays. If you
only have one screen then this doesn't really matter to you.
XWheel is the full client to be paired with JAM and intended to replace
imwheel. IMWheel is now an aging product...only maintanance work is being done
on imwheel and it's version/hack of GPM.
.imwheelrc
""""""""""
[ OVERVIEW ]
The configuration of specific clients is taken care of in the file called
"$HOME/.imwheelrc" or "/etc/X11/imwheelrc".
All arguments in the file are separated by commas.
The pound(#) symbol may be used anywhere for comments.
Case is VERY important in the configuration file!
[ WINDOWS ]
In this file windows are configured by title name, resource name, or class name.
Each window is configured on multiple lines. The first line in a window
section is the window pattern string enclosed in double-quotes("), then one
line each for each action in that window.
Double-quotes must surround window identifier strings, and only these strings
are allowed to be quoted. Without the double-quotes that window's section will
be parsed as if it is in the previous window's section!
The windows are matched at run-time using regular expression syntax, so to
match a group of windows make up the appropriate regex pattern and use that as
the identifier.
[ REGULAR EXPRESSIONS ]
Regular expressions are used, for one reason, because they are built into C, and
the other, they are powerful!
One thing to note is that if you don't put a ^ (caret) at the beginning of each
string then you may end up with a string matching a substring that doesn't
begin with the expression. Which is why in the distributed file most entries
begin with a caret now.
O'Reilly & Associates has a great Regular expressions book that you can get,
and it covers the type of expression syntax used here.
[ COMMANDS ]
Commands are began with an at('@') character. They apply to the window whose
section they are in. Mixing commands and window wheel actions may achieve
undesired results. For now mixing is moot, being that the only command is to
turn off wheel actions!
Available commands:
@Exclude
This will un-grab the mouse buttons for the current window, it will attempt
to re-grab the mouse buttons when the keyboard focus is changed. Once the
focus window has changed from the excluded window, every motion of the mouse
will cause an attempt to re-grab the buttons. The program will catch all
errors during this period. Once the buttons are grabbed successfully the
program resumes normal wheel operation.
NOTE: This command is required for the "xv grab" window!
This command is unused with the --wheel-fifo option, see gpm.
[ KEYSYMS ]
The program expects combinations of keysyms to be used by using pipe(|)
characters to combine them together.
Example: Alt_R|Shift_R
Means Right Alt AND Right shift together, not just either-or!
Modifier Keysym names used in X:
Shift_L Shift_R
Control_L Control_R
Alt_L Alt_R
These are not currently assigned any keys, unless you xmodmap them in:
Super_L Super_R
Hyper_L Hyper_R
And here's some that you may use, and they are somewhere on your keyboard!
Here's where they were on my keyboard, again, this is not universal.
Use the "xev" program to test your own keys on your keyboard!
Caps_Lock =The Caps Lock key! (This still turns on and off caps lock!)
Num_Lock =The Num Lock key! (This is not good to use...)
Multi_key =The scroll lock key! (Go figure!)
Mode_switch =Right Alt...for me anyways. (this mean I cannot use Alt_R)
NOTE:
You can add support for the windows keys. They may be set up for you as
Super_L and Super_R. If not use xmodmap or better, Xkeycaps the graphical
frontend, to set them up as these Super keys.
To find keysym names for any keys available see the
/usr/X11R6/include/X11/keysymdef.h file, and for any define in that file remove
the "XK_" for the usable keysym name in the configuration file.
If no input keysyms are named, any input modifier keys will be ignored, and
that action will match if the wheel action is matched! Order matters here
a lot! Put a no-input-modifier keysym at the end of it's section for what you
most likely want to happen! The "None" keysym is preferred in this situation,
however.
"None" is another special keysym used to indicate no input modifier is allowed.
This is used to make the action not match when a modifier is pressed.
"Pass" is a special keysym used to tell imwheel to pass the button press
through to the client window as if imwheel was not present. (Not implemented
yet!)
The Modifier keysym(s) are the expected keys to be pressed along with the wheel
actions. If the modifier is not a match, that action is not done.
The second field is the mouse wheel action, "Up" or "Down".
The Output Keysyms (the second set of keysyms) are the keys that are pressed
when the following conditions are met:
1) Current Focused window (not a mouse over thing!) has a match as a title,
resource, or class name to the window regex pattern specified as the
window identifier.
2) Current pressed keys on keyboard match the Modifier Keysym(s),
or there are no modifier keysyms to match.
3) The wheel is moving up or down and that matches the second argument.
[ REPS ]
Reps (Repetitions) lets you say a number for how many times you want the
output keysyms to be pressed. See the chart on the default bindings for the
default number of reps for each modifier-combo (The chart is near the end of
this document).
[ DELAYS ]
Two delays are configurable in the "/etc/X11/imwheelrc" and/or the
"$HOME/.imwheelrc" files. The first delay is the delay between repetitions.
The second delay is the delay between key down and key up events. If you make
the delay too long expect the likelyness of the sticky keys bug to occur (see
BUGS file). The delays are specified in microseconds. see the included
imwheelrc file (which you should copy/merge) for the netscape configuration
that works best for me!
[ FILES ]
See the included imwheelrc file for a few examples of configured windows. This
file is a good start and may be copied into the users home directory as
".imwheelrc" and/or into /etc/X11/imwheelrc for a default setup for all users.
Then modify your individual copy or the /etc copy to add more windows.
[ CONFIGURATION HELPER ]
There is a "hidden" configuration helper that can be called up while running
XWindows and imwheel. The helper is called by wiggling the wheel up and down
in X's root window until it appears.
The helper is able to do the following:
1) Grab windows and display relevant configuration information, that is:
Window title, Resource name, and Class name. The class name is usually
the best thing to use, but this is up to you to decide!
2) Grab wheel actions and display the modifiers to use in the imwheelrc file.
3) Reload the imwheelrc file, this actually restarts imwheel for you!
The Cancel button merely exits the helper, however the imwheelrc file is not
rescanned, so no changes will be reflected in continued wheel usage.
To grab a window, click on the image on the left, and then click on a window.
If the window can be used with imwheel it will appear in the big button. This
is determined soley by window focus. I use focus on mouse over so this works
great for me, however those who use click-focus may not see the expected
results. It's just trying to help...
To grab a wheel action, press the button label as such and then press and hold
you desired modifier keys then roll the wheel in the direction to configure.
The wheel direction to use in the file will be shown with a list of the
modifiers below it. Output keys can be grabbed somewhat similarly in this
manner however the shifted keys may need to be translated to the actual
characters desired, this was not the case for XTerm though.
[ PLEAD ]
Please send your configuration additions to me at one of the addresses stated
below for possible inclusion in further releases. If deemed useful and
sensible it will be added to the distribution. Please don't write asking for
help with the rc file! Ask for features and bug fixes, sure, but not any more
of a tutorial than this!
[ SYNTAX ]
The following syntax is available ('<' and '>' characters signify variables
required to be filled in, '[' and ']' are optional variables):
# blank lines are ignored, and not needed, as are comments ignored.
# whitespace is ignored unless contained in quotes.
"<window identifier>"
[Modifier keysym(s)/None],<Up/Down>,[Keysym(s)/Pass],[Reps],[RepDelay],[DelayUp]
[Modifier keysym(s)/None],<Up/Down>,[Keysym(s)/Pass],[Reps],[RepDelay],[DelayUp]
[Modifier keysym(s)/None],<Up/Down>,[Keysym(s)/Pass],[Reps],[RepDelay],[DelayUp]
...more modifiers, etc...
"<next window identifier>"
@<Command>
"<next window identifier>"
[Modifier keysym(s)/None],<Up/Down>,[Keysym(s)/Pass],[Reps],[RepDelay],[DelayUp]
...and so forth...
The best example is availble in the supplied imwheelrc file, in the netscape
section, there is a commented-out version of Up and Down that do smooth
repeating up or down keys respectively and it is tuned to have a working delay
for netscape to catchup.
Options
"""""""
Use the -h or --help option for all available options, and documentation.
--long-args can also be written as -long-args, but this sometimes causes other
combinations of short-args to fail due to ambiguity, just state them separately
to avoid the ambiguity. (e.g.: -pdD => -p -d -D)
Notation: "<>" surrounds required args
"[]" surrounds optional args.
-4
--flip-buttons
Flips the mouse buttons so that 4 is 5 and 5 is 4, reversing
the Up and Down actions. This would make 4 buttons more useful!
See also the manpage for xmodmap.
-f
--force
Forces the X event subwindow to be used instead of the original
hack that would replace the subwindow in the X event with a
probed focus query (XGetInputFocus). This should fix some
compatability problems with some window managers, such as
window maker, and perhaps enlightenment. If nothing seems to be
working right, try toggling this on or off...
-W <fifo-path>
--wheel-fifo [fifo-path]
Use the gpm wheel fifo instead of XGrabMouse. See gpm section.
This method allows only one X display to be used.
This is required for method #2 to work.
@Exclude commands in the rc file are unused in this mode.
fifo names the named pipe created by gpm.
It defaults to "/dev/gpmwheel". (--wheel-fifo only)
Must exist before running imwheel in this mode.
-k
--kill Attempts to kill old imwheel (written in --wheel-fifo method
only.) Pidfile must be created for this to work. Process is
tested using /proc/${pid}/status Name: field ?= imwheel.
If /proc is not mounted then this fails everytime!
-p
--pid Don't write a pidfile for --wheel-fifo method. This is the only
method that uses the pidfile. XGrab doesn't need it, so it just
issues a warning about starting multiple imwheels on the same
display.
-X <display>
--display <display>
use XServer at a specified display in standard X form.
using this mode allows for multiple displays.
this is useful in method #1.
-D
--debug Show all possible debug info while running. This spits out alot
and I also suggest using the -d option to prevent imwheel from
detaching from the controlling terminal.
-d
--detach Actually this does the opposite, it prevents detachment from the
controlling terminal. (no daemon...) Control-C stops, etc...
-h
--help short help on options plus version/author info.
-q
--quit Quit imwheel before entering event loop. Usful in killing an
imwheel running in --wheel-fifo mode after exiting XWindows.
(e.g.: imwheel -k -q = kill and quit)
-s <sum-minimum>
--sensitivity <sum-minimum>
Used with gpm only and then only with recognized stick mice.
like -t only this sets a minimum total amount of movment of the
stick or marble, before any action is taken. This works good
with the Marble type devices. See also --threshhold.
-t <minimum-pressure>
--threshhold <minimum-pressure>
Used with gpm only and then only with recognized stick mice.
stick mice send a pressure value ranging from 0(no pressure) to
7(hard push). This sets the minimum required pressure for
movement. setting it to zero will cause realtime sticking, which
is usually too much action for X to keep up. (max rate i saw was
100 events a second!) The default is 2, to avoid slight presses
on the 90degree direction of the intended while still getting to
the intended direction. Setting this to 7 is insane, because it
requires the user to press the hardest everytime they want
something to happen! See also --sensitivity.
Usage
"""""
The default modifier/wheel actions that are hard-coded will always be present
when an imwheelrc file doesn't provide a match or doesn't exist.
Default modifier effects chart:
Modifier Effect (Up, Down) Repetitions
-------- ----------------- -----------
None Page_Up, Page_Down 1
Shift Up, Down 1
Control Page_Up, Page_Down 2
Shift+Control Page_Up, Page_Down 5
Meta(that's Alt!) Left, Right 10
Shift+Meta Left, Right 1
Control+Meta Left, Right 20
Shift+Control+Meta Left, Right 50
For left and Right on wheels and sticks the repetitions are all that matter,
because they only go left and right by default. This can be changed in the
imwheelrc. Us the Left or Right keyword for the input action keyword to alter
left and right motions of a wheel or stick.
Lefty X Usage
""""" " """""
For left handed users this command may help at the start of X:
xmodmap -e "pointer = 3 2 1 4 5"
Contact Info
""""""" """"
Jonathan Atkins
2012 River Run Trail
Fort Wayne, IN 46825-6041
jcatki@jonatkins.org

21
TODO Normal file
View File

@ -0,0 +1,21 @@
[High]
update docs for pre-release stuff
[Low]
create a nice printable readme for printing (LaTeX or DocBook?, or texinfo!)
use @sysconfdir@ for imwheelrc installation and read location
rewrite configure.in (it was my first one after all!)
add gesture support
[Never :( ]
allow for a modifier key and mouse motion to emulate wheel
(done) Allow for specific Excluded X mouse buttons
(done) allow sending of mouse buttons, besides keys...
(done) move global imwheelrc to /etc/X11
(done) add keyup support (mid output keys, like L|-L|u|-u etc..)
(?)
convert NEWS file to the standard NEWS file format
convert ChangeLog file to the standard ChangeLog file format
convert AUTHORS file to the standard AUTHORS file format

1044
aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

819
cfg.c Normal file
View File

@ -0,0 +1,819 @@
/* Intellimouse Wheel Thinger Configuration Helper
* Copylefted under the GNU Public License
* Author : Jonathan Atkins <jcatki@jonatkins.org>
* PLEASE: contact me if you have any improvements, I will gladly code good ones
*/
#include <config.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#include <jax.h>
#include <X11/cursorfont.h>
#include "util.h"
#include "imwheel.h"
#define MAX_SCALE_W 200
#define MAX_SCALE_H 200
#define GUI_W 200
#define GUI_H MAX_SCALE_H
#define TRIPLE(c) c,c,c
#define MAX(a,b) (a<b?b:a)
#define FONT "-adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*"
/******************************************************************************/
typedef enum
{
BUTTON=1,
LABEL
} Type;
typedef enum
{
//BUTTON
REST=1<<1,
ACTIVE=1<<2,
DIRTY=1<<3,
// LABEL
CENTER=1<<4,
LEFT=1<<5,
RIGHT=1<<6
} State;
typedef struct HOTSPOT
{
int id;
Type type;
int x,y,w,h;
char *label;
State state;
int (*buttonfunc)(Jax*,struct HOTSPOT*);
void (*drawfunc)(Jax*,struct HOTSPOT*);
} Hotspot;
/******************************************************************************/
int handle_expose(Jax*);
int handle_button(Jax*);
int handle_destroy(Jax*,Hotspot*);
int handle_reload(Jax*,Hotspot*);
int GrabWheel(Jax*,Hotspot*);
void PickWindow(Jax*);
void GrabWindowImage(Jax*);
Hotspot *getHS(int);
int deleteHS(int);
int newHS(int x, int y, int w, int h, int state, int type, char* label,
int (*buttonfunc)(Jax*,struct HOTSPOT*),
void (*drawfunc)(Jax*,struct HOTSPOT*));
int doHS(Jax*, Hotspot*);
void drawHS(Jax*, Hotspot*);
int inHS(Hotspot*, int, int); //x,y
int HSeventhandler(Jax*);
void drawBox(Jax*, int,int,int,int,int,int); //x,y,w,h,light,dark
/******************************************************************************/
Jax_Events je[]=
{
{ExposureMask, Expose, handle_expose},
{ButtonPressMask, ButtonPress, handle_button},
{ButtonReleaseMask, ButtonRelease, HSeventhandler},
{ButtonMotionMask, MotionNotify, HSeventhandler},
//{StructureNotifyMask, DestroyNotify, handle_destroy},
{0,0,NULL}
};
int changed,depth;
unsigned long *scaleimgdata;
Window grabwin;
XImage *scaleimg;
XColor grays[]=
{
{0,TRIPLE(65535/8*2),0,0},
{0,TRIPLE(65535/8*4),0,0},
{1,TRIPLE(65535/8*6),0,0},
{1,TRIPLE(65535/8*7),0,0}
};
Hotspot *hs=NULL;
int wname_hs=0, class_hs=0, res_hs=0, *grabw_hs=0;
int numhs=0, hsid=1, numgrabw;
int save=0;
int name_w=0;
/******************************************************************************/
#ifndef HAVE_STRDUP
char* strdup(char *a)
{
char *b;
malloc(strlen(a)+1);
strcpy(b,a);
return(b);
}
#endif
/******************************************************************************/
int handle_reload(Jax *jax,Hotspot *hs)
{
changed=1;
return(True);
}
/******************************************************************************/
int handle_destroy(Jax *jax, Hotspot *hs)
{
freeAllX(&xch,NULL,&wname);
return(True);
}
/******************************************************************************/
int handle_button(Jax *jax)
{
int rv;
if((rv=HSeventhandler(jax)))
return(rv);
if(!grabwin)
{
int junk;//, nkids=0;
Window junkwin,focuswin;//,parentwin=0,*kidwin=NULL;
XQueryPointer(jax->d,JAXdefaultrootwin(jax),&junkwin,&grabwin,&junk,&junk,&junk,&junk,&junk);
if(!grabwin)
grabwin=junkwin;
Printf("grabwin=0x%08x\n",(unsigned)grabwin);
if(grabwin!=JAXdefaultrootwin(jax))
{
XGetInputFocus(jax->d,&focuswin,&junk);
Printf("focuswin=0x%08x\n",(unsigned)focuswin);
/*XQueryTree(jax->d,parentwin,&junkwin,&parentwin,&kidwin,&nkids);
if(kidwin && nkids)
XFree(kidwin);
Printf("parentwin=0x%08x\n",(unsigned)parentwin);
if(grabwin==parentwin)*/
grabwin=focuswin;
}
else
Printf("grabwin=root window\n");
Printf("grabbed 0x%08x\n",(unsigned)grabwin);
return(1);
}
else
{
if(jax->xe.xbutton.button==1 && jax->xe.xbutton.x<MAX_SCALE_W)
{
drawBox(jax,0,0,MAX_SCALE_W,MAX_SCALE_H,grays[0].pixel,grays[2].pixel);
drawBox(jax,1,1,MAX_SCALE_W-2,MAX_SCALE_H-2,grays[0].pixel,grays[2].pixel);
PickWindow(jax);
GrabWindowImage(jax);
}
}
return(save);
}
/******************************************************************************/
int handle_expose(Jax *jax)
{
static Region clip=NULL;
static XRectangle rect;
jax->xe.xany.type=Expose; //force for HS expose handler
if (!clip)
clip=XCreateRegion();
rect.x=jax->xe.xexpose.x;
rect.y=jax->xe.xexpose.y;
rect.width=jax->xe.xexpose.width;
rect.height=jax->xe.xexpose.height;
//printf("Expose %d (%d,%d,%d,%d)\n",jax->xe.xexpose.count,rect.x,rect.y,rect.width,rect.height);
XUnionRectWithRegion(&rect, clip, clip);
if(jax->xe.xexpose.count>0)
return(0);
XSetRegion(jax->d,jax->gc,clip);
XDestroyRegion(clip);
clip=NULL;
JAXsetfg(jax,grays[1].pixel);
JAXfillrectangle(jax,0,0,MAX_SCALE_W+GUI_W,MAX(GUI_H,MAX_SCALE_H));
HSeventhandler(jax);
XPutImage(jax->d,jax->w,jax->gc,scaleimg,0,0,0,0,scaleimg->width,scaleimg->height);
drawBox(jax,0,0,MAX_SCALE_W,MAX_SCALE_H,grays[2].pixel,grays[0].pixel);
drawBox(jax,1,1,MAX_SCALE_W-2,MAX_SCALE_H-2,grays[2].pixel,grays[0].pixel);
XSetClipMask(jax->d,jax->gc,None);
return(0);
}
/******************************************************************************/
/* the first thing called... */
int cfg(int fd)
{
Jax *jax;
pid_t pid;
int i;
changed=0;
save=0;
if((pid=fork()))
{
int status;
waitpid(pid,&status,0);
if(WIFSIGNALED(status))
fprintf(stderr,"Configuration terminated by signal %d\n",WTERMSIG(status));
Printf("cfg:status=%d\n",status);
Printf("cfg:WIFSIGNALED(status)=%d\n",WIFSIGNALED(status));
Printf("cfg:WEXITSTATUS(status)=%d\n",WEXITSTATUS(status));
return(!WIFSIGNALED(status)?WEXITSTATUS(status):0);
}
// Init JAX
jax=JAXinit(NULL,NULL,NULL,NULL);
//Setup Window
JAXcreatewin(jax,
0,0,
MAX_SCALE_W+GUI_W,MAX(MAX_SCALE_H,GUI_H),
"IMWheel Configuration Helper",
"IMWheel Configuration Helper",
0,NULL);
if(!XGetWindowAttributes(jax->d, jax->w, &jax->xwa))
return(0);
jax->xsh->flags=(PMinSize | PMaxSize | PResizeInc);
jax->xsh->min_height=
jax->xsh->max_height=
jax->xsh->height=200;
jax->xsh->min_width=
jax->xsh->max_width=
jax->xsh->width=400;
jax->xsh->width_inc=
jax->xsh->height_inc=0;
JAXuseGeometry(jax,0);
XSetWMProperties(jax->d,jax->w,&jax->wname,&jax->iname,NULL,0,jax->xsh,jax->xwmh,jax->xch);
JAXdefaultGC(jax);
JAXloadqueryfont(jax,FONT);
JAXsetGCfont(jax);
// Setup Colors
for(i=0;i<sizeof(grays)/sizeof(XColor);i++)
XAllocColor(jax->d,jax->cmap,&grays[i]);
// Setup Event Stuff
JAXaddevents(jax,je);
JAXsetEH(jax,JAXeventhandler);
// Grab Root Window
depth=(jax->xwa.depth==24?32:jax->xwa.depth);
scaleimgdata=malloc(MAX_SCALE_W*MAX_SCALE_H*depth/8);
scaleimg=XCreateImage(jax->d,
jax->xwa.visual,
jax->xwa.depth,
ZPixmap,
0,
(char*)scaleimgdata,
MAX_SCALE_W,MAX_SCALE_H,
depth,
depth/8*MAX_SCALE_H);
grabwin=JAXdefaultrootwin(jax);
freeAllX(&xch,NULL,&wname);
wname=windowName(jax->d,grabwin);
XGetClassHint(jax->d,grabwin,&xch);
GrabWindowImage(jax);
//Hotspot *newHS(int x, int y, int w, int h, int state, int type, char* label, handle(), draw())
{
int x,y,h,w,t;
x=MAX_SCALE_W;
h=JAXstringfullheight(jax)+2;
w=JAXstringwidth(jax,"Title: ");
t=JAXstringwidth(jax,"Resource: ");
if(w<t) w=t;
t=JAXstringwidth(jax,"Class: ");
if(w<t) w=t;
name_w=w=w+2;
y=0;
newHS(x,y,w,h,RIGHT,LABEL,"Title: ",NULL,NULL);
y+=h;
newHS(x,y,w,h,RIGHT,LABEL,"Resource: ",NULL,NULL);
y+=h;
newHS(x,y,w,h,RIGHT,LABEL,"Class: ",NULL,NULL);
x+=name_w;
w=GUI_W-name_w;
y=0;
wname_hs=newHS(x,y,w,h,LEFT,LABEL,(wname?wname:".*"),NULL,NULL);
y+=h;
res_hs=newHS(x,y,w,h,LEFT,LABEL,xch.res_name,NULL,NULL);
y+=h;
class_hs=newHS(x,y,w,h,LEFT,LABEL,xch.res_class,NULL,NULL);
y+=h;
x=MAX_SCALE_W;
h=JAXstringfullheight(jax)+4;
w=GUI_W;
// put mouse&modifier stuff here!
newHS(x,y,w,h,REST,BUTTON,"Grab Wheel Action",GrabWheel,NULL);
y+=h;
h=JAXstringfullheight(jax)+2;
for(i=0;y+h<GUI_H-h;i++)
{
grabw_hs=realloc(grabw_hs,sizeof(int)*(numgrabw+1));
grabw_hs[numgrabw]=newHS(x,y,w,h,LEFT,LABEL," ",NULL,NULL);
numgrabw++;
y+=h;
}
x=MAX_SCALE_W;
h=GUI_H-y;
//y=GUI_H-h;
w=GUI_W/2;
newHS(x,y,w,h,REST,BUTTON,"Reload",handle_reload,NULL);
x+=w;
newHS(x,y,w,h,REST,BUTTON,"Cancel",handle_destroy,NULL);
}
// Show Window
JAXmapraised(jax);
// Run config!
JAXeventloop(jax);
// return whether configuration has changed
Printf("cfg(2):changed=%d\n",changed);
exit(changed);
}
/******************************************************************************/
void GrabWindowImage(Jax *jax)
{
int x,y,cx,cy,xx,yy;
double dx,dy;
XImage *grabimg;
XWindowAttributes grabxwa;
XGetWindowAttributes(jax->d,grabwin,&grabxwa);
JAXlowerwin(jax);
XSync(jax->d,False);
usleep(1000);
XSync(jax->d,False);
if(!(grabimg=XGetImage(jax->d, grabwin,
0, 0,
grabxwa.width, grabxwa.height,
AllPlanes, ZPixmap)))
{
fprintf(stderr,"Couldn't grab image of window!\nTry again...\n");
JAXraisewin(jax);
return;
}
//fprintf(stderr,"grabbed %d\n",grabwin);
JAXraisewin(jax);
memset(scaleimgdata,0L,MAX_SCALE_W*MAX_SCALE_H*(jax->xwa.depth/8));
// Precalculation
dx=grabimg->width/((double)scaleimg->width-5);
dy=grabimg->height/((double)scaleimg->height-5);
// keep perspective!
if(dy<1) dy=1;
if(dx<1) dx=1;
if(dx<dy)
dx=dy;
else
dy=dx;
cx=scaleimg->width/2-grabimg->width/dx/2;
cy=scaleimg->height/2-grabimg->height/dy/2;
// Image
for(x=0;x<scaleimg->width;x++)
for(y=0;y<scaleimg->height;y++)
{
if((int)(y*dy)<grabimg->height && (x*dx)<grabimg->width)
{
XPutPixel(scaleimg,
x+cx,y+cy,
XGetPixel(grabimg, (int)(x*dx), (int)(y*dy)));
}
else
{
xx=(x+cx)%scaleimg->width;
yy=(y+cy)%scaleimg->height;
XPutPixel(scaleimg,
xx,yy,
grays[1].pixel);
}
}
XDestroyImage(grabimg);
grabimg=NULL;
jax->xe.xexpose.count=-1;
jax->xe.xexpose.x=0;
jax->xe.xexpose.y=0;
jax->xe.xexpose.width=MAX_SCALE_W;
jax->xe.xexpose.height=MAX_SCALE_H;
handle_expose(jax);
}
/******************************************************************************/
int GrabWheel(Jax *jax,Hotspot *hs)
{
int i,hsi;
XModifierKeymap *xmk=NULL;
char km[32],button;
XEvent e;
Hotspot *hsp;
char *str;
char *wheelstr[]=
{
"Button: Left (Button1)",
"Button: Middle (Button2)",
"Button: Right (Button3)",
"Wheel: Up (Button4)",
"Wheel: Down (Button5)",
"Wheel: Left (Button6)",
"Wheel: Right (Button7)",
"Button: Thumb1 (Button8)",
"Button: Thumb2 (Button9)"
};
if(!useFifo)
{
if(!grabbed)
{
grabButtons(jax->d,0);
Printf("grabbed=%s\n",(grabbed?"True":"False"));
}
}
else
openFifo();
button=0;
if(grabbed || useFifo)
do
{
button=getInput(jax->d,&e,&xmk,km);
if(e.type==ButtonPress)
Printf("> button=%d\n",button);
}
while((grabbed || useFifo) && (button<4 || e.type!=ButtonPress));
Printf("button=%d\n",button);
if(!button)
{
Printf("Invalid button: grabbed=%d useFifo=%d\n",grabbed,useFifo);
return(False);
}
if(!useFifo && grabbed)
ungrabButtons(jax->d,0);
hsp=getHS(grabw_hs[0]);
jax->xe.xexpose.count=-1;
jax->xe.xexpose.x=hsp->x;
jax->xe.xexpose.y=hsp->y;
jax->xe.xexpose.width=hsp->w;
jax->xe.xexpose.height=0;
hsp=getHS(grabw_hs[0]);
if(hsp->label)
free(hsp->label);
if(button<10)
hsp->label=strdup(wheelstr[(int)button-1]);
else
hsp->label=strdup("Unknown Button!");
jax->xe.xexpose.height+=hsp->h;
hsi++;
for(hsi=1,i=0;hsi<numgrabw && i<32*8;i++)
if(getbit(km,i))
{
hsp=getHS(grabw_hs[hsi]);
if(hsp->label)
free(hsp->label);
str=XKeysymToString(XKeycodeToKeysym(jax->d,i,0));
hsp->label=strdup(str?str:"(null)");
jax->xe.xexpose.height+=hsp->h;
hsi++;
}
while(hsi<numgrabw)
{
hsp=getHS(grabw_hs[hsi]);
if(hsp->label)
free(hsp->label);
hsp->label=strdup(" ");
jax->xe.xexpose.height+=hsp->h;
hsi++;
}
handle_expose(jax);
freeAllX(NULL,&xmk,NULL);
return(False);
}
/******************************************************************************/
void PickWindow(Jax *jax)
{
Cursor plus_cursor;
plus_cursor=XCreateFontCursor(jax->d,XC_gumby);
XGrabButton(jax->d,
1,
AnyModifier,
JAXdefaultrootwin(jax),
True,
ButtonPressMask,
GrabModeAsync,GrabModeAsync,
None,
plus_cursor);
grabwin=0;
JAXeventloop(jax);
XUngrabButton(jax->d,
1,
AnyModifier,
JAXdefaultrootwin(jax));
XFreeCursor(jax->d,plus_cursor);
Printf("grabwin=%08x\n",(unsigned)grabwin);
freeAllX(&xch,NULL,&wname);
wname=windowName(jax->d,grabwin);
XGetClassHint(jax->d,grabwin,&xch);
{
int x,y,h,w;
h=JAXstringfullheight(jax)+2;
w=GUI_W-name_w;
x=MAX_SCALE_W+name_w;
y=0;
deleteHS(wname_hs);
Printf("wname=%s\n",wname);
wname_hs=newHS(x,y,w,h,LEFT,LABEL,(wname?wname:".*"),NULL,NULL);
y+=h;
deleteHS(res_hs);
Printf("xch.res_name=%s\n",xch.res_name);
res_hs=newHS(x,y,w,h,LEFT,LABEL,xch.res_name,NULL,NULL);
y+=h;
deleteHS(class_hs);
Printf("xch.res_class=%s\n",xch.res_class);
class_hs=newHS(x,y,w,h,LEFT,LABEL,xch.res_class,NULL,NULL);
jax->xe.xexpose.count=-1;
jax->xe.xexpose.x=x;
jax->xe.xexpose.y=0;
jax->xe.xexpose.width=w;
jax->xe.xexpose.height=y+h;
handle_expose(jax);
}
}
/******************************************************************************/
Hotspot *getHS(int id)
{
int i;
if(!id)
return(NULL);
for(i=0;i<numhs && hs[i].id!=id; i++);
if(i>=numhs)
return(NULL);
return(&hs[i]);
}
/******************************************************************************/
int deleteHS(int id)
{
int i;
if(!id)
return(0);
for(i=0;i<numhs && hs[i].id!=id; i++);
if(i>=numhs)
return(0);
numhs--;
memcpy(&hs[i],&hs[i+1],(numhs-i)*sizeof(Hotspot));
hs=realloc(hs,(numhs)*sizeof(Hotspot));
return(1);
}
/******************************************************************************/
int newHS(int x, int y, int w, int h, int state, int type, char* label,
int (*buttonfunc)(Jax*,Hotspot*),
void (*drawfunc)(Jax*,Hotspot*))
{
hs=realloc(hs,(numhs+1)*sizeof(Hotspot));
hs[numhs].id=hsid++;
hs[numhs].x=x;
hs[numhs].y=y;
hs[numhs].w=w;
hs[numhs].h=h;
hs[numhs].state=state|DIRTY;
hs[numhs].type=type;
// label is malloc'd then copied
if(label)
hs[numhs].label=strdup(label);
else
{
hs[numhs].label=malloc(1);
hs[numhs].label[0]=0;
}
if(buttonfunc)
hs[numhs].buttonfunc=buttonfunc;
else
hs[numhs].buttonfunc=doHS;
if(drawfunc)
hs[numhs].drawfunc=drawfunc;
else
hs[numhs].drawfunc=drawHS;
numhs++;
return(hs[numhs-1].id);
}
/******************************************************************************/
int inHS(Hotspot *h, int x, int y)
{
return(x>=h->x && x<=h->x+h->w &&
y>=h->y && y<=h->y+h->h);
}
/******************************************************************************/
int HSeventhandler(Jax *jax)
{
int i;
for(i=0; i<numhs; i++)
{
Printf("HS event: checking '%s'\n",hs[i].label);
switch(jax->xe.xany.type)
{
case ButtonPress:
if(jax->xe.xbutton.button!=1)
return(0);
if(inHS(&hs[i],jax->xe.xbutton.x, jax->xe.xbutton.y))
{
doHS(jax,&hs[i]);
return(0);
}
break;
case ButtonRelease:
if(jax->xe.xbutton.button!=1)
return(0);
if(inHS(&hs[i],jax->xe.xbutton.x, jax->xe.xbutton.y))
return(doHS(jax,&hs[i]));
else
if(hs[i].state&ACTIVE)
{
doHS(jax,&hs[i]);
return(0);
}
break;
case Expose:
hs[i].state|=DIRTY;
drawHS(jax,&hs[i]);
break;
case MotionNotify:
if(hs[i].state&ACTIVE)
return(doHS(jax,&hs[i]));
break;
}
}
return(0);
}
/******************************************************************************/
int doHS(Jax *jax, Hotspot *h)
{
int err=0;
//printf("doHS: '%s'\n",h->label);
switch(jax->xe.xany.type)
{
case ButtonPress:
switch(h->type)
{
case BUTTON:
h->state=ACTIVE|DIRTY;
break;
default:
break;
}
break;
case MotionNotify:
switch(h->type)
{
case BUTTON:
if(h->state&ACTIVE)
{
if(inHS(h, jax->xe.xbutton.x, jax->xe.xbutton.y))
{
if(h->state&REST)
h->state=DIRTY|ACTIVE;
}
else
{
if(!(h->state&REST))
h->state=DIRTY|ACTIVE|REST;
}
}
break;
default:
break;
}
break;
case ButtonRelease:
switch(h->type)
{
case BUTTON:
if(inHS(h, jax->xe.xbutton.x, jax->xe.xbutton.y))
err=h->buttonfunc(jax,h);
if(!(h->state&REST))
h->state=REST|DIRTY;
else
h->state=REST;
break;
default:
break;
}
break;
default:
printf("pushHS:unknown XEvent type: %d\n",jax->xe.xany.type);
return(0);
}
h->drawfunc(jax,h);
return(err);
}
/******************************************************************************/
void drawBox(Jax *jax, int x,int y,int w,int h,int light,int dark)
{
JAXsetfg(jax,light);
JAXline(jax,x ,y ,x+w-1, y );
JAXline(jax,x ,y ,x, y+h-1 );
JAXsetfg(jax,dark);
JAXline(jax,x+w-1 ,y ,x+w-1, y+h-1 );
JAXline(jax,x ,y+h-1 ,x+w-1, y+h-1 );
}
/******************************************************************************/
void drawHS(Jax *jax, Hotspot *h)
{
Printf("drawHS:(\"%s\")state=%x\n",h->label,h->state);
switch(h->type)
{
case BUTTON:
if(!(h->state&DIRTY))
return;
JAXsetfg(jax,grays[(h->state&REST?1:3)].pixel);
JAXfillrectangle(jax,h->x,h->y,h->w,h->h);
drawBox(jax,h->x,h->y,h->w,h->h,
grays[(h->state&REST?2:0)].pixel,
grays[(h->state&REST?0:2)].pixel);
drawBox(jax,h->x+1,h->y+1,h->w-2,h->h-2,
grays[(h->state&REST?2:0)].pixel,
grays[(h->state&REST?0:2)].pixel);
JAXsetfg(jax,JAXblack(jax));
JAXdrawstring(jax,
h->x+h->w/2-JAXstringwidth(jax,h->label)/2,
h->y+h->h/2+JAXstringfullheight(jax)/2-JAXfontdescent(jax),
h->label);
break;
case LABEL:
JAXsetfg(jax,grays[1].pixel);
JAXfillrectangle(jax,h->x,h->y,h->w,h->h);
JAXsetfg(jax,JAXblack(jax));
h->state&=~DIRTY;
switch(h->state)
{
case CENTER:
Printf("(\"%s\")state=%x CENTER\n",h->label,h->state);
JAXdrawstring(jax,
h->x+h->w/2-JAXstringwidth(jax,h->label)/2,
h->y+h->h/2+JAXstringfullheight(jax)/2-JAXfontdescent(jax),
h->label);
break;
case RIGHT:
Printf("(\"%s\")state=%x RIGHT\n",h->label,h->state);
JAXdrawstring(jax,
h->x+h->w-JAXstringwidth(jax,h->label),
h->y+h->h/2+JAXstringfullheight(jax)/2-JAXfontdescent(jax),
h->label);
break;
case LEFT:
Printf("(\"%s\")state=%x LEFT\n",h->label,h->state);
JAXdrawstring(jax,
h->x,
h->y+h->h/2+JAXstringfullheight(jax)/2-JAXfontdescent(jax),
h->label);
break;
default:
break;
}
}
h->state&=~DIRTY;
}

11
cfg.h Normal file
View File

@ -0,0 +1,11 @@
/* IMWheel Configuration Helper Definitions
* Copylefted under the Linux GNU Public License
* Author : Jonathan Atkins <jcatki@jonatkins.org>
* PLEASE: contact me if you have any improvements, I will gladly code good ones
*/
#ifndef CFG_H
#define CFG_H
#include <X11/X.h>
int cfg(int); /* wheel_fd or -1 */
#endif

121
config.h.in Normal file
View File

@ -0,0 +1,121 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
#undef HAVE_DOPRNT
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define to 1 if you have the `getopt_long_only' function. */
#undef HAVE_GETOPT_LONG_ONLY
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define only if you are building the imwheel version of gpm. */
#undef HAVE_GPM_SRC
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `X11' library (-lX11). */
#undef HAVE_LIBX11
/* Define to 1 if you have the `Xext' library (-lXext). */
#undef HAVE_LIBXEXT
/* Define to 1 if you have the `Xmu' library (-lXmu). */
#undef HAVE_LIBXMU
/* Define to 1 if you have the `Xt' library (-lXt). */
#undef HAVE_LIBXT
/* Define to 1 if you have the `Xtst' library (-lXtst). */
#undef HAVE_LIBXTST
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `regcomp' function. */
#undef HAVE_REGCOMP
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strtol' function. */
#undef HAVE_STRTOL
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `vprintf' function. */
#undef HAVE_VPRINTF
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Where do we want the pid file to go? */
#undef PIDDIR
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Version number of package */
#undef VERSION
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t

8173
configure vendored Executable file

File diff suppressed because it is too large Load Diff

349
configure.in Normal file
View File

@ -0,0 +1,349 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(imwheel.c)
AC_PREREQ(2.13)
AM_INIT_AUTOMAKE(imwheel,1.0.0pre12)
dnl local
Warnings=0
Good=xyes
dnl Get system type
system=`uname -s`
dnl echo system=$system
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_MAKE_SET
dnl AC_PREFIX_PROGRAM(bin/imwheel)
AM_CONFIG_HEADER(config.h)
dnl AC_CONFIG_HEADER(config.h)
dnl Checks for libraries.
dnl there are none here...see the X libraries section below!
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h getopt.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_HEADER_TIME
dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gettimeofday regcomp strdup strtol getopt_long_only)
dnl check that regcomp was found
AC_MSG_CHECKING(that regex functions are available)
if [[ "x$ac_cv_func_regcomp" = "$Good" ]]
then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([regex functions not found, imwheel really needs these!])
fi
dnl ask about PIDDIR
AC_MSG_CHECKING(where the pid file goes)
AC_ARG_WITH(pid-dir,
changequote({, })dnl
{ --with-pid-dir=dir use dir for pid files [/tmp]},
changequote([, ])dnl
[if [[ "x$withval" != "x" ]]
then
PIDDIR="$withval"
else
AC_MSG_ERROR([bad dir supplied for --with-pid-dir])
fi],[PIDDIR="/tmp"])
AC_MSG_RESULT($PIDDIR)
AC_DEFINE_UNQUOTED(PIDDIR,"$PIDDIR",[Where do we want the pid file to go? ])
dnl AC_SUBST(PIDDIR)
dnl ask whether to suid root the imwheel executable on installation
AC_ARG_ENABLE(suid,
changequote({, })dnl
{ --enable-suid=user suid user [default=root] the imwheel executable [no]},
changequote([, ])dnl
[case "$enableval" in
yes) suid=root ;;
no) suid= ;;
*) if [[ "x$enableval" = x ]]
then
suid="root"
else
suid="$enableval"
fi;;
esac],[suid=])
AC_MSG_CHECKING(if we suid imwheel at install)
if [[ "x$suid" = "x" ]]
then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT([yes, $suid])
fi
AC_SUBST(suid)
AM_CONDITIONAL(SUID, test "x$suid" != x)
dnl ask about getopt or detect it
getopt_dist=
AC_MSG_CHECKING(if we use the included getopts)
AC_ARG_WITH(getopt,
changequote({, })dnl
{ --with-getopt use included getopt [guessed]},
changequote([, ])dnl
[case "$withval" in
yes) getopt=getopt ;;
no) getopt= ;;
*) AC_MSG_ERROR([bad value $withval for --with-getopt]) ;;
esac],[getopt=])
if [[ "x$ac_cv_func_getopt_long_only" != "$Good" -o "x$ac_cv_header_getopt_h" != "$Good" ]]
then
getopt=getopt
AC_MSG_RESULT(yes)
else
if [[ "x$getopt" = "xgetopt" ]]
then
AC_MSG_RESULT(forced)
else
AC_MSG_RESULT(no)
getopt_dist=getopt
fi
fi
AC_SUBST(getopt)
if [[ "x$getopt" = "xgetopt" ]]
then
GETOPT_LIBS="-L$srcdir/getopt -lgetopt"
GETOPT_INCS="-I$srcdir/getopt"
else
GETOPT_LIBS=
GETOPT_INCS=
fi
AC_SUBST(GETOPT_LIBS)
AC_SUBST(GETOPT_INCS)
AC_SUBST(getopt_dist)
dnl ask about mdetect
AC_MSG_CHECKING(if we build mdetect)
AC_ARG_ENABLE(mdetect,
changequote({, })dnl
{ --enable-mdetect build mdetect, a ps/2 mouse data detector [no]},
changequote([, ])dnl
[case "$enableval" in
yes) mdetect=mdetect ;;
no) mdetect= ;;
*) AC_MSG_ERROR([bad value $enableval for --enable-mdetect]) ;;
esac
mdetect_dist=],[mdetect=
mdetect_dist=mdetect
])
if [[ "x$mdetect" = "xmdetect" ]]
then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_SUBST(mdetect)
AC_SUBST(mdetect_dist)
dnl ask about mdump
AC_MSG_CHECKING(if we build mdump)
AC_ARG_ENABLE(mdump,
changequote({, })dnl
{ --enable-mdump build mdump, a ps/2 mouse data dumper [no]},
changequote([, ])dnl
[case "$enableval" in
yes) mdump=mdump ;;
no) mdump= ;;
*) AC_MSG_ERROR([bad value $enableval for --enable-mdump]) ;;
esac
mdump_dist=],[mdump=
mdump_dist=mdump.c])
if [[ "x$mdump" = "xmdump" ]]
then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_SUBST(mdump)
AC_SUBST(mdump_dist)
dnl ask about extras
EXTRAS="setimps2 setmmplus getmdt setps2 setps2rate"
EXTRAS_SRC="setimps2.c setmmplus.c getmdt.c setps2.c setps2rate.c"
AC_MSG_CHECKING(if we build extras)
AC_ARG_ENABLE(extras,
changequote({, })dnl
{ --enable-extras build some extra ps/2 mouse debugging utils [no]},
changequote([, ])dnl
[case "$enableval" in
yes) extras=yes ;;
no) extras= ;;
*) AC_MSG_ERROR([bad value $enableval for --enable-extras]) ;;
esac],[extras=])
if [[ "x$extras" = "$Good" ]]
then
AC_MSG_RESULT(yes)
extras="$EXTRAS"
extras_dist=
else
AC_MSG_RESULT(no)
extras_dist="$EXTRAS_SRC"
fi
AC_SUBST(extras)
AC_SUBST(extras_dist)
dnl Check for gpm-imwheel source.
NO_GPM_DOC=
GPM_DIR="gpm-1.19.3"
AC_SUBST(GPM_DIR)
AC_CHECK_FILE($GPM_DIR/gpm.c,HAVE_GPM_SRC=yes,HAVE_GPM_SRC=no)
AC_SUBST(HAVE_GPM_SRC)
AC_MSG_CHECKING(if we build gpm-imwheel)
gpm_enabled=no
gpm_doc=no
gpm_imwheel=$GPM_DIR
AC_ARG_ENABLE(gpm,
changequote({, })dnl
{ --enable-gpm build gpm-imwheel [build if source present]},
changequote([, ])dnl
[case "$enableval" in
yes) gpm_imwheel="$GPM_DIR"
gpm_enabled=yes ;;
no) gpm_imwheel= ;;
*) AC_MSG_ERROR([bad value $enableval for --enable-gpm]) ;;
esac],[gpm_imwheel=])
AC_ARG_ENABLE(gpm_doc,
changequote({, })dnl
{ --enable-gpm-doc build in gpm/doc [build if source present]},
changequote([, ])dnl
[case "$enableval" in
yes) no_gpm_doc=true ;;
no) no_gpm_doc=false ;;
*) AC_MSG_ERROR([bad value $enableval for --enable-gpm-doc]) ;;
esac],[no_gpm_doc=true])
if [[ "x$HAVE_GPM_SRC" = "$Good" ]]
then
if [[ "x$gpm_imwheel" = "x$GPM_DIR" ]]
then
AC_MSG_RESULT(yes)
AC_CONFIG_SUBDIRS(gpm-1.19.3)
AC_DEFINE_UNQUOTED(HAVE_GPM_SRC,1,[Define only if you are building the imwheel version of gpm. ])
AM_CONDITIONAL(NO_GPM_DOC, $no_gpm_doc)
else
AC_MSG_RESULT(no)
AM_CONDITIONAL(NO_GPM_DOC, false)
fi
else
gpm_imwheel=
if [[ "x$gpm_enabled" = "xyes" ]]
then
AC_MSG_RESULT(unable)
AM_CONDITIONAL(NO_GPM_DOC, false)
AC_MSG_WARN([$GPM_DIR building disabled, source not present!])
Warnings=`expr $Warnings + 1`
else
AC_MSG_RESULT(no)
AM_CONDITIONAL(NO_GPM_DOC, false)
fi
fi
gpm_dist="$GPM_DIR"
AC_SUBST(gpm_imwheel)
AC_SUBST(gpm_dist)
dnl Checks for X.
AC_PATH_X
AC_PATH_XTRA
dnl Check for XFree86.
dnl AC_MSG_CHECKING(if we want to check for XFree86)
dnl AC_ARG_ENABLE(check-xfree86,
dnl changequote({, })dnl
dnl { --disable-check-xfree86 don't check the X server vendor [enabled]},
dnl changequote([, ])dnl
dnl [case "$enableval" in
dnl yes) check_xfree86=yes ;;
dnl no) check_xfree86= ;;
dnl *) AC_MSG_ERROR([bad value $enableval for --enable-check-xfree86]) ;;
dnl esac],[check_xfree86=yes])
dnl if [[ "x$check_xfree86" = "$Good" -a "$system" = "Linux" ]]
dnl then
dnl AC_MSG_RESULT(yes)
dnl XPath=$PATH:/usr/X11R6/bin:/var/X11R6/bin:/usr/X11/bin:/var/X11/bin:/usr/openwin/bin:/bin:/usr/bin:/usr/local/bin
dnl AC_CHECK_PROGS(X, X Xwrapper XF86_SVGA XF86_VGA16 Xsun, noX, $XPath)
dnl if [[ "x$X" != "xnoX" ]]
dnl then
dnl AC_MSG_CHECKING(if $X is XFree86)
dnl XFree86="`( PATH=$PATH:$XPath ; $X -version 2>&1 | grep \"XFree86 Version\" | head -1 ) 2>/dev/null | cut -f1 -d ' '`"
dnl dnl echo XFree86=$XFree86
dnl if [[ "x$XFree86" = "xXFree86" ]]
dnl then
dnl AC_MSG_RESULT(yes)
dnl else
dnl AC_MSG_RESULT(no)
dnl AC_MSG_WARN([You are not using XFree86, IMWheel may still work])
dnl AC_MSG_WARN([ provided your Xserver has the XTest extension built])
dnl AC_MSG_WARN([ and you choose you mouse drivers and method of wheel])
dnl AC_MSG_WARN([ input wisely. Other servers may not support the wheel.])
dnl AC_MSG_WARN([ In that case you should use the gpm or jam method of])
dnl AC_MSG_WARN([ input for wheel data to imwheel.])
dnl Warnings=`expr "$Warnings" + 1`
dnl fi
dnl fi
dnl else
dnl AC_MSG_RESULT(no)
dnl fi
dnl Check for X include.
dnl AC_CHECK_HEADERS(X11R6/Xlib.h,, [
dnl AC_MSG_ERROR([IMWheel depends on the X11 include files!])
dnl ])
dnl Checks for X libraries.
LIBS_saved="$LIBS"
LIBS=
AC_CHECK_LIB(X11, XCreateWindow,, [
AC_MSG_ERROR([IMWheel depends on the X11 libraries!])
], $LIBS_saved $X_LIBS)
AC_CHECK_LIB(Xext, XextAddDisplay,,,$LIBS_saved $X_LIBS)
AC_CHECK_LIB(Xt, XtFree,,,$LIBS_saved $X_LIBS)
AC_CHECK_LIB(Xmu, XmuInternAtom,,,$LIBS_saved $X_LIBS)
AC_CHECK_LIB(Xtst, XTestFakeDeviceKeyEvent,, [
AC_MSG_ERROR([IMWheel depends on the XTest extention!])
],$LIBS_saved $X_LIBS)
X_LIBS="$X_LIBS $LIBS"
LIBS="$LIBS_saved"
dnl end with a possible about any warnings...
if [[ "$Warnings" != "0" ]]
then
echo ""
if [[ "$Warnings" != "1" ]]
then
echo "You had $Warnings warnings during configure, imwheel may not compile or run."
else
echo "You had a warning during configure, imwheel may not compile or run, or it may"
echo "have an incomplete package built."
fi
echo ""
fi
dnl final output
AC_OUTPUT(jax/Makefile Makefile mdetect/Makefile getopt/Makefile)

522
depcomp Executable file
View File

@ -0,0 +1,522 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2004-05-31.23
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit 0
;;
-v | --v*)
echo "depcomp $scriptversion"
exit 0
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# Dependencies are output in .lo.d with libtool 1.4.
# With libtool 1.5 they are output both in $dir.libs/$base.o.d
# and in $dir.libs/$base.o.d and $dir$base.o.d. We process the
# latter, because the former will be cleaned when $dir.libs is
# erased.
tmpdepfile1="$dir.libs/$base.lo.d"
tmpdepfile2="$dir$base.o.d"
tmpdepfile3="$dir.libs/$base.d"
"$@" -Wc,-MD
else
tmpdepfile1="$dir$base.o.d"
tmpdepfile2="$dir$base.d"
tmpdepfile3="$dir$base.d"
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1"
elif test -f "$tmpdepfile2"; then
tmpdepfile="$tmpdepfile2"
else
tmpdepfile="$tmpdepfile3"
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

50
getmdt.c Normal file
View File

@ -0,0 +1,50 @@
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <time.h>
#include <termios.h>
char readps2(int fd)
{
char ch;
while(read(fd,&ch,1) && (ch==(char)0xfa || ch==(char)0xaa))
{
printf("<%02X>",ch&0xff);
fflush(stdout);
}
return(ch);
}
int main(int argc, char **argv)
{
int fd;
char ch,
getdevtype=0xf2,
disabledev=0xf5,
setimps2[6]={0xf3,200,0xf3,100,0xf3,80},
setupmore[7]={0xf6,0xe6,0xf4,0xf3,100,0xe8,3},
resetps2=0xff;
if(argc>1)
fd=open(argv[1],O_RDWR);
else
fd=open("/dev/mouse",O_RDWR);
tcflush(fd, TCIFLUSH);
write(fd,&getdevtype,1);
sleep(1);
ch=readps2(fd);
printf("device type=%02X(%4d)\n",ch&0xff,ch);
close(fd);
return(0);
}

5
getopt/Makefile.am Normal file
View File

@ -0,0 +1,5 @@
AM_CFLAGS=-O6 -s -Wall
noinst_LIBRARIES=libgetopt.a
libgetopt_a_SOURCES=getopt.c getopt1.c getopt.h
EXTRA_DIST=Makefile.unix

398
getopt/Makefile.in Normal file
View File

@ -0,0 +1,398 @@
# Makefile.in generated by automake 1.9 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
SOURCES = $(libgetopt_a_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = getopt
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
AR = ar
ARFLAGS = cru
libgetopt_a_AR = $(AR) $(ARFLAGS)
libgetopt_a_LIBADD =
am_libgetopt_a_OBJECTS = getopt.$(OBJEXT) getopt1.$(OBJEXT)
libgetopt_a_OBJECTS = $(am_libgetopt_a_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libgetopt_a_SOURCES)
DIST_SOURCES = $(libgetopt_a_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GETOPT_INCS = @GETOPT_INCS@
GETOPT_LIBS = @GETOPT_LIBS@
GPM_DIR = @GPM_DIR@
HAVE_GPM_SRC = @HAVE_GPM_SRC@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
NO_GPM_DOC_FALSE = @NO_GPM_DOC_FALSE@
NO_GPM_DOC_TRUE = @NO_GPM_DOC_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SUID_FALSE = @SUID_FALSE@
SUID_TRUE = @SUID_TRUE@
VERSION = @VERSION@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
extras = @extras@
extras_dist = @extras_dist@
getopt = @getopt@
getopt_dist = @getopt_dist@
gpm_dist = @gpm_dist@
gpm_imwheel = @gpm_imwheel@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mdetect = @mdetect@
mdetect_dist = @mdetect_dist@
mdump = @mdump@
mdump_dist = @mdump_dist@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
suid = @suid@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
AM_CFLAGS = -O6 -s -Wall
noinst_LIBRARIES = libgetopt.a
libgetopt_a_SOURCES = getopt.c getopt1.c getopt.h
EXTRA_DIST = Makefile.unix
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu getopt/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu getopt/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libgetopt.a: $(libgetopt_a_OBJECTS) $(libgetopt_a_DEPENDENCIES)
-rm -f libgetopt.a
$(libgetopt_a_AR) libgetopt.a $(libgetopt_a_OBJECTS) $(libgetopt_a_LIBADD)
$(RANLIB) libgetopt.a
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LIBRARIES)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

765
getopt/getopt.c Normal file
View File

@ -0,0 +1,765 @@
/* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
before changing it!
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
Ditto for AIX 3.2 and <stdlib.h>. */
#ifndef _NO_PROTO
#define _NO_PROTO
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#if !defined (__STDC__) || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
#ifndef const
#define const
#endif
#endif
#include <stdio.h>
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
#include <stdlib.h>
#endif /* GNU C library. */
#ifndef _
/* This is for other GNU distributions with internationalized messages.
When compiling libc, the _ macro is predefined. */
#ifdef HAVE_LIBINTL_H
# include <libintl.h>
# define _(msgid) gettext (msgid)
#else
# define _(msgid) (msgid)
#endif
#endif
/* This version of `getopt' appears to the caller like standard Unix `getopt'
but it behaves differently for the user, since it allows the user
to intersperse the options with the other arguments.
As `getopt' works, it permutes the elements of ARGV so that,
when it is done, all the options precede everything else. Thus
all application programs are extended to handle flexible argument order.
Setting the environment variable POSIXLY_CORRECT disables permutation.
Then the behavior is completely standard.
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
#include "getopt.h"
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
char *optarg = NULL;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns EOF, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
/* XXX 1003.2 says this must be 1 before any call. */
int optind = 0;
/* The next char to be scanned in the option-element
in which the last option character we returned was found.
This allows us to pick up the scan where we left off.
If this is zero, or a null string, it means resume the scan
by advancing to the next ARGV-element. */
static char *nextchar;
/* Callers store zero here to inhibit the error message
for unrecognized options. */
int opterr = 1;
/* Set to an option character which was unrecognized.
This must be initialized on some systems to avoid linking in the
system's own getopt implementation. */
int optopt = '?';
/* Describe how to deal with options that follow non-option ARGV-elements.
If the caller did not specify anything,
the default is REQUIRE_ORDER if the environment variable
POSIXLY_CORRECT is defined, PERMUTE otherwise.
REQUIRE_ORDER means don't recognize them as options;
stop option processing when the first non-option is seen.
This is what Unix does.
This mode of operation is selected by either setting the environment
variable POSIXLY_CORRECT, or using `+' as the first character
of the list of option characters.
PERMUTE is the default. We permute the contents of ARGV as we scan,
so that eventually all the non-options are at the end. This allows options
to be given in any order, even with programs that were not written to
expect this.
RETURN_IN_ORDER is an option available to programs that were written
to expect options and other ARGV-elements in any order and that care about
the ordering of the two. We describe each non-option ARGV-element
as if it were the argument of an option with character code 1.
Using `-' as the first character of the list of option characters
selects this mode of operation.
The special argument `--' forces an end of option-scanning regardless
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
`--' can cause `getopt' to return EOF with `optind' != ARGC. */
static enum
{
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
} ordering;
/* Value of POSIXLY_CORRECT environment variable. */
static char *posixly_correct;
#ifdef __GNU_LIBRARY__
/* We want to avoid inclusion of string.h with non-GNU libraries
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
in GCC. */
#include <string.h>
#define my_index strchr
#else
/* Avoid depending on library functions or files
whose names are inconsistent. */
char *getenv ();
static char *
my_index (str, chr)
const char *str;
int chr;
{
while (*str)
{
if (*str == chr)
return (char *) str;
str++;
}
return 0;
}
/* If using GCC, we can safely declare strlen this way.
If not using GCC, it is ok not to declare it. */
#ifdef __GNUC__
/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
That was relevant to code that was here before. */
#if !defined (__STDC__) || !__STDC__
/* gcc with -traditional declares the built-in strlen to return int,
and has done so at least since version 2.4.5. -- rms. */
extern int strlen (const char *);
#endif /* not __STDC__ */
#endif /* __GNUC__ */
#endif /* not __GNU_LIBRARY__ */
/* Handle permutation of arguments. */
/* Describe the part of ARGV that contains non-options that have
been skipped. `first_nonopt' is the index in ARGV of the first of them;
`last_nonopt' is the index after the last of them. */
static int first_nonopt;
static int last_nonopt;
/* Exchange two adjacent subsequences of ARGV.
One subsequence is elements [first_nonopt,last_nonopt)
which contains all the non-options that have been skipped so far.
The other is elements [last_nonopt,optind), which contains all
the options processed since those non-options were skipped.
`first_nonopt' and `last_nonopt' are relocated so that they describe
the new indices of the non-options in ARGV after they are moved. */
static void
exchange (argv)
char **argv;
{
int bottom = first_nonopt;
int middle = last_nonopt;
int top = optind;
char *tem;
/* Exchange the shorter segment with the far end of the longer segment.
That puts the shorter segment into the right place.
It leaves the longer segment in the right place overall,
but it consists of two parts that need to be swapped next. */
while (top > middle && middle > bottom)
{
if (top - middle > middle - bottom)
{
/* Bottom segment is the short one. */
int len = middle - bottom;
register int i;
/* Swap it with the top part of the top segment. */
for (i = 0; i < len; i++)
{
tem = argv[bottom + i];
argv[bottom + i] = argv[top - (middle - bottom) + i];
argv[top - (middle - bottom) + i] = tem;
}
/* Exclude the moved bottom segment from further swapping. */
top -= len;
}
else
{
/* Top segment is the short one. */
int len = top - middle;
register int i;
/* Swap it with the bottom part of the bottom segment. */
for (i = 0; i < len; i++)
{
tem = argv[bottom + i];
argv[bottom + i] = argv[middle + i];
argv[middle + i] = tem;
}
/* Exclude the moved top segment from further swapping. */
bottom += len;
}
}
/* Update records for the slots the non-options now occupy. */
first_nonopt += (optind - last_nonopt);
last_nonopt = optind;
}
/* Initialize the internal data when the first call is made. */
static const char *
_getopt_initialize (optstring)
const char *optstring;
{
/* Start processing options with ARGV-element 1 (since ARGV-element 0
is the program name); the sequence of previously skipped
non-option ARGV-elements is empty. */
first_nonopt = last_nonopt = optind = 1;
nextchar = NULL;
posixly_correct = getenv ("POSIXLY_CORRECT");
/* Determine how to handle the ordering of options and nonoptions. */
if (optstring[0] == '-')
{
ordering = RETURN_IN_ORDER;
++optstring;
}
else if (optstring[0] == '+')
{
ordering = REQUIRE_ORDER;
++optstring;
}
else if (posixly_correct != NULL)
ordering = REQUIRE_ORDER;
else
ordering = PERMUTE;
return optstring;
}
/* Scan elements of ARGV (whose length is ARGC) for option characters
given in OPTSTRING.
If an element of ARGV starts with '-', and is not exactly "-" or "--",
then it is an option element. The characters of this element
(aside from the initial '-') are option characters. If `getopt'
is called repeatedly, it returns successively each of the option characters
from each of the option elements.
If `getopt' finds another option character, it returns that character,
updating `optind' and `nextchar' so that the next call to `getopt' can
resume the scan with the following option character or ARGV-element.
If there are no more option characters, `getopt' returns `EOF'.
Then `optind' is the index in ARGV of the first ARGV-element
that is not an option. (The ARGV-elements have been permuted
so that those that are not options now come last.)
OPTSTRING is a string containing the legitimate option characters.
If an option character is seen that is not listed in OPTSTRING,
return '?' after printing an error message. If you set `opterr' to
zero, the error message is suppressed but we still return '?'.
If a char in OPTSTRING is followed by a colon, that means it wants an arg,
so the following text in the same ARGV-element, or the text of the following
ARGV-element, is returned in `optarg'. Two colons mean an option that
wants an optional arg; if there is text in the current ARGV-element,
it is returned in `optarg', otherwise `optarg' is set to zero.
If OPTSTRING starts with `-' or `+', it requests different methods of
handling the non-option ARGV-elements.
See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
Long-named options begin with `--' instead of `-'.
Their names may be abbreviated as long as the abbreviation is unique
or is an exact match for some defined option. If they have an
argument, it follows the option name in the same ARGV-element, separated
from the option name by a `=', or else the in next ARGV-element.
When `getopt' finds a long-named option, it returns 0 if that option's
`flag' field is nonzero, the value of the option's `val' field
if the `flag' field is zero.
The elements of ARGV aren't really const, because we permute them.
But we pretend they're const in the prototype to be compatible
with other systems.
LONGOPTS is a vector of `struct option' terminated by an
element containing a name which is zero.
LONGIND returns the index in LONGOPT of the long-named option found.
It is only valid when a long-named option has been found by the most
recent call.
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
long-named options. */
int
_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
int argc;
char *const *argv;
const char *optstring;
const struct option *longopts;
int *longind;
int long_only;
{
optarg = NULL;
if (optind == 0)
{
optstring = _getopt_initialize (optstring);
optind = 1; /* Don't scan ARGV[0], the program name. */
}
if (nextchar == NULL || *nextchar == '\0')
{
/* Advance to the next ARGV-element. */
if (ordering == PERMUTE)
{
/* If we have just processed some options following some non-options,
exchange them so that the options come first. */
if (first_nonopt != last_nonopt && last_nonopt != optind)
exchange ((char **) argv);
else if (last_nonopt != optind)
first_nonopt = optind;
/* Skip any additional non-options
and extend the range of non-options previously skipped. */
while (optind < argc
&& (argv[optind][0] != '-' || argv[optind][1] == '\0'))
optind++;
last_nonopt = optind;
}
/* The special ARGV-element `--' means premature end of options.
Skip it like a null option,
then exchange with previous non-options as if it were an option,
then skip everything else like a non-option. */
if (optind != argc && !strcmp (argv[optind], "--"))
{
optind++;
if (first_nonopt != last_nonopt && last_nonopt != optind)
exchange ((char **) argv);
else if (first_nonopt == last_nonopt)
first_nonopt = optind;
last_nonopt = argc;
optind = argc;
}
/* If we have done all the ARGV-elements, stop the scan
and back over any non-options that we skipped and permuted. */
if (optind == argc)
{
/* Set the next-arg-index to point at the non-options
that we previously skipped, so the caller will digest them. */
if (first_nonopt != last_nonopt)
optind = first_nonopt;
return EOF;
}
/* If we have come to a non-option and did not permute it,
either stop the scan or describe it to the caller and pass it by. */
if ((argv[optind][0] != '-' || argv[optind][1] == '\0'))
{
if (ordering == REQUIRE_ORDER)
return EOF;
optarg = argv[optind++];
return 1;
}
/* We have found another option-ARGV-element.
Skip the initial punctuation. */
nextchar = (argv[optind] + 1
+ (longopts != NULL && argv[optind][1] == '-'));
}
/* Decode the current option-ARGV-element. */
/* Check whether the ARGV-element is a long option.
If long_only and the ARGV-element has the form "-f", where f is
a valid short option, don't consider it an abbreviated form of
a long option that starts with f. Otherwise there would be no
way to give the -f short option.
On the other hand, if there's a long option "fubar" and
the ARGV-element is "-fu", do consider that an abbreviation of
the long option, just like "--fu", and not "-f" with arg "u".
This distinction seems to be the most useful approach. */
if (longopts != NULL
&& (argv[optind][1] == '-'
|| (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
{
char *nameend;
const struct option *p;
const struct option *pfound = NULL;
int exact = 0;
int ambig = 0;
int indfound;
int option_index;
for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
/* Do nothing. */ ;
/* Test all long options for either exact match
or abbreviated matches. */
for (p = longopts, option_index = 0; p->name; p++, option_index++)
if (!strncmp (p->name, nextchar, nameend - nextchar))
{
if (nameend - nextchar == strlen (p->name))
{
/* Exact match found. */
pfound = p;
indfound = option_index;
exact = 1;
break;
}
else if (pfound == NULL)
{
/* First nonexact match found. */
pfound = p;
indfound = option_index;
}
else
/* Second or later nonexact match found. */
ambig = 1;
}
if (ambig && !exact)
{
if (opterr)
fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
argv[0], argv[optind]);
nextchar += strlen (nextchar);
optind++;
return '?';
}
if (pfound != NULL)
{
option_index = indfound;
optind++;
if (*nameend)
{
/* Don't test has_arg with >, because some C compilers don't
allow it to be used on enums. */
if (pfound->has_arg)
optarg = nameend + 1;
else
{
if (opterr)
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
_("%s: option `--%s' doesn't allow an argument\n"),
argv[0], pfound->name);
else
/* +option or -option */
fprintf (stderr,
_("%s: option `%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0], pfound->name);
nextchar += strlen (nextchar);
return '?';
}
}
else if (pfound->has_arg == 1)
{
if (optind < argc)
optarg = argv[optind++];
else
{
if (opterr)
fprintf (stderr,
_("%s: option `%s' requires an argument\n"),
argv[0], argv[optind - 1]);
nextchar += strlen (nextchar);
return optstring[0] == ':' ? ':' : '?';
}
}
nextchar += strlen (nextchar);
if (longind != NULL)
*longind = option_index;
if (pfound->flag)
{
*(pfound->flag) = pfound->val;
return 0;
}
return pfound->val;
}
/* Can't find it as a long option. If this is not getopt_long_only,
or the option starts with '--' or is not a valid short
option, then it's an error.
Otherwise interpret it as a short option. */
if (!long_only || argv[optind][1] == '-'
|| my_index (optstring, *nextchar) == NULL)
{
if (opterr)
{
if (argv[optind][1] == '-')
/* --option */
fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
argv[0], nextchar);
else
/* +option or -option */
fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
argv[0], argv[optind][0], nextchar);
}
nextchar = (char *) "";
optind++;
return '?';
}
}
/* Look at and handle the next short option-character. */
{
char c = *nextchar++;
char *temp = my_index (optstring, c);
/* Increment `optind' when we start to process its last character. */
if (*nextchar == '\0')
++optind;
if (temp == NULL || c == ':')
{
if (opterr)
{
if (posixly_correct)
/* 1003.2 specifies the format of this message. */
fprintf (stderr, _("%s: illegal option -- %c\n"),
argv[0], c);
else
fprintf (stderr, _("%s: invalid option -- %c\n"),
argv[0], c);
}
optopt = c;
return '?';
}
if (temp[1] == ':')
{
if (temp[2] == ':')
{
/* This is an option that accepts an argument optionally. */
if (*nextchar != '\0')
{
optarg = nextchar;
optind++;
}
else
optarg = NULL;
nextchar = NULL;
}
else
{
/* This is an option that requires an argument. */
if (*nextchar != '\0')
{
optarg = nextchar;
/* If we end this ARGV-element by taking the rest as an arg,
we must advance to the next element now. */
optind++;
}
else if (optind == argc)
{
if (opterr)
{
/* 1003.2 specifies the format of this message. */
fprintf (stderr,
_("%s: option requires an argument -- %c\n"),
argv[0], c);
}
optopt = c;
if (optstring[0] == ':')
c = ':';
else
c = '?';
}
else
/* We already incremented `optind' once;
increment it again when taking next ARGV-elt as argument. */
optarg = argv[optind++];
nextchar = NULL;
}
}
return c;
}
}
int
getopt (argc, argv, optstring)
int argc;
char *const *argv;
const char *optstring;
{
return _getopt_internal (argc, argv, optstring,
(const struct option *) 0,
(int *) 0,
0);
}
#endif /* _LIBC or not __GNU_LIBRARY__. */
#ifdef TEST
/* Compile with -DTEST to make an executable for use in testing
the above definition of `getopt'. */
int
main (argc, argv)
int argc;
char **argv;
{
int c;
int digit_optind = 0;
while (1)
{
int this_option_optind = optind ? optind : 1;
c = getopt (argc, argv, "abc:d:0123456789");
if (c == EOF)
break;
switch (c)
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf ("digits occur in two different argv-elements.\n");
digit_optind = this_option_optind;
printf ("option %c\n", c);
break;
case 'a':
printf ("option a\n");
break;
case 'b':
printf ("option b\n");
break;
case 'c':
printf ("option c with value `%s'\n", optarg);
break;
case '?':
break;
default:
printf ("?? getopt returned character code 0%o ??\n", c);
}
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
printf ("%s ", argv[optind++]);
printf ("\n");
}
exit (0);
}
#endif /* TEST */

129
getopt/getopt.h Normal file
View File

@ -0,0 +1,129 @@
/* Declarations for getopt.
Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _GETOPT_H
#define _GETOPT_H 1
#ifdef __cplusplus
extern "C" {
#endif
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns EOF, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
struct option
{
#if defined (__STDC__) && __STDC__
const char *name;
#else
char *name;
#endif
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct option'. */
#define no_argument 0
#define required_argument 1
#define optional_argument 2
#if defined (__STDC__) && __STDC__
#ifdef __GNU_LIBRARY__
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
extern int getopt ();
#endif /* __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
extern int getopt_long_only (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind);
/* Internal only. Users should not call this directly. */
extern int _getopt_internal (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind,
int long_only);
#else /* not __STDC__ */
extern int getopt ();
extern int getopt_long ();
extern int getopt_long_only ();
extern int _getopt_internal ();
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _GETOPT_H */

180
getopt/getopt1.c Normal file
View File

@ -0,0 +1,180 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "getopt.h"
#if !defined (__STDC__) || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
#ifndef const
#define const
#endif
#endif
#include <stdio.h>
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
#include <stdlib.h>
#else
char *getenv ();
#endif
#ifndef NULL
#define NULL 0
#endif
int
getopt_long (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
}
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
If an option that starts with '-' (not '--') doesn't match a long option,
but does match a short option, it is parsed as a short option
instead. */
int
getopt_long_only (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
}
#endif /* _LIBC or not __GNU_LIBRARY__. */
#ifdef TEST
#include <stdio.h>
int
main (argc, argv)
int argc;
char **argv;
{
int c;
int digit_optind = 0;
while (1)
{
int this_option_optind = optind ? optind : 1;
int option_index = 0;
static struct option long_options[] =
{
{"add", 1, 0, 0},
{"append", 0, 0, 0},
{"delete", 1, 0, 0},
{"verbose", 0, 0, 0},
{"create", 0, 0, 0},
{"file", 1, 0, 0},
{0, 0, 0, 0}
};
c = getopt_long (argc, argv, "abc:d:0123456789",
long_options, &option_index);
if (c == EOF)
break;
switch (c)
{
case 0:
printf ("option %s", long_options[option_index].name);
if (optarg)
printf (" with arg %s", optarg);
printf ("\n");
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf ("digits occur in two different argv-elements.\n");
digit_optind = this_option_optind;
printf ("option %c\n", c);
break;
case 'a':
printf ("option a\n");
break;
case 'b':
printf ("option b\n");
break;
case 'c':
printf ("option c with value `%s'\n", optarg);
break;
case 'd':
printf ("option d with value `%s'\n", optarg);
break;
case '?':
break;
default:
printf ("?? getopt returned character code 0%o ??\n", c);
}
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
printf ("%s ", argv[optind++]);
printf ("\n");
}
exit (0);
}
#endif /* TEST */

720
imwheel.1 Normal file
View File

@ -0,0 +1,720 @@
.TH IMWheel 1 "September 8 2002" "Version 1.0.0"
.UC 1
.SH "NAME"
imwheel \- a mouse wheel and stick interpreter for X Windows
.SH "SYNOPSIS"
\fBimwheel\fP [ \fIoptions\fP ]
.br
.SH "DESCRIPTION"
\fIIMWheel\fP is a universal mouse wheel and mouse stick translator for the X
Windows System. Using either a special version of gpm and it's /dev/gpmwheel
FIFO, or the support for a ZAxis on the mouse built into some servers, such as
XFree86. Utilizing the input from gpm or X Windows, imwheel translates mouse
wheel and mouse stick actions into keyboard events using the XTest extension to
X. Use \fIxdpyinfo\fP for information on the supported extensions in your X
server.
.LP
.SH "COMMAND LINE OPTIONS"
Available command line options are as follows:
.TP
\fB-4, --flip-buttons\fP
Flips the mouse buttons so that 4 is 5 and 5 is 4, reversing
the Up and Down actions. This would make 4 buttons somewhat useful!
This is the similar to using "-b 54678", see the \fB-b\fP option.
See also xmodmap(1).
.TP
\fB-b, --buttons\fP \fIbutton-spec\fP
Remap buttons in \fIbutton-spec\fP to interpreted wheel/thumb input.
Also limits the button grab to the specified buttons when using the ZAxis method.
(see "X WINDOWS ZAXIS METHOD" below)
the \fIbutton-spec\fP may specify any of up to five buttons.
the \fIbutton-spec\fP is decoded in the following order for wheel input:
.RS
.RS
.nf
Index Interpreted As Button Number
.br
1 Wheel Up 4
.br
2 Wheel Down 5
.br
3 Wheel Left 6
.br
4 Wheel Right 7
.br
5 Thumb Button 1 8
.br
6 Thumb Button 2 9
.fi
.RE
A \fIbutton-spec\fP of "45" will limit the grabbed buttons for only wheel up and down.
.br
A \fIbutton-spec\fP of "67" may be useful to use actual buttons 6 and 7 as wheel up
and down, and limit the grab to only those two buttons.
.br
A \fIbutton-spec\fP of "0" turns off any defined mapping, thus allowing for skips in
the \fIbutton-spec\fP for something that doesn't exist on your mouse.
.br
A \fIbutton-spec\fP of "45006" may be for normal wheel up/down and a thumb button 1, but
no horizontal wheel axis.
.br
The default \fIbutton-spec\fP is "456789".
.br
See also xmodmap(1).
.RE
.TP
\fB-c, --config\fP
Popup to configuration helper window imediately.
.br
See also \fBCONFIGURATION HELPER\fP
.TP
\fB-D, --debug\fP
Show all possible debug info while running. This spits out alot and I also
suggest using the \fB-d\fP option to prevent imwheel from detaching from the
controlling terminal.
.TP
\fB-d, --detach\fP
Actually this does the opposite of it's name, it prevents detachment from the
controlling terminal. (no daemon...) Control-C stops, etc...
.TP
\fB-f, --focus\fP
Forces the X event subwindow to be used instead of the original hack that would
replace the subwindow in the X event with a probed focus query (XGetInputFocus).
This should fix some compatability problems with some window managers, such as
window maker, and perhaps enlightenment. If nothing seems to be working right,
try toggling this on or off...
.TP
\fB-g, --focus-events\fP
Disable the use of focus events for button grabs. If your \fB@Excluded\fP windows
are not regrabbing the mouse buttons when exited, try toggling this on or off...
.TP
\fB-h, --help\fP
Short help on options plus version/author info.
.TP
\fB-k, --kill\fP
Attempts to kill old imwheel (useful only for \fB--wheel-fifo\fP method.)
Pidfile must be created for this to work (no \fB-p\fP or \fB--pid\fP option on
the previous imwheel invocation). Process IDs are
tested using /proc/${pid}/status Name: field ?= imwheel.
If /proc is not mounted then this fails everytime!
Otherwise, this ensures that the wrong process is not killed.
.TP
\fB-p, --pid\fP
Don't write a pid file for gpmwheel FIFO method. This is the only
method that uses the pid file. XGrab doesn't need it, so it just
issues a warning about starting multiple imwheels on the same
display. Some people really prefer this, especially when they are
not using a SUID root imwheel executable.
.TP
\fB-q, --quit\fP
Quit imwheel before entering event loop. Usful in killing an
imwheel running in gpmwheel FIFO mode after exiting XWindows,
if you're using pid files that is.
.br
Example: `imwheel -k -q' = kill and quit (option order doesn't matter)
.TP
\fB-s, --sensitivity\fP \fIsum-min\fP
(Stick mice, Wheel FIFO method only)
.br
like \fB-t\fP only this sets a minimum total amount of movment of the
stick or marble, before any action is taken. This works good
with the Marble type devices.
This should be a multiple of the threshhold as given by the \fB-t\fP option.
The default is 0, meaning that there is no sensitivity testing,
all input spawns an event.
See the \fB-t\fP option also.
(see "STICK SENSITIVITY SETTINGS" below)
.TP
\fB-t, --threshhold\fP \fIminimum-pressure\fP
Used with gpm only and then only with recognized stick mice.
stick mice send a pressure value ranging from 0(no pressure) to
7(hard push). This sets the minimum required pressure for
input to be registered. Setting it to zero will cause realtime sticking,
which is usually too much action for X to keep up. (max rate i saw was
100 events a second!). Once input is registered, it is summed up per axis,
and then it must equal or exceed the sensitivity setting to pass as an input.
See the \fB-s\fP option also, for sensitivity.
.br
The default is 2, to avoid slight presses on the 90-degree direction of the
intended while still getting to the intended direction. Setting this to 7 is
insane, because it requires the user to push as hard as possible everytime they
want something to happen! However it may not be so insane for people using
trackballs for input, as they may spin much faster per sample...
.br
(see "STICK SENSITIVITY SETTINGS" below)
.TP
\fB-W, --wheel-fifo\fP \fIfifo\fP
Use the gpm/jamd wheel fifo instead of XGrabMouse. See \fBGPM/JAMD WHEEL FIFO METHOD\fP
section. This method allows only one X display to be used. This is required
for the gpm method to work. This method only works with the imwheel version
of gpm and with jamd. To find out if you are running the imwheel version of gpm
use the following command and look for "(imwheel)" in the title:
.RS
.RS
.nf
gpm -v
.fi
.RE
\fIfifo\fP names the named pipe (FIFO) created by gpm. It defaults to
"/dev/gpmwheel" (for \fB--wheel-fifo\fP only). The FIFO must exist before
running imwheel in this mode. using jamd requires you to name the correct fifo
because it doesn't use /dev/gpmwheel, but rather one of the /dev/jam_imwheel:0.0
named fifos created by jamd's imwheel module.
.br
\fB@Exclude\fP commands in the rc file are unused in this mode.
.RE
.TP
\fB-X, --display\fP \fIdisplay\fP
Use XServer at a specified \fIdisplay\fP in standard X form.
Using this option is usful for multiple displays in the X Window ZAxis Method.
.TP
\fB-x, --transpose\fP
This swaps the X and Y axis of movement for stick input from a wheel-fifo.
.LP
.SH "X WINDOWS ZAXIS METHOD"
This method is the only method that works with multiple X displays, using
multiple imwheels. Use multiple imwheels by either setting the DISPLAY
environment variable before running each imwheel, or use the \fB-X\fP or
\fB--display\fP options to specify a different display for each imwheel.
Running multiple imwheels on the same display is not recommended, but is
allowed, and may cause strange things to happen while using the stick or wheel.
.LP
Edit the XF86Config and add/edit the following lines in the
"Pointer"(XFree86 3.3) or
"InputDevice"(XFree86 4.x)
section:
.LP
1 axis (vertical wheel):
.RS
.nf
(XFree86 3.3)
.RS
Buttons 5
ZAxisMapping 4 5
.RE
(XFree86 4.x)
.RS
Option "Buttons" "5"
Option "ZAxisMapping" "4 5"
.RE
.fi
.RE
.LP
2 axis (1 stick or 2 perpendicular wheels):
.RS
.nf
(XFree86 3.3)
.RS
Buttons 7
ZAxisMapping 4 5 6 7
.RE
(XFree86 4.x)
.RS
Option "Buttons" "7"
Option "ZAxisMapping" "4 5 6 7"
.RE
.fi
.RE
.LP
The Buttons option may be greater than stated above if you have thumb
buttons, or other extras that qualify as buttons.
.LP
Make sure your Protocol is set to either "IMPS/2" for a PS/2 mouse
or for serial mice set it to "IntelliMouse" or "Auto".
This is for IntelliMouse compatible mice, other protocols may be required for other mice.
Then while running X Windows run imwheel \fIwithout\fP the \fB--wheel-fifo\fP
or \fB-W\fP options.
.LP
.B NOTE
.br
The \fB@Exclude\fP command must be used for clients that either use the ZAxis
for themselves and have no keyboard translations to cause the same desired
effect. The \fB@Exclude\fP command must also be added for any client requiring
mouse and/or mouse button grabs and that don't specify specific buttons to
grab. These clients fail when they try to grab the mouse because the buttons 4
and 5 are already grabbed by imwheel. XV is an example of a client that
requires these types of grabs to succeed. KDE clients use the ZAxis for their
own purposes. The supplied imwheelrc included and exclusion for XV already.
See the IMWheelRC section for more information.
.LP
Also pid files are not used for this method. Thus the \fB-p\fP and \fB--pid\fP
options have no effect, and are ignored.
.LP
.SH "GPM/JAMD WHEEL FIFO METHOD"
This method is REQUIRED for any X Windows server without wheel
mouse support built in. This method will currently support mice as supported
through gpm or jamd.
.LP
In the Pointer section of your XF86Config (or the equivalent configuration file
for your X server) change your mouse Protocol to be "MouseSystems"
(or the equivelant...), also change the Device file that the mouse is read from
to "/dev/gpmdata", then restart X Windows if it is running.
jamd will replicate to /dev/jam_ps2:0.0 or some other devices as well,
make sure to use the right X Mouse protocol in this case,
like the jamd_ps2 device is X mouse protocol PS/2,
and the jamd_imps2 device is X mouse protocol IMPS/2.
.LP
Before starting X Windows (re)start gpm with the \fB-W\fP option. Make sure
you are using a supported wheel or stick mouse as stated in the gpm man page.
.LP
After starting X Windows run imwheel as follows adding options as desired:
.LP
for gpm you can use the following option to imwheel
.LP
\fB--wheel-fifo\fP
.LP
jamd requires you specify the fifo name as one of the /dev/jamd_imwheel:0.0
named fifos. Run
.LP
\fBls -al /dev/jam_imwheel*\fP
.LP
to see what is available.
In this example I would use
.LP
\fB-W /dev/jam_imwheel:0.0\fP
.LP
as the option to imwheel.
.LP
I usually add the \fB-k\fP option to kill off any old imwheel processes left
over, as imwheel doesn't exit with the server, but rather it will only die if a
wheel or stick action occurs when an X server is not connected, such as when X
is dead or the DISPLAY environment variable is setup wrong, or the \fB-X\fP or
\fB--display\fP variables connected imwheel to a now defunct X server.
.LP
gpm or jamd, and/or imwheel can be restarted at any time, imwheel can sense when
gpm of jamd is not there, and gpm nor jamd doesn't give a hoot about imwheel
being up or not.
.LP
.B NOTE
.br
The @Exclude command has no bearing in this method, it is ignored. No Focus
change events are received in this method. Thus KDE and other clients that
support X based wheel events through the ZAxis are not going to work except
through normal imwheel keypress translation of wheel and stick actions.
.br
XV will function fine, as will any client that grabs the mouse and/or mouse
buttons. This mode doesn't use any grabs to function.
.LP
.SH "STICK SENSITIVITY SETTINGS"
The \fB-s\fP and \fB-t\fP options specify a sensitivity and threshhold.
each movement of a stick, or trackball, must equal or exceed the threshhold to
be added to the respective axis sum. In other words if you puch the stick up
hard enough to exceed the threshhold then the Y axis sum would be increased by
however much you pressed up.
.LP
Next the summed X and Y axis movement is each compared to the sensitivity setting.
If the sensitivity setting is equalled or exceeded, then one imwheel event is spawned,
thus after pressing up for a bit, the Y sum exceeds the sensitivity and a wheel up
event is interpreted by imwheel into an action such as a PageUp key.
.LP
The sensitivity therefore must be greater than the threshhold for it to have any
bearing on the input. Pseudo code such as the following may explain:
.RS
.nf
if(input >= threshhold)
.RS
sum = sum + input
.RE
if(sum >= sensitivity) {
.RS
do an imwheel action
sum = 0
.RE
}
.fi
.RE
.SH "IMWHEELRC"
IMWheel uses, optionally, two configuration files. One called /etc/X11/imwheel/imwheelrc,
which is used for everybody. The other is $HOME/.imwheelrc, used only for one
user. One is supplied and should have been installed automatically in /etc/X11/imwheel/
if not also in the installing users $HOME as well. All whitespace is ignored
in the files except for within the window names' double quotes.
.LP
The configuration file consists of window names and event translations and/or
imwheel commands that begin with an `@' (at) symbol. Each window name starts a
section that is it's configuration. The window names a priortized as first
come first served, so more generic matches should always occur later in the
configuration file.
.LP
Comments are started with a pound (#) and extend to the end of the line.
.LP
.SH "IMWHEELRC WINDOW SECTION HEADERS"
Window name section headers are actually one of four things:
.LP
.nf
Window Title
Window Class Name
Window Resource Name
(null) which matches "\\(null\\)" in the imwheelrc
.fi
.LP
Most of these are probe-able using fvwm2's FvwmIdent module or the configurator
(see the \fBCONFIGURATION HELPER\fP section). Other window managers may have their
own method of identifying windows' attributes.
.br
Each window name is matched as a regex string. Thus any window is matched using
the regex pattern ".*" as a window name. This pattern should be the last
section in your configuration file, or it will override the other window
configurations in the file for matched wheel/stick actions.
.br
There is one special header noted as "(null)" which matches windows that have a
null string in the three attributes. This makes it possible to assign actions
to even Quake3, which has no info for it's window. Just make sure that you
realize that the keys used should not be keys that may conflict with other
key actions in the game or application you are aiming to make work!
The included imwheelrc file has a "(null)" section included to demonstrate, and
it should work with Quake3.
.br
Each window/class/resource name \fImust\fP be enclosed in double quotes (") on a line by
itself.
.LP
Inside each window section is any number of translation definitions or commands.
Each translation definition or command must be on a line by itself. The window section doesn't have to be terminated, as it is terminated by either starting
another window section or the end of the configuration file.
.LP
.SH "IMWHEELRC TRANSLATION DEFINITIONS"
Mouse wheel/stick translations each take up a line after a window section has
been started. Each argument is seperated by commas(,) whitespace is ignored.
KeySyms are used to specify the keyboard input and outputs. pipes (|) are used
to join multiple keys into one input/output.
The format is as follows:
.LP
.B REQUIRED
.br
The following arguments a required to make a minimum translation definition.
.TP
\fIKey Modifiers Input\fP
X KeySyms joined by pipes that indicate the required keys pressed when the
mouse action is made in order for this translation to be used. Alt, Meta,
Control, and Shift keys are typical modifiers, but are stated slightly different
than just `Shift' but rather `Shift_L' or `Shift_R', differentiating between
left and right shift keys. See the KeySyms section for more.
`\fBNone\fP' is a special KeySym used by imwheel, it is used to indicate no
modifiers. A blank entry is also acceptable in this case, but less descriptive
of what is going on! If `\fBNone\fP' is used then there can be no modifiers
in use during the wheel action. If the field is blank then \fIany\fP modifier
will match, so put these last in their window section.
.TP
\fIMouse Action Input\fP
This is the input from the mouse wheel or stick. It is one of the following and
\fIonly\fP one:
.nf
Up
Down
Left
Right
Thumb
.fi
These are self explanatory. If you have trouble use the configurator!
.TP
\fIKey Action Output\fP
Out KeySyms are placed here. See KeySyms section for more on all available
KeySyms. Join KeySyms using pipes. Output keys are pressed in order and
released, in reverse order, only after all have been pressed, likely making
them all combined as in `Control_L|C' which would be a `^C' (control-c)
keypress.
.LP
.B OPTIONAL
.br
The following options are optional, but to use one you must fill in all the
preceding arguments.
.TP
\fIOutput Repetitions\fP
How many times should the Output KeySyms be pressed in a row.
Default is 1.
.TP
\fIDelay Before KeyUp Event\fP
How long in microseconds until we release all the Output KeySyms in one Output
Repetition.
Default is 0.
.TP
\fIDelay Before Next KeyPress Event\fP
How long in microseconds until we press the next the Output KeySyms.
Ths delay occurs after the Output KeySyms are released.
Default is 0.
.LP
.SH "IMWHEELRC COMMANDS"
Commands start with the `@' character. Commands are as follows:
.TP
\fB@Exclude\fP
Exclude this window from imwheel grabing mouse events. imwheel will ungrab
the mouse when these windows are entered and not regrab the mouse until focus
is changed to a non-excluded window. This allows the ZAxis button events to
pass through normally and mouse grabs to succeed.
.br
XV and KDE clients need this for the X Windows Method.
.br
This command has no effect in the GPM Method. The mouse isn't grabbed, nor are
ZAxis button events created by the server.
.TP
\fB@Repeat\fP
Repeat the mouse button to the window. This cause a mouse button to be generated
in the current window. It does not use XSendEvent so the mouse button presses
are indistiguishable from the real thing. This mode is not compatible with the
XGrabButtons method of imwheel, otherwise listed as the ZAxis Method in this manpage.
.br
Motions are mapped as follows:
.RS
.RS
.nf
Up is button 4
Down is button 5
Left is button 6
Right is button 7
Thumb1 is button 8
Thumb2 is button 9
.fi
.RE
.RE
.TP
\fB@Priority\fP=\fIpriority\fP
Using this is allowed in each window/class/resource section.
Higher \fIpriority\fP values take precedence over lower ones.
Equal priorities on sections make the imwheelrc file parsed from top to bottom
to find the first match.
Thus \fB@Priority\fP can be used to make the file search for matches out of order,
then you dont have to keep the entries in order if you so please.
the supplied imwheelrc file contains extensive comments and examples of the
\fB@Priority\fP function.
.br
The default \fIpriority\fP for any new section is 0.
The last \fB@Priority\fP command in a section overrides all previous priorities
for that section. Thus each section has only one \fIpriority\fP setting in the end.
Priorities are kept as an int, thus range from INT_MAX to INT_MIN.
(see /usr/include/limits.h for these values on your system)
.LP
.SH "CONFIGURATION HELPER"
IMWheel contains a semi-hidden configuration helper which can be brought up
by rolling/sticking up and down a few times in the root window of the X server.
Inside this window you can find out possible window names to use in your
imwheelrc file. Press on the mini-screen capture to grab another window,
including the root window (whole screen).
.LP
Mouse wheel and stick actions can be grabbed along with
active modifier keys on the keyboard. The mouse wheel/stick action is displayed
and the X KeySyms are displayed beneath it. All this information can be
directly entered into an imwheelrc as desired.
.LP
IMWheel can be restarted to read in a changed imwheelrc file or the
configurator can be canceled causing imwheel to resume oprations without
reading the configuration file. To restart imwheel execs itself as called by
the user in the first place but adding the \fB-R\fP option to indicate to
itself that this is a restarted imwheel. The \fB-R\fP is not for use by the
user, as it bypasses some configuration of imwheel.
.LP
.SH "KEYSYMS"
The program expects combinations of keysyms to be used by using pipe(|)
characters to combine them together.
.LP
Example:
.RS
.nf
Alt_R|Shift_R
.fi
Means right alt \fIand\fP right shift together, not just either one or the
other! And not one after the other, they are both pressed at the same time
essentially.
.RE
.LP
For FIFO users, it is possible to send a real mouse button event, using
the special \fBButton#\fP syntax. An imwheelrc keysym of Button1 would
send a real Mouse button 1 (left mouse button) event. Mouse4 is what you'd want
for a MouseWheelUp type event. Mouse5 is what you want to MouseWheelDown event.
Many applications will understand the meaning of mouse button 4 and 5, but most don't
go beyond that. So \fIMouse6 and greater have no "standardized" meaning\fP. The Button# syntax
can be combined with regular keysyms, to send keys and mouse buttons at the same time.
.LP
Example:
.RS
.nf
Shift_L|Button4
- meaning left shift and wheel up.
Button5
- meaning wheel down.
.fi
.RE
.LP
Other button to imwheel meaniful references:
.RS
.nf
KeySym IMWheel Input Real Mouse
------ ------------- ----------
Button1 (none) Left Mouse Button
Button2 (none) Middle Mouse Button
Button3 (none) Right Mouse Button
Button4 Up Mouse Wheel Up
Button5 Down Mouse Wheel Down
Button6 Left Mouse Wheel Left
Button7 Right Mouse Wheel Right
Button8 Thumb1 Side Mouse Button 1 (left/up)
Button9 Thumb2 Side Mouse Button 2 (right/down)
.ni
.RE
.LP
Common Modifier Keysym names used in X:
.nf
Shift_L Shift_R
Control_L Control_R
Alt_L Alt_R
.fi
.LP
These are probably not currently assigned any keys, unless you \fIxmodmap\fP them in:
.LP
.nf
Meta_L Meta_R (Actually, Sun keyboards have this...)
Super_L Super_R
Hyper_L Hyper_R
.fi
.LP
And here's some that you may use, and they are \fIsomewhere\fP on your keyboard:Here's where they were on my keyboard, again, this is not universal.
Use the \fIxev\fP program to test your own keys on your keyboard!
.LP
.nf
Caps_Lock = The Caps Lock key!
(This still turns on and off caps lock!)
Num_Lock = The Num Lock key!
(This is not good to use...
for the same reasons as Caps_Lock)
Multi_key = The Scroll Lock key!
(Go figure!)
Mode_switch = Right Alt...for me anyways.
(This mean I cannot use Alt_R)
.fi
The windows keys may not be assigned any KeySyms, but they will have numbers.
\fIxmodmap\fP can be used to assign them to a real KeySym.
.LP
To find keysym names for any keys available see the
\fB/usr/include/X11/keysymdef.h\fP file, and for any define in that file
remove the "XK_" for the usable KeySym name in the configuration file.
The path to this file may differ for you.
.LP
Remember, there's always the configurator.
And \fBxev\fP will also help here too!
.LP
.SH "WHEEL OR STICK AS MIDDLE BUTTON IN X"
Configure the XF86Config without "Emulate3Buttons" and increase "Buttons" if it is 2
in the Ponter or InputDevice section. The wheel or stick will act as a real
middle button and the outer two buttons will act as separate buttons (1 and 3),
even when pressed together.
.LP
Of course if your wheel keeps clicking middle button while you're trying to use the
wheel you may want to activate the Emulate3Buttons option to disable the wheel button!
And donn't forget to reduce the Buttons argument to 2!
.LP
.SH "LEFTY BUTTON MAPPING IN X WINDOWS"
For those of you lefties out there using method #1, the non-gpm method this
command may help you get the buttons set up correctly in XWindows for both
left handed and imwheel use.
.LP
.RS
.nf
xmodmap -e "pointer = 3 2 1 4 5"
\fIor\fP
xmodmap -e "pointer = 3 2 1 4 5 6 7"
\fIetc...\fP
xmodmap -e "pointer = 3 2 1 4 5 6 7 8 9"
NOTE: most of these are NOT going to work, because of all the limits in X.
.fi
.RE
.LP
add more numbers to the end of this line if you have more buttons!
.LP
.SH "BUGS"
Of course...but most of the time it's just that you haven't read everything I've written here and in the files of the distribution itself. Even then, you may be giving up too easily. Keep trying, it's not that hard. I am always working on reducing strange behavior. This is still a beta, as indicated by the leading 0 in the version number.
.LP
.B Real Bugs
.LP
imwheel doesn't get along with itself on the same X display or using the same
gpmwheel FIFO. - This will always be your fault :-/
.LP
Stick mice are still a pain in the butt to use. - This is the manufacturer's fault.
Or X Windows fault, for not having a method to easily use such devices in all applications.
.LP
Keyboard focus isn't changed automatically to input keys into Window mouse is
over. This only occurs with Click-to-Focus type focus managment in window managers.
I use sloppy focus in fvwm2, which always works for me. - Whose fault \fIis\fP this?
(Switch focus modes and/or window managers, or try the \fB-f\fP option on imwheel)
.LP
Configuration file is not validated for correctness nicely...although it does
get preparsed before the main program starts, thus stopping you before you run
with an invalid configuration file. I just have never made a bad configuration
file, so I guess I'll have to try and do that to see what happens. Just don't
make any mistakes and you'll be fine. - This is my fault?! ;)
.LP
.SH "HOMEPAGE"
.nf
http://jonatkins.org/imwheel
.fi
.LP
.SH "AUTHOR"
Jonathan Atkins <jcatki@jonatkins.org>
.LP
.SH "FILES"
.nf
$HOME/.imwheelrc
The users configuration file.
/etc/X11/imwheel/imwheelrc
The global location for the configuration
file, it is always loaded. Overided by
the users configuration file.
/dev/gpmwheel
The default wheel FIFO from gpm, if used.
/dev/jam_imwheel:0.0 (or other numbers...)
A wheel FIFO from jamd, if used, must be specified.
jamd allows more than on FIFO, and thus allows more than
one instance of imwheel to be running on the same computer
when running imwheel on multiple displays
using the Wheel FIFO method.
/tmp/imwheel.pid
The public area for imwheel's pid file.
/var/run/imwheel.pid
The private area for imwheel's pid file.
.fi
.LP
.SH "SEE ALSO"
.nf
\fBjamd(1)\fP
Jon Atkins Mouse - a replacement/augmentation for/to gpm.
\fBxwheel(1x)\fP
The new replacement for imwheel. Uses jamd instead of gpm or ZAxis.
(may not be available yet)
\fBxdpyinfo(1x)\fP
X Display information, including extensions.
\fBgpm(8)\fP
General Purpose Mouse, imwheel edition required.
\fBFvwmIdent(1x)\fP
FVWM2's Identify module, for probing windows.
\fBregex(7)\fP
POSIX 1003.2 Regular Expressions.
\fBxmodmap(1x)\fP
Utility for modifying keymap & button mappings in X.
\fBxev(1x)\fP
Print contents of X events.
\fB/usr/include/X11/keysymdef.h\fP
X11 KeySym definitions.
\fB/usr/include/limits.h\fP
INT_MIN and INT_MAX definitions.
.fi

891
imwheel.1.html Normal file
View File

@ -0,0 +1,891 @@
<HTML><HEAD><TITLE>Manpage of IMWheel</TITLE>
</HEAD><BODY>
<H1>IMWheel</H1>
Section: User Commands (1)<BR>Updated: September 8 2002<BR><A HREF="#index">Index</A>
<A HREF="http://jcatki.dhs.org/cgi-bin/man2html.cgi">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
imwheel - a mouse wheel and stick interpreter for X Windows
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>imwheel</B> [ <I>options</I> ]
<BR>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<I>IMWheel</I> is a universal mouse wheel and mouse stick translator for the X
Windows System. Using either a special version of gpm and it's /dev/gpmwheel
FIFO, or the support for a ZAxis on the mouse built into some servers, such as
XFree86. Utilizing the input from gpm or X Windows, imwheel translates mouse
wheel and mouse stick actions into keyboard events using the XTest extension to
X. Use <I>xdpyinfo</I> for information on the supported extensions in your X
server.
<P>
<A NAME="lbAE">&nbsp;</A>
<H2>COMMAND LINE OPTIONS</H2>
Available command line options are as follows:
<DL COMPACT>
<DT><B>-4, --flip-buttons</B><DD>
Flips the mouse buttons so that 4 is 5 and 5 is 4, reversing
the Up and Down actions. This would make 4 buttons somewhat useful!
This is the similar to using &quot;-b 54678&quot;, see the <B>-b</B> option.
See also <A HREF="http://jcatki.dhs.org/cgi-bin/man2html.cgi?1+xmodmap">xmodmap</A>(1).
<DT><B>-b, --buttons</B> <I>button-spec</I><DD>
Remap buttons in <I>button-spec</I> to interpreted wheel/thumb input.
Also limits the button grab to the specified buttons when using the ZAxis method.
(see &quot;X WINDOWS ZAXIS METHOD&quot; below)
the <I>button-spec</I> may specify any of up to five buttons.
the <I>button-spec</I> is decoded in the following order for wheel input:
<DL COMPACT><DT><DD>
<DL COMPACT><DT><DD>
<PRE>
Index Interpreted As Button Number
<BR>
1 Wheel Up 4
<BR>
2 Wheel Down 5
<BR>
3 Wheel Left 6
<BR>
4 Wheel Right 7
<BR>
5 Thumb Button 1 8
<BR>
6 Thumb Button 2 9
</PRE>
</DL>
A <I>button-spec</I> of &quot;45&quot; will limit the grabbed buttons for only wheel up and down.
<BR>
A <I>button-spec</I> of &quot;67&quot; may be useful to use actual buttons 6 and 7 as wheel up
and down, and limit the grab to only those two buttons.
<BR>
A <I>button-spec</I> of &quot;0&quot; turns off any defined mapping, thus allowing for skips in
the <I>button-spec</I> for something that doesn't exist on your mouse.
<BR>
A <I>button-spec</I> of &quot;45006&quot; may be for normal wheel up/down and a thumb button 1, but
no horizontal wheel axis.
<BR>
The default <I>button-spec</I> is &quot;456789&quot;.
<BR>
See also <A HREF="http://jcatki.dhs.org/cgi-bin/man2html.cgi?1+xmodmap">xmodmap</A>(1).
</DL>
<DT><B>-c, --config</B><DD>
Popup to configuration helper window imediately.
<BR>
See also <B>CONFIGURATION HELPER</B>
<DT><B>-D, --debug</B><DD>
Show all possible debug info while running. This spits out alot and I also
suggest using the <B>-d</B> option to prevent imwheel from detaching from the
controlling terminal.
<DT><B>-d, --detach</B><DD>
Actually this does the opposite of it's name, it prevents detachment from the
controlling terminal. (no daemon...) Control-C stops, etc...
<DT><B>-f, --focus</B><DD>
Forces the X event subwindow to be used instead of the original hack that would
replace the subwindow in the X event with a probed focus query (XGetInputFocus).
This should fix some compatability problems with some window managers, such as
window maker, and perhaps enlightenment. If nothing seems to be working right,
try toggling this on or off...
<DT><B>-g, --focus-events</B><DD>
Disable the use of focus events for button grabs. If your <B>@Excluded</B> windows
are not regrabbing the mouse buttons when exited, try toggling this on or off...
<DT><B>-h, --help</B><DD>
Short help on options plus version/author info.
<DT><B>-k, --kill</B><DD>
Attempts to kill old imwheel (useful only for <B>--wheel-fifo</B> method.)
Pidfile must be created for this to work (no <B>-p</B> or <B>--pid</B> option on
the previous imwheel invocation). Process IDs are
tested using /proc/${pid}/status Name: field ?= imwheel.
If /proc is not mounted then this fails everytime!
Otherwise, this ensures that the wrong process is not killed.
<DT><B>-p, --pid</B><DD>
Don't write a pid file for gpmwheel FIFO method. This is the only
method that uses the pid file. XGrab doesn't need it, so it just
issues a warning about starting multiple imwheels on the same
display. Some people really prefer this, especially when they are
not using a SUID root imwheel executable.
<DT><B>-q, --quit</B><DD>
Quit imwheel before entering event loop. Usful in killing an
imwheel running in gpmwheel FIFO mode after exiting XWindows,
if you're using pid files that is.
<BR>
Example: `imwheel -k -q' = kill and quit (option order doesn't matter)
<DT><B>-s, --sensitivity</B> <I>sum-min</I><DD>
(Stick mice, Wheel FIFO method only)
<BR>
like <B>-t</B> only this sets a minimum total amount of movment of the
stick or marble, before any action is taken. This works good
with the Marble type devices.
This should be a multiple of the threshhold as given by the <B>-t</B> option.
The default is 0, meaning that there is no sensitivity testing,
all input spawns an event.
See the <B>-t</B> option also.
(see &quot;STICK SENSITIVITY SETTINGS&quot; below)
<DT><B>-t, --threshhold</B> <I>minimum-pressure</I><DD>
Used with gpm only and then only with recognized stick mice.
stick mice send a pressure value ranging from 0(no pressure) to
7(hard push). This sets the minimum required pressure for
input to be registered. Setting it to zero will cause realtime sticking,
which is usually too much action for X to keep up. (max rate i saw was
100 events a second!). Once input is registered, it is summed up per axis,
and then it must equal or exceed the sensitivity setting to pass as an input.
See the <B>-s</B> option also, for sensitivity.
<BR>
The default is 2, to avoid slight presses on the 90-degree direction of the
intended while still getting to the intended direction. Setting this to 7 is
insane, because it requires the user to push as hard as possible everytime they
want something to happen! However it may not be so insane for people using
trackballs for input, as they may spin much faster per sample...
<BR>
(see &quot;STICK SENSITIVITY SETTINGS&quot; below)
<DT><B>-W, --wheel-fifo</B> <I>fifo</I><DD>
Use the gpm/jamd wheel fifo instead of XGrabMouse. See <B>GPM/JAMD WHEEL FIFO METHOD</B>
section. This method allows only one X display to be used. This is required
for the gpm method to work. This method only works with the imwheel version
of gpm and with jamd. To find out if you are running the imwheel version of gpm
use the following command and look for &quot;(imwheel)&quot; in the title:
<DL COMPACT><DT><DD>
<DL COMPACT><DT><DD>
<PRE>
gpm -v
</PRE>
</DL>
<I>fifo</I> names the named pipe (FIFO) created by gpm. It defaults to
&quot;/dev/gpmwheel&quot; (for <B>--wheel-fifo</B> only). The FIFO must exist before
running imwheel in this mode. using jamd requires you to name the correct fifo
because it doesn't use /dev/gpmwheel, but rather one of the /dev/jam_imwheel:0.0
named fifos created by jamd's imwheel module.
<BR>
<B>@Exclude</B> commands in the rc file are unused in this mode.
</DL>
<DT><B>-X, --display</B> <I>display</I><DD>
Use XServer at a specified <I>display</I> in standard X form.
Using this option is usful for multiple displays in the X Window ZAxis Method.
<DT><B>-x, --transpose</B><DD>
<P>
This swaps the X and Y axis of movement for stick input from a wheel-fifo.
</DL>
<P>
<A NAME="lbAF">&nbsp;</A>
<H2>X WINDOWS ZAXIS METHOD</H2>
This method is the only method that works with multiple X displays, using
multiple imwheels. Use multiple imwheels by either setting the DISPLAY
environment variable before running each imwheel, or use the <B>-X</B> or
<B>--display</B> options to specify a different display for each imwheel.
Running multiple imwheels on the same display is not recommended, but is
allowed, and may cause strange things to happen while using the stick or wheel.
<P>
Edit the XF86Config and add/edit the following lines in the
&quot;Pointer&quot;(XFree86 3.3) or
&quot;InputDevice&quot;(XFree86 4.x)
section:
<P>
1 axis (vertical wheel):
<DL COMPACT><DT><DD>
<PRE>
(XFree86 3.3)
<DL COMPACT><DT><DD>Buttons 5
ZAxisMapping 4 5
</DL>
(XFree86 4.x)
<DL COMPACT><DT><DD>Option &quot;Buttons&quot; &quot;5&quot;
Option &quot;ZAxisMapping&quot; &quot;4 5&quot;
</DL>
</PRE>
</DL>
<P>
2 axis (1 stick or 2 perpendicular wheels):
<DL COMPACT><DT><DD>
<PRE>
(XFree86 3.3)
<DL COMPACT><DT><DD>Buttons 7
ZAxisMapping 4 5 6 7
</DL>
(XFree86 4.x)
<DL COMPACT><DT><DD>Option &quot;Buttons&quot; &quot;7&quot;
Option &quot;ZAxisMapping&quot; &quot;4 5 6 7&quot;
</DL>
</PRE>
</DL>
<P>
The Buttons option may be greater than stated above if you have thumb
buttons, or other extras that qualify as buttons.
<P>
Make sure your Protocol is set to either &quot;IMPS/2&quot; for a PS/2 mouse
or for serial mice set it to &quot;IntelliMouse&quot; or &quot;Auto&quot;.
This is for IntelliMouse compatible mice, other protocols may be required for other mice.
Then while running X Windows run imwheel <I>without</I> the <B>--wheel-fifo</B>
or <B>-W</B> options.
<P>
<B>NOTE</B>
<BR>
The <B>@Exclude</B> command must be used for clients that either use the ZAxis
for themselves and have no keyboard translations to cause the same desired
effect. The <B>@Exclude</B> command must also be added for any client requiring
mouse and/or mouse button grabs and that don't specify specific buttons to
grab. These clients fail when they try to grab the mouse because the buttons 4
and 5 are already grabbed by imwheel. XV is an example of a client that
requires these types of grabs to succeed. KDE clients use the ZAxis for their
own purposes. The supplied imwheelrc included and exclusion for XV already.
See the IMWheelRC section for more information.
<P>
Also pid files are not used for this method. Thus the <B>-p</B> and <B>--pid</B>
options have no effect, and are ignored.
<P>
<A NAME="lbAG">&nbsp;</A>
<H2>GPM/JAMD WHEEL FIFO METHOD</H2>
This method is REQUIRED for any X Windows server without wheel
mouse support built in. This method will currently support mice as supported
through gpm or jamd.
<P>
In the Pointer section of your XF86Config (or the equivalent configuration file
for your X server) change your mouse Protocol to be &quot;MouseSystems&quot;
(or the equivelant...), also change the Device file that the mouse is read from
to &quot;/dev/gpmdata&quot;, then restart X Windows if it is running.
jamd will replicate to /dev/jam_ps2:0.0 or some other devices as well,
make sure to use the right X Mouse protocol in this case,
like the jamd_ps2 device is X mouse protocol PS/2,
and the jamd_imps2 device is X mouse protocol IMPS/2.
<P>
Before starting X Windows (re)start gpm with the <B>-W</B> option. Make sure
you are using a supported wheel or stick mouse as stated in the gpm man page.
<P>
After starting X Windows run imwheel as follows adding options as desired:
<P>
for gpm you can use the following option to imwheel
<P>
<B>--wheel-fifo</B>
<P>
jamd requires you specify the fifo name as one of the /dev/jamd_imwheel:0.0
named fifos. Run
<P>
<B>ls -al /dev/jam_imwheel*</B>
<P>
to see what is available.
In this example I would use
<P>
<B>-W /dev/jam_imwheel:0.0</B>
<P>
as the option to imwheel.
<P>
I usually add the <B>-k</B> option to kill off any old imwheel processes left
over, as imwheel doesn't exit with the server, but rather it will only die if a
wheel or stick action occurs when an X server is not connected, such as when X
is dead or the DISPLAY environment variable is setup wrong, or the <B>-X</B> or
<B>--display</B> variables connected imwheel to a now defunct X server.
<P>
gpm or jamd, and/or imwheel can be restarted at any time, imwheel can sense when
gpm of jamd is not there, and gpm nor jamd doesn't give a hoot about imwheel
being up or not.
<P>
<B>NOTE</B>
<BR>
The @Exclude command has no bearing in this method, it is ignored. No Focus
change events are received in this method. Thus KDE and other clients that
support X based wheel events through the ZAxis are not going to work except
through normal imwheel keypress translation of wheel and stick actions.
<BR>
XV will function fine, as will any client that grabs the mouse and/or mouse
buttons. This mode doesn't use any grabs to function.
<P>
<A NAME="lbAH">&nbsp;</A>
<H2>STICK SENSITIVITY SETTINGS</H2>
The <B>-s</B> and <B>-t</B> options specify a sensitivity and threshhold.
each movement of a stick, or trackball, must equal or exceed the threshhold to
be added to the respective axis sum. In other words if you puch the stick up
hard enough to exceed the threshhold then the Y axis sum would be increased by
however much you pressed up.
<P>
Next the summed X and Y axis movement is each compared to the sensitivity setting.
If the sensitivity setting is equalled or exceeded, then one imwheel event is spawned,
thus after pressing up for a bit, the Y sum exceeds the sensitivity and a wheel up
event is interpreted by imwheel into an action such as a PageUp key.
<P>
The sensitivity therefore must be greater than the threshhold for it to have any
bearing on the input. Pseudo code such as the following may explain:
<DL COMPACT><DT><DD>
<PRE>
if(input &gt;= threshhold)
<DL COMPACT><DT><DD>sum = sum + input
</DL>
if(sum &gt;= sensitivity) {
<DL COMPACT><DT><DD>do an imwheel action
sum = 0
</DL>
}
</PRE>
</DL>
<A NAME="lbAI">&nbsp;</A>
<H2>IMWHEELRC</H2>
IMWheel uses, optionally, two configuration files. One called /etc/X11/imwheelrc,
which is used for everybody. The other is $HOME/.imwheelrc, used only for one
user. One is supplied and should have been installed automatically in /etc
if not also in the installing users $HOME as well. All whitespace is ignored
in the files except for within the window names' double quotes.
<P>
The configuration file consists of window names and event translations and/or
imwheel commands that begin with an `@' (at) symbol. Each window name starts a
section that is it's configuration. The window names a priortized as first
come first served, so more generic matches should always occur later in the
configuration file.
<P>
Comments are started with a pound (#) and extend to the end of the line.
<P>
<A NAME="lbAJ">&nbsp;</A>
<H2>IMWHEELRC WINDOW SECTION HEADERS</H2>
Window name section headers are actually one of four things:
<P>
<PRE>
Window Title
Window Class Name
Window Resource Name
(null) which matches &quot;\(null\)&quot; in the imwheelrc
</PRE>
<P>
Most of these are probe-able using fvwm2's FvwmIdent module or the configurator
(see the <B>CONFIGURATION HELPER</B> section). Other window managers may have their
own method of identifying windows' attributes.
<BR>
Each window name is matched as a regex string. Thus any window is matched using
the regex pattern &quot;.*&quot; as a window name. This pattern should be the last
section in your configuration file, or it will override the other window
configurations in the file for matched wheel/stick actions.
<BR>
There is one special header noted as &quot;(null)&quot; which matches windows that have a
null string in the three attributes. This makes it possible to assign actions
to even Quake3, which has no info for it's window. Just make sure that you
realize that the keys used should not be keys that may conflict with other
key actions in the game or application you are aiming to make work!
The included imwheelrc file has a &quot;(null)&quot; section included to demonstrate, and
it should work with Quake3.
<BR>
Each window/class/resource name <I>must</I> be enclosed in double quotes (&quot;) on a line by
itself.
<P>
Inside each window section is any number of translation definitions or commands.
Each translation definition or command must be on a line by itself. The window section doesn't have to be terminated, as it is terminated by either starting
another window section or the end of the configuration file.
<P>
<A NAME="lbAK">&nbsp;</A>
<H2>IMWHEELRC TRANSLATION DEFINITIONS</H2>
Mouse wheel/stick translations each take up a line after a window section has
been started. Each argument is seperated by commas(,) whitespace is ignored.
KeySyms are used to specify the keyboard input and outputs. pipes (|) are used
to join multiple keys into one input/output.
The format is as follows:
<P>
<B>REQUIRED</B>
<BR>
The following arguments a required to make a minimum translation definition.
<DL COMPACT>
<DT><I>Key Modifiers Input</I><DD>
X KeySyms joined by pipes that indicate the required keys pressed when the
mouse action is made in order for this translation to be used. Alt, Meta,
Control, and Shift keys are typical modifiers, but are stated slightly different
than just `Shift' but rather `Shift_L' or `Shift_R', differentiating between
left and right shift keys. See the KeySyms section for more.
<P>
`<B>None</B>' is a special KeySym used by imwheel, it is used to indicate no
modifiers. A blank entry is also acceptable in this case, but less descriptive
of what is going on! If `<B>None</B>' is used then there can be no modifiers
in use during the wheel action. If the field is blank then <I>any</I> modifier
will match, so put these last in their window section.
<DT><I>Mouse Action Input</I><DD>
This is the input from the mouse wheel or stick. It is one of the following and
<I>only</I> one:
<P>
<PRE>
Up
Down
Left
Right
Thumb
</PRE>
<P>
These are self explanatory. If you have trouble use the configurator!
<DT><I>Key Action Output</I><DD>
Out KeySyms are placed here. See KeySyms section for more on all available
KeySyms. Join KeySyms using pipes. Output keys are pressed in order and
released, in reverse order, only after all have been pressed, likely making
them all combined as in `Control_L|C' which would be a `^C' (control-c)
keypress.
</DL>
<P>
<B>OPTIONAL</B>
<BR>
The following options are optional, but to use one you must fill in all the
preceding arguments.
<DL COMPACT>
<DT><I>Output Repetitions</I><DD>
How many times should the Output KeySyms be pressed in a row.
<P>
Default is 1.
<DT><I>Delay Before KeyUp Event</I><DD>
How long in microseconds until we release all the Output KeySyms in one Output
Repetition.
<P>
Default is 0.
<DT><I>Delay Before Next KeyPress Event</I><DD>
How long in microseconds until we press the next the Output KeySyms.
Ths delay occurs after the Output KeySyms are released.
<P>
Default is 0.
</DL>
<P>
<A NAME="lbAL">&nbsp;</A>
<H2>IMWHEELRC COMMANDS</H2>
Commands start with the `@' character. Commands are as follows:
<DL COMPACT>
<DT><B>@Exclude</B><DD>
Exclude this window from imwheel grabing mouse events. imwheel will ungrab
the mouse when these windows are entered and not regrab the mouse until focus
is changed to a non-excluded window. This allows the ZAxis button events to
pass through normally and mouse grabs to succeed.
<BR>
XV and KDE clients need this for the X Windows Method.
<BR>
This command has no effect in the GPM Method. The mouse isn't grabbed, nor are
ZAxis button events created by the server.
<DT><B>@Repeat</B><DD>
Repeat the mouse button to the window. This cause a mouse button to be generated
in the current window. It does not use XSendEvent so the mouse button presses
are indistiguishable from the real thing. This mode is not compatible with the
XGrabButtons method of imwheel, otherwise listed as the ZAxis Method in this manpage.
<BR>
Motions are mapped as follows:
<DL COMPACT><DT><DD>
<DL COMPACT><DT><DD>
<PRE>
Up is button 4
Down is button 5
Left is button 6
Right is button 7
Thumb1 is button 8
Thumb2 is button 9
</PRE>
</DL>
</DL>
<DT><B>@Priority</B>=<I>priority</I><DD>
Using this is allowed in each window/class/resource section.
Higher <I>priority</I> values take precedence over lower ones.
Equal priorities on sections make the imwheelrc file parsed from top to bottom
to find the first match.
Thus <B>@Priority</B> can be used to make the file search for matches out of order,
then you dont have to keep the entries in order if you so please.
the supplied imwheelrc file contains extensive comments and examples of the
<B>@Priority</B> function.
<BR>
The default <I>priority</I> for any new section is 0.
The last <B>@Priority</B> command in a section overrides all previous priorities
for that section. Thus each section has only one <I>priority</I> setting in the end.
Priorities are kept as an int, thus range from INT_MAX to INT_MIN.
(see /usr/include/limits.h for these values on your system)
</DL>
<P>
<A NAME="lbAM">&nbsp;</A>
<H2>CONFIGURATION HELPER</H2>
IMWheel contains a semi-hidden configuration helper which can be brought up
by rolling/sticking up and down a few times in the root window of the X server.
Inside this window you can find out possible window names to use in your
imwheelrc file. Press on the mini-screen capture to grab another window,
including the root window (whole screen).
<P>
Mouse wheel and stick actions can be grabbed along with
active modifier keys on the keyboard. The mouse wheel/stick action is displayed
and the X KeySyms are displayed beneath it. All this information can be
directly entered into an imwheelrc as desired.
<P>
IMWheel can be restarted to read in a changed imwheelrc file or the
configurator can be canceled causing imwheel to resume oprations without
reading the configuration file. To restart imwheel execs itself as called by
the user in the first place but adding the <B>-R</B> option to indicate to
itself that this is a restarted imwheel. The <B>-R</B> is not for use by the
user, as it bypasses some configuration of imwheel.
<P>
<A NAME="lbAN">&nbsp;</A>
<H2>KEYSYMS</H2>
The program expects combinations of keysyms to be used by using pipe(|)
characters to combine them together.
<P>
Example:
<DL COMPACT><DT><DD>
<PRE>
Alt_R|Shift_R
</PRE>
Means right alt <I>and</I> right shift together, not just either one or the
other! And not one after the other, they are both pressed at the same time
essentially.
</DL>
<P>
For FIFO users, it is possible to send a real mouse button event, using
the special <B>Button#</B> syntax. An imwheelrc keysym of Button1 would
send a real Mouse button 1 (left mouse button) event. Mouse4 is what you'd want
for a MouseWheelUp type event. Mouse5 is what you want to MouseWheelDown event.
Many applications will understand the meaning of mouse button 4 and 5, but most don't
go beyond that. So <I>Mouse6 and greater have no &quot;standardized&quot; meaning</I>. The Button# syntax
can be combined with regular keysyms, to send keys and mouse buttons at the same time.
<P>
Example:
<DL COMPACT><DT><DD>
<PRE>
Shift_L|Button4
- meaning left shift and wheel up.
Button5
- meaning wheel down.
</PRE>
</DL>
<P>
Other button to imwheel meaniful references:
<DL COMPACT><DT><DD>
<PRE>
KeySym IMWheel Input Real Mouse
------ ------------- ----------
Button1 (none) Left Mouse Button
Button2 (none) Middle Mouse Button
Button3 (none) Right Mouse Button
Button4 Up Mouse Wheel Up
Button5 Down Mouse Wheel Down
Button6 Left Mouse Wheel Left
Button7 Right Mouse Wheel Right
Button8 Thumb1 Side Mouse Button 1 (left/up)
Button9 Thumb2 Side Mouse Button 2 (right/down)
</DL>
Common Modifier Keysym names used in X:
Shift_L Shift_R
Control_L Control_R
Alt_L Alt_R
</PRE>
<P>
These are probably not currently assigned any keys, unless you <I>xmodmap</I> them in:
<P>
<PRE>
Meta_L Meta_R (Actually, Sun keyboards have this...)
Super_L Super_R
Hyper_L Hyper_R
</PRE>
<P>
And here's some that you may use, and they are <I>somewhere</I> on your keyboard:Here's where they were on my keyboard, again, this is not universal.
Use the <I>xev</I> program to test your own keys on your keyboard!
<P>
<PRE>
Caps_Lock = The Caps Lock key!
(This still turns on and off caps lock!)
Num_Lock = The Num Lock key!
(This is not good to use...
for the same reasons as Caps_Lock)
Multi_key = The Scroll Lock key!
(Go figure!)
Mode_switch = Right Alt...for me anyways.
(This mean I cannot use Alt_R)
</PRE>
<P>
The windows keys may not be assigned any KeySyms, but they will have numbers.
<I>xmodmap</I> can be used to assign them to a real KeySym.
<P>
To find keysym names for any keys available see the
<B>/usr/include/X11/keysymdef.h</B> file, and for any define in that file
remove the &quot;XK_&quot; for the usable KeySym name in the configuration file.
The path to this file may differ for you.
<P>
Remember, there's always the configurator.
And <B>xev</B> will also help here too!
<P>
<A NAME="lbAO">&nbsp;</A>
<H2>WHEEL OR STICK AS MIDDLE BUTTON IN X</H2>
Configure the XF86Config without &quot;Emulate3Buttons&quot; and increase &quot;Buttons&quot; if it is 2
in the Ponter or InputDevice section. The wheel or stick will act as a real
middle button and the outer two buttons will act as separate buttons (1 and 3),
even when pressed together.
<P>
Of course if your wheel keeps clicking middle button while you're trying to use the
wheel you may want to activate the Emulate3Buttons option to disable the wheel button!
And donn't forget to reduce the Buttons argument to 2!
<P>
<A NAME="lbAP">&nbsp;</A>
<H2>LEFTY BUTTON MAPPING IN X WINDOWS</H2>
For those of you lefties out there using method #1, the non-gpm method this
command may help you get the buttons set up correctly in XWindows for both
left handed and imwheel use.
<P>
<DL COMPACT><DT><DD>
<PRE>
xmodmap -e &quot;pointer = 3 2 1 4 5&quot;
<I>or</I>
xmodmap -e &quot;pointer = 3 2 1 4 5 6 7&quot;
<I>etc...</I>
xmodmap -e &quot;pointer = 3 2 1 4 5 6 7 8 9&quot;
NOTE: most of these are NOT going to work, because of all the limits in X.
</PRE>
</DL>
<P>
add more numbers to the end of this line if you have more buttons!
<P>
<A NAME="lbAQ">&nbsp;</A>
<H2>BUGS</H2>
Of course...but most of the time it's just that you haven't read everything I've written here and in the files of the distribution itself. Even then, you may be giving up too easily. Keep trying, it's not that hard. I am always working on reducing strange behavior. This is still a beta, as indicated by the leading 0 in the version number.
<P>
<B>Real Bugs</B>
<P>
imwheel doesn't get along with itself on the same X display or using the same
gpmwheel FIFO. - This will always be your fault :-/
<P>
Stick mice are still a pain in the butt to use. - This is the manufacturer's fault.
Or X Windows fault, for not having a method to easily use such devices in all applications.
<P>
Keyboard focus isn't changed automatically to input keys into Window mouse is
over. This only occurs with Click-to-Focus type focus managment in window managers.
I use sloppy focus in fvwm2, which always works for me. - Whose fault <I>is</I> this?
(Switch focus modes and/or window managers, or try the <B>-f</B> option on imwheel)
<P>
Configuration file is not validated for correctness nicely...although it does
get preparsed before the main program starts, thus stopping you before you run
with an invalid configuration file. I just have never made a bad configuration
file, so I guess I'll have to try and do that to see what happens. Just don't
make any mistakes and you'll be fine. - This is my fault?! ;)
<P>
<A NAME="lbAR">&nbsp;</A>
<H2>HOMEPAGE</H2>
<PRE>
<A HREF="http://jonatkins.org/imwheel">http://jonatkins.org/imwheel</A>
</PRE>
<P>
<P>
<A NAME="lbAS">&nbsp;</A>
<H2>AUTHOR</H2>
Jonathan Atkins &lt;<A HREF="mailto:jcatki@jonatkins.org">jcatki@jonatkins.org</A>&gt;
<P>
<P>
<A NAME="lbAT">&nbsp;</A>
<H2>FILES</H2>
<PRE>
$HOME/.imwheelrc
The users configuration file.
/etc/X11/imwheelrc
The global location for the configuration
file, it is always loaded. Overided by
the users configuration file.
/dev/gpmwheel
The default wheel FIFO from gpm, if used.
/dev/jam_imwheel:0.0 (or other numbers...)
A wheel FIFO from jamd, if used, must be specified.
jamd allows more than on FIFO, and thus allows more than
one instance of imwheel to be running on the same computer
when running imwheel on multiple displays
using the Wheel FIFO method.
/tmp/imwheel.pid
The public area for imwheel's pid file.
/var/run/imwheel.pid
The private area for imwheel's pid file.
</PRE>
<P>
<P>
<A NAME="lbAU">&nbsp;</A>
<H2>SEE ALSO</H2>
<PRE>
<B><A HREF="http://jcatki.dhs.org/cgi-bin/man2html.cgi?1+jamd">jamd</A>(1)</B>
Jon Atkins Mouse - a replacement/augmentation for/to gpm.
<B><A HREF="http://jcatki.dhs.org/cgi-bin/man2html.cgi?1x+xwheel">xwheel</A>(1x)</B>
The new replacement for imwheel. Uses jamd instead of gpm or ZAxis.
(may not be available yet)
<B><A HREF="http://jcatki.dhs.org/cgi-bin/man2html.cgi?1x+xdpyinfo">xdpyinfo</A>(1x)</B>
X Display information, including extensions.
<B><A HREF="http://jcatki.dhs.org/cgi-bin/man2html.cgi?8+gpm">gpm</A>(8)</B>
General Purpose Mouse, imwheel edition required.
<B><A HREF="http://jcatki.dhs.org/cgi-bin/man2html.cgi?1x+FvwmIdent">FvwmIdent</A>(1x)</B>
FVWM2's Identify module, for probing windows.
<B><A HREF="http://jcatki.dhs.org/cgi-bin/man2html.cgi?7+regex">regex</A>(7)</B>
POSIX 1003.2 Regular Expressions.
<B><A HREF="http://jcatki.dhs.org/cgi-bin/man2html.cgi?1x+xmodmap">xmodmap</A>(1x)</B>
Utility for modifying keymap &amp; button mappings in X.
<B><A HREF="http://jcatki.dhs.org/cgi-bin/man2html.cgi?1x+xev">xev</A>(1x)</B>
Print contents of X events.
<B>/usr/include/X11/keysymdef.h</B>
X11 KeySym definitions.
<B>/usr/include/limits.h</B>
INT_MIN and INT_MAX definitions.
</PRE>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT><A HREF="#lbAB">NAME</A><DD>
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT><A HREF="#lbAE">COMMAND LINE OPTIONS</A><DD>
<DT><A HREF="#lbAF">X WINDOWS ZAXIS METHOD</A><DD>
<DT><A HREF="#lbAG">GPM/JAMD WHEEL FIFO METHOD</A><DD>
<DT><A HREF="#lbAH">STICK SENSITIVITY SETTINGS</A><DD>
<DT><A HREF="#lbAI">IMWHEELRC</A><DD>
<DT><A HREF="#lbAJ">IMWHEELRC WINDOW SECTION HEADERS</A><DD>
<DT><A HREF="#lbAK">IMWHEELRC TRANSLATION DEFINITIONS</A><DD>
<DT><A HREF="#lbAL">IMWHEELRC COMMANDS</A><DD>
<DT><A HREF="#lbAM">CONFIGURATION HELPER</A><DD>
<DT><A HREF="#lbAN">KEYSYMS</A><DD>
<DT><A HREF="#lbAO">WHEEL OR STICK AS MIDDLE BUTTON IN X</A><DD>
<DT><A HREF="#lbAP">LEFTY BUTTON MAPPING IN X WINDOWS</A><DD>
<DT><A HREF="#lbAQ">BUGS</A><DD>
<DT><A HREF="#lbAR">HOMEPAGE</A><DD>
<DT><A HREF="#lbAS">AUTHOR</A><DD>
<DT><A HREF="#lbAT">FILES</A><DD>
<DT><A HREF="#lbAU">SEE ALSO</A><DD>
</DL>
</BODY>
</HTML>

730
imwheel.c Normal file
View File

@ -0,0 +1,730 @@
/* Intellimouse Wheel Thinger
* Copylefted under the GNU Public License
* Author : Jonathan Atkins <jcatki@jonatkins.org>
* PLEASE: contact me if you have any improvements, I will gladly code good ones
*/
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <time.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/extensions/XTest.h>
#include <termios.h>
#include "util.h"
#include "cfg.h"
#include "imwheel.h"
#include <X11/Xmu/WinUtil.h>
#define HISTORY_LENGTH 3
#define CONFIG_TIME 4
/*----------------------------------------------------------------------------*/
Display *start(char*);
void endItAll(Display*);
void eventLoop(Display*, char**);
void freeAllX(XClassHint*, XModifierKeymap**, char**);
int *nullXError(Display*,XErrorEvent*);
Stick stick,old_stick;
char *emptystr="(no window)";
/*----------------------------------------------------------------------------*/
char *opts="a:b:c4fgiW:dpDKkRrqh?X:t:vxs:";
const struct option options[]=
{ /*{name, need/opt_arg, flag, val}*/
{"auto-repeat", 1, 0, 'a'},
{"buttons", 1, 0, 'b'},
{"config", 0, 0, 'c'},
{"debug", 0, 0, 'D'},
{"detach", 0, 0, 'd'},
{"display", 1, 0, 'X'},
{"flip-buttons", 0, 0, '4'},
{"focus", 0, 0, 'f'},
{"focus-events", 0, 0, 'g'},
{"help", 0, 0, 'h'},
{"key-defaults", 0, 0, 'K'},
{"kill", 0, 0, 'k'},
{"pid", 0, 0, 'p'},
//{"restart", 0, 0, 'R'}, //not used by users!
{"root-window", 0, 0, 'r'},
{"quit", 0, 0, 'q'},
{"sensitivity", 1, 0, 's'},
{"threshhold", 1, 0, 't'},
{"version", 0, 0, 'v'},
{"wheel-fifo", 2, 0, 'W'},
{"transpose", 0, 0, 'x'},
{0, 0, 0, 0}
};
const char *optionusage[][2]=
{ /*{argument name, usage}*/
{"delay-rate", "auto repeat until button release (default=250)"}, //a
{"grab-buttons", "Specify up to 6 remappings 0=none (default=456789)"}, //b
{NULL, "Open configuration helper window imediately"}, //c
{NULL, "Spit out all debugging info (it's a lot!)"}, //D
{NULL, "IMWHeel process doesn't detach from terminal"}, //d
{"display-name", "Sets X display to use (one per FIFO if FIFO used)"}, //X
{NULL, "Swaps buttons 4 and 5 events (same as -b 54"}, //4
{NULL, "Use event subwindow instead of XGetInputFocus"}, //f
{NULL, "Disable the use of Focus Events for button grabs"}, //g
{NULL, "For this help! Now you know"}, //h
{NULL, "Use the old key style default actions"}, //K
{NULL, "Kills the running imwheel process"}, //k
{NULL, "IMWheel doesn't use or check any pid files"}, //p
//{NULL, "RESERVED: used when imwheel reloads itself"}, //R
{NULL, "Allow wheeling in the root window (no cfg dialog)"}, //r
{NULL, "Don't start imwheel process, after args"}, //q
{"sum-min", "Stick devices require this much total movment (w/fifo)"}, //s
{"stick-min", "Stick devices require this much pressure (w/fifo)"}, //t
{NULL, "Show version info and exit"}, //v
{"fifo-path", "Use a GPM fifo instead of XGrabButton"}, //W
{NULL, "swap X and Y stick axis (w/fifo)"}, //x
{NULL, NULL}
};
int buttonFlip=False, useFifo=False, detach=True, quit=False,
restart=False, threshhold=0, focusOverride=True, sensitivity=0, transpose=False,
handleFocusGrab=True, doConfig=False, root_wheeling=False, autodelay=250,
keystyledefaults=0;
int fifofd=-1;
char *fifoName="/dev/gpmwheel", *displayName=NULL;
Bool grabbed;
Atom ATOM_NET_WM_NAME, ATOM_UTF8_STRING, ATOM_WM_NAME, ATOM_STRING;
/*----------------------------------------------------------------------------*/
int main(int argc, char **argv)
{
Display *d;
getOptions(argc,argv,opts,options);
setupstatebits();
if(!displayName)
displayName=XDisplayName(NULL);
Printf("display=%s\n",displayName);
d=start(displayName);
Printf("starting loop...\n");
eventLoop(d,argv);
Printf("ending...\n");
endItAll(d);
return(0); //not reached...
}
/*----------------------------------------------------------------------------*/
void endItAll(Display *d)
{
XUngrabButton(d, AnyButton, AnyModifier, DefaultRootWindow(d));
XCloseDisplay(d);
}
/*----------------------------------------------------------------------------*/
void grabButtons(Display *d, Window w)
{
int i;
if(useFifo)
return;
Printf("Grab buttons!\n");
grabbed=True;
for(i=0;i<NUM_BUTTONS;i++)
{
if(buttons[i])
{
Printf("Grabbing Button %d...\n",buttons[i]);
XGrabButton(
d,
buttons[i],
AnyModifier,
(w?w:DefaultRootWindow(d)),
False,
ButtonReleaseMask|ButtonPressMask,
GrabModeAsync, GrabModeAsync,
None,
None
);
}
}
}
/*----------------------------------------------------------------------------*/
void ungrabButtons(Display *d, Window w)
{
int i;
if(useFifo)
return;
Printf("Ungrab buttons!\n");
XSync(d,False);
grabbed=False;
for(i=0;i<NUM_BUTTONS;i++)
{
if(buttons[i])
{
Printf("Ungrabbing Button %d...\n",buttons[i]);
XUngrabButton(
d,
buttons[i],
AnyModifier,
(w?w:DefaultRootWindow(d))
);
}
}
XUngrabButton(d, AnyButton, AnyModifier, (w?w:DefaultRootWindow(d)));
//XAllowEvents(d,AsyncBoth,CurrentTime);
XSync(d,False);
}
/*----------------------------------------------------------------------------*/
Display *start(char *display)
{
Display *d;
wa=getRC();
d=XOpenDisplay(display);
if(!d)
{
fprintf(stderr,"Could not open display, check shell DISPLAY variable, and export or setenv it!\n");
exit(1);
}
ATOM_NET_WM_NAME = XInternAtom(d, "_NET_WM_NAME", True);
ATOM_UTF8_STRING = XInternAtom(d, "UTF8_STRING", True);
ATOM_WM_NAME = XInternAtom(d, "WM_NAME", True);
ATOM_STRING = XInternAtom(d, "STRING", True);
XAllowEvents(d,AsyncBoth,CurrentTime);
//XAllowEvents(d,SyncBoth,CurrentTime);
if(!useFifo)
{
grabButtons(d,0);
XSelectInput(d,DefaultRootWindow(d),PointerMotionMask);
}
return(d);
}
/*----------------------------------------------------------------------------*/
signed char getInput(Display *d, XEvent *e, XModifierKeymap **xmk, signed char km[32])
{
static int st_sum_x=0, st_sum_y=0;
signed char button;
button=0;
e->type=0;
if(!useFifo)
{
//Printf("getInput: XNextEvent...\n");
XNextEvent(d,e);
//Printf("getInput: Got XNextEvent.\n");
}
else
{
Printf("getInput: read fifo...\n");
memset(e,0,sizeof(XEvent));
e->xany.display=d;
if(!(read(fifofd,&button,1)))
{
close(fifofd);
Printf("getInput: Must reopen the GPM fifo...\n");
openFifo();
return(0);
}
if(button<0x10) // single button
{
Printf("getInput: single button=%d\n",button);
e->xbutton.button=button;
e->type=ButtonPress;
}
else if(button==0x10) // stick x y are next...
{
Printf("getInput: stick\n");
// must do more for stick...this at least emu's up and down...
Printf("getInput: Stick action, reading x and y values from fifo...\n");
memcpy(&old_stick, &stick, 2);
// read in separate bytes, to avoid an incomplete read!
if(transpose)
{
read(fifofd,&stick.y,1);
read(fifofd,&stick.x,1);
}
else
{
read(fifofd,&stick.x,1);
read(fifofd,&stick.y,1);
}
Printf("getInput: Stick=(%d,%d)\n",stick.x,stick.y);
if(sensitivity>0)
{ // do thresholded summation then test with sensitivity value
if(ABS(stick.y)>=threshhold||ABS(stick.x)>=threshhold)
{
if((stick.x>0 && st_sum_x<0) || (stick.x<0 && st_sum_x>0))
st_sum_x = 0;
if((stick.y>0 && st_sum_y<0) || (stick.y<0 && st_sum_y>0))
st_sum_y = 0;
st_sum_x += stick.x;
st_sum_y += stick.y;
if(ABS(st_sum_x) > sensitivity)
{
e->xbutton.button=(stick.x>0?6:7);
e->type=ButtonPress;
st_sum_x = 0;
}
else if(ABS(st_sum_y) > sensitivity)
{
e->xbutton.button=(stick.y>0?4:5);
e->type=ButtonPress;
st_sum_y = 0;
}
}
}
else // do just threshold testing
{
/* commented sections here would add time as a factor in the testing
* preventing events from being generated too fast for apps to react
* to in a feasible manner. This should also be based on the two
* delays given in the imwheelrc file for the current application,
* but that code cannot be here, and must be added to the code after
* the application has been found in the winaction list using findWA.
static struct timeval ntv={0,0},otv={0,0};
static unsigned long dt=0;
#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&ntv,NULL);
#endif
if(!otv.tv_sec)
memcpy(&otv,&ntv,sizeof(struct timeval));
dt=((ntv.tv_sec-otv.tv_sec)*1000000)+(ntv.tv_usec-otv.tv_usec);
*/
if(((ABS(old_stick.y)<threshhold&&ABS(old_stick.x)<threshhold &&
(ABS(stick.y)>=threshhold || ABS(stick.x)>=threshhold) &&
(stick.x+stick.y!=0)) ||
!threshhold)
/*|| dt<0 || dt>500000*/)
{
//memcpy(&otv,&ntv,sizeof(struct timeval));
if(ABS(stick.x) <= ABS(stick.y)) /* tend to be up/down... */
{
e->xbutton.button=(stick.y>0?4:5);
e->type=ButtonPress;
}
else
{
e->xbutton.button=(stick.x<0?6:7);
e->type=ButtonPress;
}
}
}
}
}
if(e->type==ButtonPress
&& (isUsedButton(e->xbutton.button) || (!useFifo && grabbed)))
{
//e->xbutton.button^=buttonFlip;
button= buttonIndex(e->xbutton.button);
if(button<NUM_BUTTONS)
e->xbutton.button= button= button+4;
XQueryKeymap(d,km);
if(debug)
printKeymap(d,km);
*xmk=XGetModifierMapping(d);
if(debug)
printXModifierKeymap(d,*xmk);
}
else
{
e->xbutton.button=button=0;
e->type=None;
}
if(handleFocusGrab && e->type==FocusOut && (!useFifo && !grabbed))
{
// the focus is leaving the @Exclude´d window,
// so we want to grab the buttons again
grabButtons(d,0);
// we don't need any further events from that window for now
// we asked for events during ungrab...below
XSelectInput(d, e->xany.window, NoEventMask);
}
if(e->type==ButtonPress)
Printf("getInput: Button=%d\n",button);
return(button);
}
/*----------------------------------------------------------------------------*/
void openCfg(Display *d, char **argv, XModifierKeymap **xmk)
{
int i;
Printf("Going to configuration...\n");
if(!useFifo && grabbed)
{
ungrabButtons(d,0);
ungrabButtons(d,0);
}
if(cfg(useFifo?fifofd:-1))
{
char **nargv=NULL;
Printf("Configuration changed...\n");
Printf("Restarting %s...\n",argv[0]);
freeAllX(&xch,xmk,&wname);
for(i=0;argv[i];i++)
{
nargv=realloc(nargv,sizeof(signed char*)*(i+3));
if(argv[i][0]=='-' && argv[i][1]!='-')
{
char *p;
while((p=strchr(argv[i],'c')))
memmove(p,p+1,strlen(p));
}
if(!strcmp(argv[i],"--config"))
{
int j;
for(j=i;argv[j];j++)
argv[j]=argv[j+1];
}
nargv[i]=argv[i];
}
if(!restart)
nargv[i++]=strdup("-R");
nargv[i]=NULL;
execvp(nargv[0],nargv); // run me over me!
fprintf(stderr,"%s: Restart failed!\n",nargv[0]);
perror(argv[0]);
exit(1);
}
if(!useFifo && !grabbed)
grabButtons(d,0);
if(useFifo)
openFifo();
Printf("No change in configuration\n");
}
/*----------------------------------------------------------------------------*/
void eventLoop(Display *d, char **argv)
{
XEvent e;
Window pointer_window=0, pointer_rwindow=0;
int j;
XModifierKeymap *xmk=NULL;
signed char km[32],button;
struct WinAction *wap=NULL, *ungrabwap=NULL, *grabwap=NULL;
Window oldw=0;
int isdiffwin;
struct {time_t t; int motion;} history[HISTORY_LENGTH];
XSetErrorHandler((XErrorHandler)nullXError);
if(doConfig)
openCfg(d,argv,&xmk);
memset(history,0,sizeof(history));
while(True)
{
int i;
if(!useFifo || !wap || wap->reps) // auto-repeat kinda eats fifo events :(
getInput(d,&e,&xmk,km);
if(!e.type)
continue;
button=e.xbutton.button;
//get current input window & it's name
i=CurrentTime;
if(focusOverride || !e.xbutton.subwindow) //not up to ICCCM standards
// focusOverride: default is true, so this is the default action
XGetInputFocus(d,&e.xbutton.subwindow,&i);
else
{ /* pulled from xwininfo */
Window root,window=e.xbutton.subwindow;
int dummyi;
unsigned int dummy;
if (e.xbutton.subwindow && XGetGeometry (d, e.xbutton.subwindow, &root, &dummyi, &dummyi,
&dummy, &dummy, &dummy, &dummy) && window != root)
{
window = XmuClientWindow (d, e.xbutton.subwindow);
}
e.xbutton.subwindow = window;
i=0;
}
#ifdef DEBUG
if(debug)
printXEvent(&e);
#endif
if(e.xbutton.subwindow)
{
Window root=0,win=e.xbutton.subwindow;
wname=windowName(d,e.xbutton.subwindow);
if(!wname)
do
{
Window *kids;
int nkids;
if(XQueryTree(d,e.xbutton.subwindow,&root,&win,&kids,&nkids))
{
if(e.xbutton.subwindow!=win)
{
e.xbutton.subwindow=win;
wname=windowName(d,e.xbutton.subwindow);
#ifdef DEBUG
if(wname)
Printf("Found window name in a parent!\n");
#endif
}
if(kids)
XFree(kids);
}
Printf("w:%p r:%p ew:%p et:%d\n",win, root, e.xbutton.subwindow, e.type);
} while(!wname && root!=win && root);
}
isdiffwin=(e.xbutton.subwindow!=oldw);
oldw=e.xbutton.subwindow;
if(e.xbutton.subwindow)
XGetClassHint(d,e.xbutton.subwindow,&xch);
else
{
xch.res_name=emptystr;
xch.res_class=emptystr;
}
switch(e.type) // this section preempts unnecessary processing...
{
case MotionNotify:
if(!useFifo && !isdiffwin && !grabbed)
continue;
case ButtonPress:
if(isdiffwin || e.type==ButtonPress)
{
Printf("ButtonPress:window=%x(%x)\n",e.xbutton.subwindow, e.xbutton.window);
if(!e.xbutton.subwindow)
{
Printf("(null)\n");
wname=NULL;
}
//Printf("\trevert_to=%d\n",i);
// get resource and class names
Printf("resource name =\"%s\"\n",xch.res_name);
Printf("class name =\"%s\"\n",xch.res_class);
}
break;
}
if (!wname) wname = strdup(emptystr);
if (!xch.res_name) xch.res_name = strdup(emptystr);
if (!xch.res_class) xch.res_class = strdup(emptystr);
ungrabwap=0;
grabwap=0;
if(!useFifo)
{
if(isdiffwin || e.type==ButtonPress)
{
ungrabwap=findWA(d,UNGRAB,
wname,
xch.res_name,
xch.res_class,
NULL,NULL);
if(ungrabwap)
grabwap=findWA(d,GRAB,
wname,
xch.res_name,
xch.res_class,
NULL,NULL);
if(grabwap)
{
Printf("Action defined for window overrides ungrab command\n");
ungrabwap=0;
}
}
#ifdef DEBUG
Printf("useFifo=%d\n",useFifo);
Printf("ungrabwap=%p\n",ungrabwap);
Printf("grabwap=%p\n",grabwap);
Printf("grabbed=%d\n",grabbed);
Printf("e.type=%d\n",e.type);
#endif
if(ungrabwap && grabbed && (e.type==ButtonPress || e.type==FocusIn || !e.type))
e.type=MotionNotify;
// force a regrab try
if(!ungrabwap && !grabwap && !grabbed && isdiffwin)
e.type=MotionNotify;
}
switch(e.type) // now we actually do something!
{
case MotionNotify:
Printf("MotionNotify\n");
if(!useFifo)
{
if(grabbed && ungrabwap)
{
ungrabButtons(d,0);
if(handleFocusGrab)
{
// notify us when the focus leaves this window
XSelectInput(d, e.xbutton.subwindow,
FocusChangeMask);
}
}
else
if(!grabbed)
grabButtons(d,0);
}
break;
case ButtonPress:
Printf("ButtonPress\n");
XQueryPointer(d,DefaultRootWindow(d),&pointer_rwindow,&pointer_window,&i,&i,&i,&i,&i);
// Update history
for(i=0;i<HISTORY_LENGTH-1;i++)
{
history[i].motion=history[i+1].motion;
history[i].t=history[i+1].t;
}
history[HISTORY_LENGTH-1].motion=button;
history[HISTORY_LENGTH-1].t =time(NULL);
// Configure if in root and toggling wheel
if(!pointer_window)
{
if(root_wheeling)
{
wap=findWA(d,button,"(root)","(root)","(root)",xmk,km);
if(strcmp(wap->id,"\\(root\\)"))
continue; //no root action defined!
}
else
{
for(j=1,i=0;j&&i<HISTORY_LENGTH;i++)
j=(history[i].motion%2==i%2);
if(j && history[HISTORY_LENGTH-1].t-history[0].t < CONFIG_TIME)
{
openCfg(d,argv,&xmk);
memset(history,0,sizeof(history));
}
else
Printf("No config...\n");
continue; // No wheel actions needed in root window!
}
}
else
wap=findWA(d,button,wname,xch.res_name,xch.res_class,xmk,km);
XTestGrabControl(d,True);
if(!wap)
{
Printf("Taking default action.\n");
if(!keystyledefaults)
{
char* in[1]={0};
char* out[2]={0,0};
char bstr[9];
struct WinAction wa={0,wname,button,in,out,1,0,0};
snprintf(bstr,9,"Button%-2d",button);
out[0]=bstr;
doWA(d,(XButtonEvent*)&e.xbutton,xmk,km,&wa);
}
else
{ /* old key style... */
char* in[1]={0};
char* out[2]={0,0};
struct WinAction wa={0,wname,button,in,out,1,0,0};
int k;
j=button-4;
if(j>=NUM_BUTTONS)
{
Printf("No we aren't because j(%d) is >= NUM_BUTTONS(%d)!\n",j,NUM_BUTTONS);
break;
}
k=statebits[makeModMask(xmk,km)&STATE_MASK];
if(k>=1<<NUM_STATES)
{
Printf("No we aren't because k(%d) is >= 1<<NUM_STATES(%d)!\n",k,1<<NUM_STATES);
break;
}
out[0]=(char*)keys[j][k];
wa.reps=reps[k];
doWA(d,(XButtonEvent*)&e.xbutton,xmk,km,&wa);
/* old code...
int kc=XKeysymToKeycode(d, XStringToKeysym(keys[j][k]));
Printf("keycode=%d\n",kc);
for(i=0;i<reps[k]; i++)
{
Printf("rep=%d key='%s'\n",i,keys[j][k]);
//XSetInputFocus(d,e.xbutton.subwindow,RevertToParent,CurrentTime);
modMods(d,km,xmk,False,0);
XTestFakeKeyEvent(d,kc,True,0);
XTestFakeKeyEvent(d,kc,False,0);
XSync(d,False);
modMods(d,km,xmk,True,0);
XSync(d,False);
} // rep loop
*/
}
}
else
doWA(d,(XButtonEvent*)&e.xbutton,xmk,km,wap);
XTestGrabControl(d,False);
//XQueryPointer(d,DefaultRootWindow(d),&e.xbutton.subwindow,&e.xbutton.subwindow,&i,&i,&i,&i,&i);
//XSetInputFocus(d,e.xbutton.subwindow,RevertToParent,CurrentTime);
break;
}
freeAllX(&xch,&xmk,&wname);
} // infinite loop
}
/*----------------------------------------------------------------------------*/
void freeAllX(XClassHint *xch, XModifierKeymap **xmk, char **wname)
{
if(xch)
{
if(xch->res_name && xch->res_name!=emptystr)
{
XFree(xch->res_name);
xch->res_name=NULL;
}
if(xch->res_class && xch->res_class!=emptystr)
{
XFree(xch->res_class);
xch->res_class=NULL;
}
}
if(xmk && *xmk)
{
XFreeModifiermap(*xmk);
*xmk=NULL;
}
if(wname && *wname)
{
XFree(*wname);
*wname=NULL;
}
}
/*----------------------------------------------------------------------------*/
int *nullXError(Display *d, XErrorEvent *e)
{
signed char errorstr[1024];
grabbed=False;
Printf("XError: \n");
Printf("\tserial : %lu\n",e->serial);
Printf("\terror_code : %u\n",e->error_code);
Printf("\trequest_code: %u\n",e->request_code);
Printf("\tminor_code : %u\n",e->minor_code);
Printf("\tresourceid : %lu\n",e->resourceid);
XGetErrorText(d,e->error_code,errorstr,1024);
Printf("\terror string: %s\n",errorstr);
return(0);
}
/*----------------------------------------------------------------------------*/
/* vim:ts=4:shiftwidth=4
"*/

27
imwheel.h Normal file
View File

@ -0,0 +1,27 @@
/* IMWheel Header File for more private functions
* Copylefted under the Linux GNU Public License
* Author : Jonathan Atkins <jcatki@jonatkins.org>
* PLEASE: contact me if you have any improvements, I will gladly code good ones
*/
#ifndef IMWHEEL_H
#define IMWHEEL_H
signed char getInput(Display *d, XEvent *e, XModifierKeymap **xmk, signed char km[32]);
void grabButtons(Display *d, Window w);
void ungrabButtons(Display *d, Window w);
void freeAllX(XClassHint *xch, XModifierKeymap **xmk, char **wname);
typedef struct
{
signed char x,y;
} Stick;
extern const char *optionusage[][2];
extern Bool grabbed;
extern int buttonFlip, useFifo, detach, quit, restart, threshhold,
focusOverride, sensitivity, transpose, handleFocusGrab, doConfig,
root_wheeling, autodelay, keystyledefaults;
extern int fifofd;
extern char *fifoName, *displayName;
extern Stick stick;
#endif

65
imwheel.spec Normal file
View File

@ -0,0 +1,65 @@
#
# Define some variables here
#
%define version 0.9.9pre6
%define prefix /usr/X11
%define cfg /etc/X11
%define ins /usr/bin/install
%define bz2 /usr/bin/bzip2
#
# imwheel.spec
# Rob Ludwick
# 06/04/00
#
Summary: A utility to make wheel mice work under X
Name: imwheel
Version: %{version}
Release: 1
Copyright: GPL
Group: User Interface/X Hardware Support
Source: http://www.jonatkins.org/imwheel/files/imwheel-%{version}.tar.gz
URL: http://www.jonatkins.org/imwheel
Packager: Rob Ludwick <rludwick@users.sourceforge.net>
BuildRoot: /tmp/imwheel
%description
This is the imwheel utility for X. It supports a variety of
wheel mice including the MS Intellimouse.
%prep
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT
%setup
%build
./configure --bindir=%{prefix}/bin --disable-gpm --sysconfdir=%{cfg}
make all
%install
mkdir -p $RPM_BUILD_ROOT%{prefix}/bin $RPM_BUILD_ROOT%{prefix}/man/man1 $RPM_BUILD_ROOT%{prefix}/etc
/usr/bin/install -c -d -o root -g root -m 0755 $RPM_BUILD_ROOT%{prefix}/bin
/usr/bin/install -c -o root -g root -m 0755 imwheel $RPM_BUILD_ROOT%{prefix}/bin/imwheel
/usr/bin/install -c -d -o root -g root -m 0755 $RPM_BUILD_ROOT%{prefix}/man/man1
/usr/bin/install -c -o root -g root -m 0644 imwheel.1 $RPM_BUILD_ROOT%{prefix}/man/man1/imwheel.1x
%{bz2} -9 $RPM_BUILD_ROOT%{prefix}/man/man1/imwheel.1x
/usr/bin/install -c -d -o root -g root -m 0755 $RPM_BUILD_ROOT/%{cfg}
/usr/bin/install -c -o root -g root -m 0644 imwheelrc $RPM_BUILD_ROOT/%{cfg}/imwheelrc
%files
%config %{cfg}/imwheelrc
%attr(0755, root, root) %{prefix}/bin/imwheel
%{prefix}/man/man1/imwheel.1x.bz2
%doc BUGS ChangeLog M-BA47 NEWS COPYING EMACS README TODO AUTHORS INSTALL
%clean
%post
%postun
%Changelog
* Sun Jun 04 2000 <rludwick@users.sourceforge.net>
-- Initial Version (based off the Mandrake 6 spec file by Peter Putzer)

386
imwheelrc Normal file
View File

@ -0,0 +1,386 @@
# IMWheel Configuration file ($HOME/.imwheelrc or /etc/imwheelrc)
# (GPL)Jon Atkins <jcatki@jonatkins.org>
# Please read the README and/or imwheel(1) manpage for info
# and this is best operated on using vim (as I said: It's crunchy)
#
# This is only for demonstration of the priority command...
# See the other global Exclude command below for the one you want to use!
# If this is activated it will only apps that have a lower priority
# priority is based first on the priority command, then the position in this
# file - the higher the line is in a file the higher in a priority class it is
# thus for a default priority you can see that the position in the file is
# important, but the priority command CAN appear anywahere in a window's list
# of translations, and the priority will be assigned to all translations below
# it until either a new window is defined or the priority is set again.
#
#".*"
#@Priority=-1000 #the default priority is zero, higher numbers take precedence
#@Exclude
#@Repeat
# want it to type something?
# this would type "Rofl" and press Return in any window
#".*"
#,Up,Shift_L|R|-R|-Shift_L|O|-O|F|-F|L|-L|Return
# This one rule can send button events, as if you used ZAxisMapping "4 5"
# Make sure your XF86Config allows for the max buttons needed...
# otherwise the events will NOT even be generated...
#".*"
#, Up, Button4
#, Down, Button5
#, Left, Button6
#, Right, Button7
#, Thumb1, Button6
#, Thumb2, Button7
# alternatively with Button numbers
#".*"
#, Button4, Button4
#, Button5, Button5
#, Button6, Button6
#, Button7, Button7
#, Button6, Button6
#, Button7, Button7
#Thanks to Mathias Weyland <mathias@weyland-wtal.de>
"^mutt.*"
None, Up, Up
None, Down, Down
Control_L, Up, Page_Up
Control_L, Down, Page_Down
#Thanks to Mathias Weyland <mathias@weyland-wtal.de>
"^aterm"
None, Up, Shift_L|Page_Up
None, Down, Shift_L|Page_Down
Control_L, Up, Up
Control_L, Down, Down
#Thanks to Mathias Weyland <mathias@weyland-wtal.de>
"^Xplns"
None, Up, Left
None, Down, Right
Control_L, Up, Up
Control_L, Down, Down
"^kvt"
None, Up, Shift_L|Page_Up
None, Down, Shift_L|Page_Down
"^Konsole"
None, Up, Shift_L|Page_Up
None, Down, Shift_L|Page_Down
"^XMcd"
None, Up, C
None, Down, Shift_L|C
"^XMMS_Player"
Shift_L, Up, Right
Shift_L, Down, Left
"^XMMS_Playlist"
Shift_L, Up, Page_Up
Shift_L, Down, Page_Down
"^xmms"
Alt_L, Up, Z
Alt_L, Down, B
Control_L, Up, V
Control_L, Down, C
"^XATITV-GATOS"
None, Down, KP_Subtract
None, Up, KP_Add
"^Xman"
None, Down, F
Shift_L, Down, 3
None, Up, B
"^Gvi(m|ew)"
Alt_L, Up, Page_Up
Alt_L, Down, Page_Down
Shift_L, Up, Control_L|Y
Shift_L, Down, Control_L|E
#None, Up, Page_Up
#None, Down, Page_Down
#, Up, Button4
#, Down, Button5
, Left, Shift_L|Left
, Right, Shift_L|Right
, Thumb1, Shift_L|Left
, Thumb2, Shift_L|Right
"^VIM"
Shift_L, Up, Control_L|Y
Shift_L, Down, Control_L|E
#None, Up, Page_Up
#None, Down, Page_Down
"^Eterm"
Alt_L, Up, Up
Alt_L, Down, Down
#Alt_L, Up, Shift_L|Page_Up
#Alt_L, Down, Shift_L|Page_Down
#"^GnomeTerminal"
#@Exclude
#@Repeat
#None, Up, Shift_L|Page_Up
#None, Down, Shift_L|Page_Down
"^NXTerm"
None, Up, Shift_L|Page_Up
None, Down, Shift_L|Page_Down
"^rxvt"
Alt_L, Up, Shift_L|Page_Up
Alt_L, Down, Shift_L|Page_Down
"^XTerm"
Alt_L, Up, Shift_R|Page_Up
Alt_L, Down, Shift_R|Page_Down
Alt_L, Left, Control_L|A
Alt_L, Right, Control_L|E
#Shift_L, Down, Shift_L|1
"^VMware"
@Exclude
#@Repeat
"^Mozilla-bin$"
#, Up, Button4
#, Down, Button5
#, Left, Alt_L|Left
#, Right, Alt_L|Right
#
# If you want to scroll by a few lines then uncomment these 4 lines
# and comment out the paging 4 lines below these!
#
Shift_L, Down, Page_Down, 1#, 1000, 1000
Shift_L, Up, Page_Up, 1#, 1000, 1000
#None, Down, Down, 7#, 1000, 1000
#None, Up, Up, 7#, 1000, 1000
#
# If you don't like page scrolling then comment these out and uncomment above!
#
#Shift_L, Down, Down, 7,
#Shift_L, Up, Up, 7,
#None, Down, Page_Down, 1,
#None, Up, Page_Up, 1,
# Left/Right & Thumb stuff
None, Left, Left, 7,
None, Right, Right, 7,
None, Thumb1, Down, 7,
Shift_L, Thumb1, Up, 7,
None, Thumb2, Up, 7,
Shift_L, Thumb2, Down, 7,
"^Freespace.*"
, Up, Y
, Down, X
, Thumb1, H
, Thumb2, R
"^SDL_App"
#, Up, Button4
#, Down, Button5
, Thumb1, Home #many apps don't understand Button > 5
, Thumb2, End #many apps don't understand Button > 5
# Thanks to shewp <shewplx@pblx.net>
"^Opera"
#@Repeat # let qt do it
None, Down, Down, 4, 100, 100
None, Up, Up, 4, 100, 100
None, Thumb1, Right
None, Thumb2, Left
"^Netscape.*"
, Thumb1, Alt_L|KP_Left
, Thumb2, Alt_L|KP_Right
#, Up, Button4
#, Down, Button5
"^Netscape"
#
# If you don't want to scroll by a few lines then comment out these 4 lines
# and uncomment the paging 4 lines below these!
#
Shift_L, Down, Page_Down, 1, 1000, 1000
Shift_L, Up, Page_Up, 1, 1000, 1000
None, Down, Down, 7, 1000, 1000
None, Up, Up, 7, 1000, 1000
#
# If you don't like page scrolling then uncomment these
# and comment out the 4 lines above!
#
#Shift_L, Down, Shift_L|Down, 7, 1000, 1000
#Shift_L, Up, Shift_L|Up, 7, 1000, 1000
#None, Down, Page_Down, 1, 1000, 1000
#None, Up, Page_Up, 1, 1000, 1000
# Left/Right & Thumb stuff
None, Left, Left, 7, 1000, 1000
None, Right, Right, 7, 1000, 1000
None, Thumb1, Down, 7, 1000, 1000
Shift_L, Thumb1, Up, 7, 1000, 1000
None, Thumb2, Up, 7, 1000, 1000
Shift_L, Thumb2, Down, 7, 1000, 1000
"^Navigator"
#Alt_L, Down, Alt_L|Right
#Alt_L, Up, Alt_L|Left
Alt_L, Down, Right, 10, 1000, 1000
Alt_L, Up, Left, 10, 1000, 1000
# Thanks to Paul J Collins <sneakums@usa.net>
"^emacs"
Shift_L, Up, Page_Up
Shift_L, Down, Page_Down
# you may need Alt instead of Meta....
None, Down, Control_L|Meta_L|Shift_L|parenright
None, Up, Control_L|Meta_L|Shift_L|parenleft
# Thanks to etienne grossmann <etienne@isr.ist.utl.pt>
"^Xftp"
, Down, j
, Up, k
".* - Pan$"
, Left, Control_L|Button1
, Thumb1, Control_L|Button1
#, Up, Button4
#, Down, Button5
# Thanks to etienne grossmann <etienne@isr.ist.utl.pt>
"^gv[ :]"
None, Up, Shift_L|space
None, Down, space
#"^Event Tester"
#@Repeat
#@Exclude
#, Left, Button6
#, Right, Button7
#, Thumb1, Button8
#, Thumb2, Button9
"^xv grab"
@Priority=1
@Exclude
"^XV.*"
None, Down, Tab
None, Up, Delete
"^Untitled"
# if using wheel fifo, you may switch these.
#, Up, Button4
#, Down, Button5
#with these
, Up, Page_Up
, Down, Page_Down
# (end of switch)
, Thumb1, Home
, Thumb2, End
"^No Title"
# if using wheel fifo, you may switch these.
#, Up, Button4
#, Down, Button5
#with these
, Up, Page_Up
, Down, Page_Down
# (end of switch)
, Left, Home
, Right, End
, Thumb1, Home
, Thumb2, End
#"\(null\)"
# if using wheel fifo, you may want the 2nd group
#, Up, Button4
#, Down, Button5
#, Left, Button6
#, Right, Button7
#, Thumb1, Button8
#, Thumb2, Button9
# 2nd group (old keys...)
#, Up, Page_Up
#, Down, Page_Down
#, Left, Home
#, Right, End
#, Thumb1, Home
#, Thumb2, End
# (end of switch)
# send event to the window manager when in the root window...
"\(root\)"
, Up, Control_L|N
, Down, Control_L|P
, Thumb1, Alt_L|Left
, Thumb2, Alt_L|Right
#
# Uncommment the following to exclude by default.
# Then you will have to add new apps all the time, but will retain any built-in
# wheel functionality contained in some KDE and other newer programs.
# This kinda defeats the original purpose of the program! ;)
#
#".*"
#@Priority=-1000
#@Exclude
#@Repeat
#
# These are the defaults, but note that the defaults for the right side of the
# keyboard are still handled within the program, unless you add the
# combinations desired here. (except for the None modifier of course!)
# If this section is deleted then the hardcoded defaults will be used, which
# are the same thing.
# Modifying these has global effects, but doesn't override what is above.
#
#".*"
#@Priority=-1001
#, Up, Button4
#, Down, Button5
#None, Left, Left
#None, Right, Right
#None, Up, Page_Up
#None, Down, Page_Down
#Shift_L, Left, Left
#Shift_L, Right, Right
#Shift_L, Up, Up
#Shift_L, Down, Down
# Control_L, Left, Left, 2
# Control_L, Right, Right, 2
# Control_L, Up, Page_Up, 2
# Control_L, Down, Page_Down, 2
#Shift_L|Control_L, Left, Left, 5
#Shift_L|Control_L, Right, Right, 5
#Shift_L|Control_L, Up, Page_Up, 5
#Shift_L|Control_L, Down, Page_Down, 5
# Alt_L, Left, Left, 10
# Alt_L, Right, Right, 10
# Alt_L, Up, Left, 10
# Alt_L, Down, Right, 10
#Shift_L| Alt_L, Left, Left
#Shift_L| Alt_L, Right, Right
#Shift_L| Alt_L, Up, Left
#Shift_L| Alt_L, Down, Right
# Control_L|Alt_L, Left, Left. 20
# Control_L|Alt_L, Right, Right. 20
# Control_L|Alt_L, Up, Left. 20
# Control_L|Alt_L, Down, Right. 20
#Shift_L|Control_L|Alt_L, Left, Left, 50
#Shift_L|Control_L|Alt_L, Right, Right, 50
#Shift_L|Control_L|Alt_L, Up, Left, 50
#Shift_L|Control_L|Alt_L, Down, Right, 50
#, Thumb1, Home
#, Thumb2, End
# vim:ts=4:shiftwidth=4:syntax=sh

251
install-sh Executable file
View File

@ -0,0 +1,251 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

3
jax/Makefile.am Normal file
View File

@ -0,0 +1,3 @@
AM_CFLAGS=@CFLAGS@ @X_CFLAGS@
noinst_LIBRARIES=libjax.a
libjax_a_SOURCES=jax.c jax.h

396
jax/Makefile.in Normal file
View File

@ -0,0 +1,396 @@
# Makefile.in generated by automake 1.9 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
SOURCES = $(libjax_a_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = jax
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
AR = ar
ARFLAGS = cru
libjax_a_AR = $(AR) $(ARFLAGS)
libjax_a_LIBADD =
am_libjax_a_OBJECTS = jax.$(OBJEXT)
libjax_a_OBJECTS = $(am_libjax_a_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libjax_a_SOURCES)
DIST_SOURCES = $(libjax_a_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GETOPT_INCS = @GETOPT_INCS@
GETOPT_LIBS = @GETOPT_LIBS@
GPM_DIR = @GPM_DIR@
HAVE_GPM_SRC = @HAVE_GPM_SRC@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
NO_GPM_DOC_FALSE = @NO_GPM_DOC_FALSE@
NO_GPM_DOC_TRUE = @NO_GPM_DOC_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SUID_FALSE = @SUID_FALSE@
SUID_TRUE = @SUID_TRUE@
VERSION = @VERSION@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
extras = @extras@
extras_dist = @extras_dist@
getopt = @getopt@
getopt_dist = @getopt_dist@
gpm_dist = @gpm_dist@
gpm_imwheel = @gpm_imwheel@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mdetect = @mdetect@
mdetect_dist = @mdetect_dist@
mdump = @mdump@
mdump_dist = @mdump_dist@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
suid = @suid@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
AM_CFLAGS = @CFLAGS@ @X_CFLAGS@
noinst_LIBRARIES = libjax.a
libjax_a_SOURCES = jax.c jax.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu jax/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu jax/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libjax.a: $(libjax_a_OBJECTS) $(libjax_a_DEPENDENCIES)
-rm -f libjax.a
$(libjax_a_AR) libjax.a $(libjax_a_OBJECTS) $(libjax_a_LIBADD)
$(RANLIB) libjax.a
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jax.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LIBRARIES)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

385
jax/jax.c Normal file
View File

@ -0,0 +1,385 @@
#include <stdio.h>
#include "jax.h"
/*****************************************************************************/
/* Option Handling */
/*****************************************************************************/
int JAXusage(Jax *jax, char *prog_name, char *usage)
{
int j;
fprintf(stderr,"%s",prog_name);
for(j=0;j<jax->num_options;j++)
{
if(*jax->options[j].str)
fprintf(stderr," [%s|%s <%s>]",jax->options[j].name1,jax->options[j].name2,*jax->options[j].str);
else
fprintf(stderr," [%s|%s]",jax->options[j].name1,jax->options[j].name2);
fflush(stderr);
}
fprintf(stderr," %s\n",usage);
return jax->num_options;
}
int JAXshiftopts(int base, int shift, int *argc, char **argv)
{
int i;
for(i=base+shift;i<(*argc);i++)
{
argv[i-shift]=argv[i];
}
(*argc)=(*argc)-shift;
return(1);
}
int JAXgetopts(Jax *jax, int *argc, char **argv)
{
int i,j,c=0;
if(!argc || !argv)
return(-1);
jax->dname=NULL;
for (i=1;i<(*argc);i++)
{
for(j=0;j<jax->num_options && i<(*argc);j++)
{
if ((jax->options[j].name1 && !strcmp(jax->options[j].name1, argv[i])) ||
(jax->options[j].name2 && !strcmp(jax->options[j].name2, argv[i])))
{
c++;
if((int)(*jax->options[j].str)>1)
{
if (*argc>i+1)
{
*jax->options[j].str=argv[i+1];
JAXshiftopts(i, 2, argc, argv);
j=-1;
}
else
{
fprintf(stderr,"Option \"%s\" needs a value.\n",argv[i]);
return(0);
}
}
else
{
*jax->options[j].str=(char*)(((int)(*jax->options[j].str+1))%2);
JAXshiftopts(i, 1, argc, argv);
j=-1;
}
}
}
if (i+1<(*argc) && !strcmp(argv[i],"-display"))
{
jax->dname=argv[i+1];
JAXshiftopts(i, 2, argc, argv);
}
if (i+1<(*argc) && !strcmp(argv[i],"-geometry"))
{
jax->geometry=argv[i+1];
JAXshiftopts(i, 2, argc, argv);
}
}
return(c?c:-1);
}
int JAXgetrdb(Jax *jax) /* 91 */
{
/*char rfilename[80];
char *type;
XrmValue xrmvalue;
XrmDatabase rdb;*/
return(1);
}
/*****************************************************************************/
/* Jax main stuff */
/*****************************************************************************/
Jax *JAXnewjax()
{
Jax *jax;
jax=(Jax*)malloc(sizeof(Jax));
memset(jax,0,sizeof(Jax));
return(jax);
}
Jax *JAXinit(int *argc, char **argv, Jax_Params *rdb, Jax_Params *options)
{
Jax *jax;
int i;
jax=JAXnewjax();
jax->resources=rdb;
if (rdb)
{
for(i=0;rdb[i].name1!=NULL;i++);
jax->num_resources=i;
JAXgetrdb(jax);
}
jax->options=options;
if (options)
{
for(i=0;options[i].name1!=NULL;i++);
jax->num_options=i;
}
if(!JAXgetopts(jax, argc, argv))
{
fprintf(stderr,"Argument error\n");
JAXusage(jax, argv[0], "");
free(jax);
return(0);
}
if(!(jax->d=XOpenDisplay(jax->dname)))
{
printf("Error opening display.\n");
free(jax);
return(0);
}
jax->s=DefaultScreen(jax->d);
return(jax);
}
int JAXopenrootwin(Jax *jax)
{
if(!jax)
return(0);
jax->w=DefaultRootWindow(jax->d);
JAXgetxwa(jax);
jax->cmap=DefaultColormap(jax->d, DefaultScreen(jax->d));
return(1);
}
int JAXcreatewin(Jax *jax, int x, int y, int w, int h, char *winName,
char *iconName, int argc, char **argv)
{
if(!jax)
return(0);
if(!(jax->w=XCreateSimpleWindow(jax->d, DefaultRootWindow(jax->d), x, y, w, h, 0, JAXwhite(jax), JAXblack(jax))))
{
fprintf(stderr,"Error creating window!\n");
return(0);
}
if(!(jax->xch=XAllocClassHint()))
{
fprintf(stderr,"Error allocating class hints!\n");
return(0);
}
jax->xch->res_name=(argv?argv[0]:"");
jax->xch->res_class=(argv?argv[0]:"");
if(!XStringListToTextProperty(&winName, 1, &jax->wname))
{
fprintf(stderr,"Error creating XTextProperty!\n");
return(0);
}
if(!XStringListToTextProperty(&iconName, 1, &jax->iname))
{
fprintf(stderr,"Error creating XTextProperty!\n");
return(0);
}
if(!(jax->xwmh=XAllocWMHints()))
{
fprintf(stderr,"Error allocating window manager hints!\n");
return(0);
}
jax->xwmh->flags=0;
if(!(jax->xsh=XAllocSizeHints()))
{
fprintf(stderr,"Error allocating size hints!\n");
return(0);
}
jax->xsh->flags=(PPosition | PSize | PMinSize | PMaxSize);
jax->xsh->height=jax->xsh->min_height=jax->xsh->max_height=h;
jax->xsh->width=jax->xsh->min_width=jax->xsh->max_width=w;
jax->xsh->x=x;
jax->xsh->y=y;
XSetWMProperties(jax->d,jax->w,&jax->wname,&jax->iname,argv,argc,jax->xsh,jax->xwmh,jax->xch);
jax->cmap=DefaultColormap(jax->d, DefaultScreen(jax->d));
return(1);
}
int JAXuseGeometry(Jax *jax, int not_allowed_bitmask)
{
int x,y,w,h,bitmask,gravity;
char def[80];
if(!jax->d || !jax->w)
return(0);
if (!jax->geometry || strlen(jax->geometry)==0)
return(1);
sprintf(def,"%dx%d+%d+%d",jax->xsh->width,jax->xsh->height,jax->xsh->x,jax->xsh->y);
bitmask = XWMGeometry(jax->d,DefaultScreen(jax->d),jax->geometry,def,0,jax->xsh,&x,&y,&w,&h,&gravity);
if (XValue&bitmask && !(XValue&not_allowed_bitmask))
{
jax->xsh->flags|=USPosition;
jax->xsh->x=x;
}
if (YValue&bitmask && !(YValue&not_allowed_bitmask))
{
jax->xsh->flags|=USPosition;
jax->xsh->y=y;
}
if (WidthValue&bitmask && !(WidthValue&not_allowed_bitmask))
{
jax->xsh->flags|=USSize;
jax->xsh->width=w;
}
if (HeightValue&bitmask && !(HeightValue&not_allowed_bitmask))
{
jax->xsh->flags|=USSize;
jax->xsh->height=h;
}
if(jax->xsh->flags&USSize)
XResizeWindow(jax->d,jax->w,jax->xsh->width,jax->xsh->height);
if(jax->xsh->flags&USPosition)
XMoveWindow(jax->d,jax->w,jax->xsh->x,jax->xsh->y);
XSetWMNormalHints(jax->d,jax->w,jax->xsh);
return(1);
}
int JAXmapWin(Jax *jax, int raised)
{
if (!jax || !jax->w)
return(0);
if(raised)
XMapRaised(jax->d,jax->w);
else
XMapWindow(jax->d,jax->w);
XFlush(jax->d);
if(!JAXgetxwa(jax))
fprintf(stderr,"Error getting window atributes!\n");
return(1);
}
int JAXdefaultGC(Jax *jax)
{
jax->xgcv.foreground=JAXwhite(jax);
jax->xgcv.background=JAXblack(jax);
jax->gc_mask=GCForeground|GCBackground;
jax->gc=XCreateGC(jax->d,jax->w,jax->gc_mask,&jax->xgcv);
return(1);
}
int JAXexit(Jax *jax)
{
XCloseDisplay(jax->d);
return(1);
}
/*****************************************************************************/
/* Event Handling */
/*****************************************************************************/
int JAXaddevents(Jax *jax, Jax_Events *je)
{
int i;
if(je)
jax->events=je;
if(!jax->events)
return(0);
if (!XGetWindowAttributes(jax->d, jax->w, &jax->xwa))
return(0);
for(i=0;jax->events[i].event;i++)
jax->xwa.your_event_mask|=jax->events[i].event;
jax->xswa.event_mask=jax->xwa.your_event_mask;
if(XChangeWindowAttributes(jax->d, jax->w, CWEventMask, &jax->xswa))
return(1);
/*fprintf(stderr,"Problem setting window event attributes.\n");*/
return(1); /* should be 0, i don't get it! */
}
int JAXeventnow(Jax *jax)
{
if(JAXeventsqueued(jax))
{
XNextEvent(jax->d, &jax->xe);
switch(jax->xe.type)
{
case MappingNotify:
XRefreshKeyboardMapping((XMappingEvent*)&jax->xe);
jax->xe.type=0;
break;
default:
if (jax->EH)
jax->EH(jax);
break;
}
}
return(0);
}
int JAXwaitforevent(Jax *jax)
{
int done=0;
while(!done)
{
XNextEvent(jax->d, &jax->xe);
switch(jax->xe.type)
{
case MappingNotify:
XRefreshKeyboardMapping((XMappingEvent*)&jax->xe);
break;
default:
done=1;
break;
}
}
return(0);
}
int JAXeventhandler(Jax *jax)
{
int i;
for(i=0;jax->events[i].event;i++)
if(jax->xe.type==jax->events[i].type)
{
return(jax->events[i].function(jax));
}
fprintf(stderr,"Event type number %d not handled!\n",jax->xe.type);
return(0);
}
int JAXeventloop(Jax *jax)
{
int done=0;
while(!done)
{
JAXwaitforevent(jax);
if (jax->EH)
done=jax->EH(jax);
else
done=1;
}
return(1);
}
/*****************************************************************************/
/* Images */
/*****************************************************************************/

152
jax/jax.h Normal file
View File

@ -0,0 +1,152 @@
#ifndef JAX_H
#define JAX_H
#include <stdlib.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
typedef struct JAX_PARAMS
{
char *name1, *name2, **str;
} Jax_Params;
struct JAX;
typedef struct JAX_EVENTS
{
long event;
int type;
int (*function)(struct JAX*);
} Jax_Events;
typedef struct JAX
{
Display *d; /* 92 */
char *dname;
int s; /* DefaultScreen() */
Window w; /* 164 */
char *geometry;
XSetWindowAttributes xswa; /* 155-7 */
XWindowAttributes xwa; /* 158-9 */
/* 153 */
XTextProperty wname;
XTextProperty iname;
XSizeHints *xsh; /* 93, 148-9 */
XWMHints *xwmh; /* 154 */
XClassHint *xch; /* 152 */
int (*EH)(struct JAX*); /* event handler */
XEvent xe; /* 96, 98, 129 */
Jax_Events *events; /* 124-9, 159-60 */
XGCValues xgcv; /* 96 */
unsigned long gc_mask;
GC gc; /* 96, 238-41 */
XFontStruct *xfs; /* 92,279 */
Colormap cmap; /* 313- */
Jax_Params *options; /* 90 */
int num_options;
Jax_Params *resources; /* 91 */
int num_resources;
struct JAX *next;
} Jax;
int JAXusage(Jax*, char*, char*); /* jax,argv[0],usage(no options) */
int JAXshiftopts(int, int, int*, char**); /* base,shift,argc,argv */
int JAXgetopts(Jax*, int*, char**); /* jax,argc,argv */
int JAXgetrdb(Jax*); /* jax */
Jax *JAXnewjax(void);
Jax *JAXinit(int*, char**, Jax_Params*, Jax_Params*);
/* argc,argv,rdb,options */
int JAXexit(Jax *); /* jax */
int JAXopenrootwin(Jax*); /* jax */
int JAXdefaultGC(Jax*); /* jax */
int JAXcreatewin(Jax*,int,int,int,int,char*,char*,int,char**);
/* jax, x,y,w,h, winName, iconName,
argc,argv */
int JAXuseGeometry(Jax*,int); /* jax, bits set not to allow
changes of sizes/positions
using the same convention
returned by XParseGeometry */
int JAXmapWin(Jax*,int); /* jax, raised */
int JAXaddevents(Jax*, Jax_Events*); /* jax, events */
int JAXeventhandler(Jax*); /* jax */
int JAXeventnow(Jax*); /* jax */
int JAXwaitforevent(Jax*); /* jax */
int JAXeventloop(Jax*); /* jax */
/* M A C R O S */
#define JAXmapsubwin(jax) XMapSubWindows(jax->d,jax->w)
#define JAXmapwin(jax) JAXmapWin(jax,0)
#define JAXmapraised(jax) JAXmapWin(jax,1)
#define JAXunmapwin(jax) XUnmapWindow(jax->d,jax->w)
#define JAXclosedisplay(jax) XCloseDisplay(jax->d)
#define JAXraisewin(jax) XRaiseWindow(jax->d,jax->w)
#define JAXlowerwin(jax) XLowerWindow(jax->d,jax->w)
#define JAXmovewin(jax,dx,dy) XMoveWindow(jax->d,jax->w,dx,dy)
#define JAXmoveresizewin(jax,dx,dy,dw,dh) XMoveResizeWindow(jax->d,jax->w, \
dx,dy,dw,dh)
#define JAXgetxwa(jax) XGetWindowAttributes(jax->d, \
jax->w, &jax->xwa)
#define JAXdefaultrootwin(jax) DefaultRootWindow(jax->d)
#define JAXgetcmap(jax) jax->cmap=DefaultColormap(jax->d,jax->s)
#define JAXcreategc(jax) jax->gc=XCreateGC(jax->d,jax->w, \
jax->gc_mask,&jax->xgcv)
#define JAXcleararea(jax,x,y,wd,h,e) XClearArea(jax->d,jax->w, \
x,y,wd,h,e)
#define JAXclearwindow(jax) XClearWindow(jax->d,jax->w)
#define JAXdrawpoint(jax,x,y) XDrawPoint(jax->d,jax->w,jax->gc, \
x,y)
#define JAXfillrectangle(jax,x,y,wd,h) XFillRectangle(jax->d,jax->w, \
jax->gc,x,y,wd,h)
#define JAXline(jax,x,y,x2,y2) XDrawLine(jax->d,jax->w, \
jax->gc,x,y,x2,y2)
#define JAXblack(jax) BlackPixel(jax->d,jax->s)
#define JAXwhite(jax) WhitePixel(jax->d,jax->s)
#define JAXsetfg(jax,c) XSetForeground(jax->d,jax->gc,c)
#define JAXsetbg(jax,c) XSetBackground(jax->d,jax->gc,c)
#define JAXreadbitmapfile(jax,fname,width,height,bitmap,hot_x,hot_y) \
XReadBitmapFile(jax->d, jax->w, \
fname, \
width, height, bitmap, \
hot_x, hot_y)
#define JAXputbm(jax,bm,x,y,width,height) XCopyPlane(jax->d,bm,jax->w,\
jax->gc,\
0,0,width,height,x,y,1)
#define JAXgetimage(jax,x,y,wd,h) XGetImage(jax->d, jax->w, \
x, y, wd, h, AllPlanes, ZPixmap)
#define JAXloadfont(jax,fontname) XLoadFont(jax->d, fontname);
#define JAXloadqueryfont(jax,fontname) jax->xfs=XLoadQueryFont(jax->d, fontname);
#define JAXqueryfont(jax) jax->xfs=XQueryFont(jax->d, jax->xgcv.font);
#define JAXsetGCfont(jax) XSetFont(jax->d,jax->gc,\
jax->xfs->fid)
#define JAXdrawstring(jax,x,y,str) XDrawString(jax->d,jax->w,jax->gc,\
x,y,str,strlen(str))
#define JAXstringwidth(jax,str) XTextWidth(jax->xfs,str,strlen(str))
#define JAXstringheight(jax) (jax->xfs->ascent)
#define JAXstringfullheight(jax) (jax->xfs->ascent+jax->xfs->descent)
#define JAXfontdescent(jax) (jax->xfs->descent)
#define JAXsync(jax,discard) XSync(jax->d,discard)
#define JAXsetEH(jax,eh) jax->EH=eh
#define JAXeventsqueued(jax) XEventsQueued(jax->d, \
QueuedAfterReading)
#define JAXpending(jax) XPending(jax->d)
#define JAXquerypointer(jax,root,child,rx,ry,wx,wy,keys_buttons) \
XQueryPointer(jax->d, jax->w, \
root, child, \
rx, ry, wx, wy, keys_buttons)
#endif

5
lefty.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
sed -e 's/_L/_R/g' < imwheelrc > imwheelrc.lefty
mv imwheelrc imwheelrc.righty
mv imwheelrc.lefty imwheelrc

6
mdetect/Makefile.am Normal file
View File

@ -0,0 +1,6 @@
EXTRA_PROGRAMS=mdetect
noinst_PROGRAMS=@mdetect@
AM_CFLAGS=-I@top_srcdir@
dist-hook:
cp -Rfp mice $(distdir)/mice

398
mdetect/Makefile.in Normal file
View File

@ -0,0 +1,398 @@
# Makefile.in generated by automake 1.9 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
SOURCES = mdetect.c
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
EXTRA_PROGRAMS = mdetect$(EXEEXT)
noinst_PROGRAMS = @mdetect@
subdir = mdetect
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
PROGRAMS = $(noinst_PROGRAMS)
mdetect_SOURCES = mdetect.c
mdetect_OBJECTS = mdetect.$(OBJEXT)
mdetect_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = mdetect.c
DIST_SOURCES = mdetect.c
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GETOPT_INCS = @GETOPT_INCS@
GETOPT_LIBS = @GETOPT_LIBS@
GPM_DIR = @GPM_DIR@
HAVE_GPM_SRC = @HAVE_GPM_SRC@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
NO_GPM_DOC_FALSE = @NO_GPM_DOC_FALSE@
NO_GPM_DOC_TRUE = @NO_GPM_DOC_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SUID_FALSE = @SUID_FALSE@
SUID_TRUE = @SUID_TRUE@
VERSION = @VERSION@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
extras = @extras@
extras_dist = @extras_dist@
getopt = @getopt@
getopt_dist = @getopt_dist@
gpm_dist = @gpm_dist@
gpm_imwheel = @gpm_imwheel@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mdetect = @mdetect@
mdetect_dist = @mdetect_dist@
mdump = @mdump@
mdump_dist = @mdump_dist@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
suid = @suid@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
AM_CFLAGS = -I@top_srcdir@
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mdetect/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu mdetect/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
clean-noinstPROGRAMS:
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
mdetect$(EXEEXT): $(mdetect_OBJECTS) $(mdetect_DEPENDENCIES)
@rm -f mdetect$(EXEEXT)
$(LINK) $(mdetect_LDFLAGS) $(mdetect_OBJECTS) $(mdetect_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mdetect.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstPROGRAMS ctags dist-hook distclean \
distclean-compile distclean-generic distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-exec install-exec-am \
install-info install-info-am install-man install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-info-am
dist-hook:
cp -Rfp mice $(distdir)/mice
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

400
mdetect/mdetect.c Normal file
View File

@ -0,0 +1,400 @@
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <termios.h>
#include <time.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#define openps2 open(mousedev,O_RDWR|O_SYNC|O_NOCTTY)
//#define flushps2 tcflush(fd, TCIFLUSH)
#define flushps2 flushfd(fd)
#define K(a) ((a)*1024)
typedef unsigned char uchar;
char readps2();
void dumpps2();
void diag1();
void diag2();
void diag3();
int filterps2buf(uchar *buf, int len);
void flushfd(int fd);
char DisableDev =0xF5;
char GetDeviceType =0xF2;
char SetStdPS2 =0xFF;
char *mousedev="/dev/psaux";
// mouse config data (detected and used)
int len=0;
char mask[16];
char **buttons;
int numbuttons=0;
// local data
int fd;
uchar ch;
int main(int argc, char **argv)
{
fd=openps2;
if(fd<0)
return(1);
//printf("DisableDev\n");
write(fd,&DisableDev,1);
flushps2;
//printf("SetStdPS2\n");
write(fd,&SetStdPS2,1);
readps2();
flushps2;
//printf("GetDeviceType\n");
write(fd,&GetDeviceType,1);
readps2();
close(fd);
fd=openps2;
if(fd<0)
return(1);
diag1();
diag2();
diag3();
close(fd);
return(0);
}
char readps2()
{
while(read(fd,&ch,1) && (ch==0xfa || ch==0xaa));
/*
{
printf("<%02X>",ch);
fflush(stdout);
}
*/
return(ch);
}
void dumpps2()
{
printf("Dump\n");
while(read(fd,&ch,1))
{
printf(" %02x ",ch);
fflush(stdout);
}
}
int filterps2buf(uchar *buf, int l)
{
int i;
for(i=0;i<l;i+=len)
{
while(buf[i]==0xAA || buf[i]==0xFA)
{
l--;
memmove(buf+i,buf+1+i,l);
}
if(!len)
break;
}
return(l);
}
void unmaskps2(uchar *buf, int l)
{
int i,j;
for(i=0;i<l;i+=len)
for(j=0;j<len && j+i<l;j++)
buf[j+i]^=mask[j];
}
int numbits(uchar *buf)
{
int byte,ct;
uchar bit;
for(ct=byte=0;byte<len;byte++)
for(bit=1;bit;bit=bit<<1)
ct+=(buf[byte]&bit?1:0);
return(ct);
}
void andbits(uchar *buf, uchar *buf2, int l)
{
int byte;
for(byte=0;byte<l;byte++)
buf[byte%len]&=buf2[byte];
}
void orbits(uchar *buf, uchar *buf2, int l)
{
int byte;
for(byte=0;byte<l;byte++)
buf[byte%len]|=buf2[byte];
}
/*
int isadd(int len, int n)
{
int i;
for(i=len;i>=n;i=i-n);
return(i);
}
*/
void flushfd(int fd)
{
int oldflags;
uchar buf[K(1)];
oldflags=fcntl(fd,F_GETFL);
fcntl(fd,F_SETFL,oldflags|O_NONBLOCK);
while(read(fd,buf,K(1)) > 0);
fcntl(fd,F_SETFL,oldflags);
}
int getbit(uchar *buf, int n)
{
return((buf[n/8]>>(n%8))&1);
}
int nextbit(int n, uchar *in, uchar *mask)
{
int i;
for(i=n+1; i/8<len && getbit(in,i) && !getbit(mask,i);i++);
if(i/8>=len)
return(-1);
else
return(i);
}
/*
unsigned long long numcombo(int n)
{
unsigned long long c;
int i;
for(i=1,c=1;i<n;i++)
{
c*=i;
printf("%d) %Lu\n",i,c);
}
return(c);
}
int bitcombo(uchar *all, int cur, int ***ialist)
{
static int *iacur;
static uchar *used;
static int ialistlen, n;
int i;
// setup
if(!cur)
{
int nc;
n=numbits(all);
nc=numcombo(n);
iacur=malloc(n*sizeof(int));
*ialist=malloc(nc*sizeof(int*));
for(i=nc-1;i>=0;i--)
*ialist[i]=malloc(n*sizeof(int));
ialistlen=0;
used=malloc(len);
}
// work
for(i=nextbit(-1,all,used);i>=0;i=nextbit(i,all,used))
{
iacur[cur]=i;
if(numbits(used)==n)
{ // end
memcpy(*ialist[ialistlen],iacur,len);
ialistlen++;
}
else
{ // recurse
used[i/8]|=i%8;
bitcombo(all,cur+1,ialist);
used[i/8]^=i%8;
}
}
// cleanup
if(!cur)
{
free(iacur);
free(used);
}
return(ialistlen);
}
*/
////////////////////////////////////////////////////////////////////////////////
// Packet Length
// Mask
void diag1()
{
uchar buf[K(1)];
int i;
printf("[ Mouse Packet Length & Mouse Mask ]\n");
printf("Lift mouse in air.\nYou will be asked to press the left mouse button once.\nDo NOT shake mouse during test or motion data will interfere.\n");
printf("Press ENTER when ready: ");
fflush(stdout);
scanf("%*c");
//fd=openps2;
flushps2;
printf("Press left mouse button once then press ENTER: ");
fflush(stdout);
scanf("%*c");
i=read(fd,buf,K(1));
//close(fd);
len=filterps2buf(buf,i);
for(i=0;i<len;i++)
printf("%02X %s",buf[i],(!((i+1)%(len/2))?"\n":""));
len=len/2;
printf("Packet Length = %d\n",len);
for(i=0;i<len;i++)
mask[i]=buf[i]&buf[i+len];
printf("Mask = 0x");
for(i=0;i<len;i++)
printf("%02X%s",mask[i],(!((i+1)%len)?"\n":""));
printf("\n");
}
////////////////////////////////////////////////////////////////////////////////
// Mouse Buttons
void diag2()
{
uchar buf[K(1)];
int i,l,j;
printf("[ Mouse Buttons ]\n");
printf("This mouse buttons catagory also includes other things that act like buttons.\n");
printf("Wheels that click are included in this catagory.\n");
printf("Wheels that go in two directions most likely act like two separate buttons.\n");
while(numbuttons<1)
{
printf("How many mouse buttons do you want to configure: ");
fflush(stdout);
scanf("%d%*c",&numbuttons);
if(numbuttons<1)
printf("Oh please...\n");
}
buttons=malloc(len*numbuttons);
printf("Lift mouse in air and be prepared to press (or whatever) each button in order.\n");
printf("It's important that you don't shake the mouse durring these configurations.\n");
for(i=0;i<numbuttons;i++)
{
buttons[i]=malloc(len);
do {
printf("Press ENTER when ready: ");
fflush(stdout);
scanf("%*c");
//fd=openps2;
flushps2;
printf("Press mouse button %d once then press ENTER: ",i+1);
fflush(stdout);
scanf("%*c");
l=read(fd,buf,K(1));
//close(fd);
for(j=0;j<l;j++)
printf("%02X %s",buf[j],(!((j+1)%len)?"\n":""));
l=filterps2buf(buf,l);
unmaskps2(buf,l);
if(l != len*2)
printf("Please do it again, the wrong amount of data was received!\n");
} while(l != len*2);
memcpy(buttons[i],buf,len);
printf("Mouse button %d = 0x",i+1);
for(j=0;j<len;j++)
printf("%02X%s",buttons[i][j],(!((j+1)%len)?"\n":""));
}
printf("\n");
}
////////////////////////////////////////////////////////////////////////////////
// Mouse Motion
void diag3()
{
uchar buf[K(16)],all[16];
int i,l,n;
//int **ialist,ialistlen;
printf("[ Mouse Motion ]\n");
printf("Put the mouse down.\nYou will be asked to move the mouse in a circle.\nThe circle should be drawn starting on the right side of the circle,\ngoing counterclockwise.\nDon't use any mouse buttons during this configuration.\n");
do {
printf("Press ENTER when ready: ");
fflush(stdout);
scanf("%*c");
//fd=openps2;
//sleep(1);
flushps2;
printf("Circle the mouse once (see above) then press ENTER: ");
fflush(stdout);
scanf("%*c");
l=read(fd,buf,K(16));
//close(fd);
printf("Raw:\n");
for(i=0;i<l;i++)
printf("%02X %s",buf[i],(!((i+1)%len)?"\n":""));
l=filterps2buf(buf,l);
unmaskps2(buf,l);
printf("\nFiltered:\n");
for(i=0;i<l;i++)
printf("%02X %s",buf[i],(!((i+1)%len)?"\n":""));
if(l%len)
printf("\nPlease do it again, the wrong amount of data was received!\n");
} while(l%len);
memset(all,0,sizeof(all));
orbits(all,buf,l);
printf("\nall=");
for(i=0;i<len;i++)
printf("%02X %s",all[i],(!((i+1)%len)?"\n":""));
n=numbits(all);
printf("numbits(all)=%d\n",n);
//printf("numcombo(%d)=%Lu\n",n,numcombo(n));
// Circle detect
//ialistlen=bitcombo(all,0,&ialist); // 355687428096000 combos! no way!
printf("\n");
}

14
mdetect/mice/a4tech Normal file
View File

@ -0,0 +1,14 @@
PACKET 4
MASK mask 0x08 0x00 0x00
BUTTON 1 BOTH mask 0x01 0x00 0x00 0x00
BUTTON 2 BOTH mask 0x04 0x00 0x00 0x00
BUTTON 3 BOTH mask 0x02 0x00 0x00 0x00
BUTTON 4 PRESS mask 0x00 0x00 0x00 0xff #wheel up
BUTTON 5 PRESS mask 0x00 0x00 0x00 0x01 #wheel down
BUTTON 6 PRESS mask 0x00 0x00 0x00 0x0e #wheel left - serial
BUTTON 6 PRESS mask 0x00 0x00 0x00 0xfe #wheel left - ps2
BUTTON 7 PRESS mask 0x00 0x00 0x00 0x02 #wheel right
MOTION MASK mask
MOTION TYPE RELATIVE
MOTION X RIGHT 1,0 1,1 1,2 1,3 1,4 1,5 1,6 1,7
MOTION Y UP 2,0 2,1 2,2 2,3 2,4 2,5 2,6 2,7

9
mdetect/mice/default Normal file
View File

@ -0,0 +1,9 @@
PACKET 3
MASK mask 0x08 0x00 0x00
BUTTON 1 BOTH mask 0x01 0x00 0x00
BUTTON 2 BOTH mask 0x04 0x00 0x00
BUTTON 3 BOTH mask 0x02 0x00 0x00
MOTION MASK mask
MOTION TYPE RELATIVE
MOTION X RIGHT 1,0 1,1 1,2 1,3 1,4 1,5 1,6 1,7
MOTION Y UP 2,0 2,1 2,2 2,3 2,4 2,5 2,6 2,7

11
mdetect/mice/intellimouse Normal file
View File

@ -0,0 +1,11 @@
PACKET 4
MASK mask 0x08 0x00 0x00
BUTTON 1 BOTH mask 0x01 0x00 0x00 0x00
BUTTON 2 BOTH mask 0x04 0x00 0x00 0x00
BUTTON 3 BOTH mask 0x02 0x00 0x00 0x00
BUTTON 4 PRESS mask 0x00 0x00 0x00 0xff #wheel up
BUTTON 5 PRESS mask 0x00 0x00 0x00 0x01 #wheel down
MOTION MASK mask
MOTION TYPE RELATIVE
MOTION X RIGHT 1,0 1,1 1,2 1,3 1,4 1,5 1,6 1,7
MOTION Y UP 2,0 2,1 2,2 2,3 2,4 2,5 2,6 2,7

13
mdetect/mice/mouseman+ Normal file
View File

@ -0,0 +1,13 @@
PACKET 3
MASK mask 0x08 0x00 0x00
MASK stick 0xc8 0x00 0x00
SYNC mask
BUTTON 1 BOTH mask 0x01 0x00 0x00
BUTTON 2 BOTH mask 0x04 0x00 0x00
BUTTON 3 BOTH mask 0x02 0x00 0x00
STICK 1 X ONCE ORIGIN RIGHT stick 1,0 1,1 1,2 1,3
STICK 1 Y ONCE ORIGIN UP stick 1,4 1,5 1,6 1,7
MOTION MASK mask
MOTION TYPE RELATIVE
MOTION X RIGHT 1,0 1,1 1,2 1,3 1,4 1,5 1,6 1,7
MOTION Y UP 2,0 2,1 2,2 2,3 2,4 2,5 2,6 2,7

9
mdetect/mice/netmouse Normal file
View File

@ -0,0 +1,9 @@
PACKET 4
MASK mask 0x08 0x00 0x00 0x00
BUTTON 1 BOTH mask 0x01 0x00 0x00 0x00
BUTTON 2 PRESS mask 0x00 0x00 0x00 0xff
BUTTON 3 BOTH mask 0x02 0x00 0x00 0x00
MOTION MASK mask
MOTION TYPE RELATIVE
MOTION X RIGHT 1,0 1,1 1,2 1,3 1,4 1,5 1,6 1,7
MOTION Y UP 2,0 2,1 2,2 2,3 2,4 2,5 2,6 2,7

91
mdump.c Normal file
View File

@ -0,0 +1,91 @@
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifndef O_SYNC
#define O_SYNC 0
#endif
#define SIGNOF(a) (a<0?-1:1)
char readps2(int fd)
{
char ch;
while(read(fd,&ch,1) && (ch==(char)0xfa || ch==(char)0xaa))
{
printf("<%02X>",ch&0xff);
fflush(stdout);
}
return(ch);
}
int main(int argc, char **argv)
{
int fd;
char ch;
int len=3,i,j;
#ifdef HAVE_GETTIMEOFDAY
struct timeval tv,tv2;
long t;
#endif
if(argc>1)
fd=open(argv[1],O_RDWR,O_NOCTTY|O_SYNC);
else
fd=open("/dev/mouse",O_RDWR,O_NOCTTY|O_SYNC);
if(argc>2)
len=atoi(argv[2]);
#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&tv2,NULL);
#endif
ch=0xf2;
write(fd,&ch,1);
ch=readps2(fd);
printf("device type=%02X(%4d)\n",ch&0xff,ch);
while(read(fd,&ch,1))
{
#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&tv,NULL);
t=(tv.tv_sec-tv2.tv_sec)*1000000L+(tv.tv_usec-tv2.tv_usec);
printf("%10ld (%3ldMHz) : ",t,1000000/t);
tv2.tv_sec=tv.tv_sec;
tv2.tv_usec=tv.tv_usec;
#endif
for(i=1; i<=len; i++)
{
printf("%02X(%4d)",ch&0xff,ch);
if(argc>3 || i>1)
{
printf("=");
for(j=7;j>=0;j--)
printf("%01d",(ch>>j)&1);
printf("=%2d,%2d",(ch>>4), (ch&0x0F)<<28>>28);
printf(") ");
}
if(i<len)
if(!read(fd,&ch,1))
break;
}
//printf("\033[K\033[H");
//fflush(stdout);
printf("\n");
}
close(fd);
return(0);
}

360
missing Executable file
View File

@ -0,0 +1,360 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2003-09-02.23
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>."
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
# We have makeinfo, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
tar)
shift
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

40
mkinstalldirs Executable file
View File

@ -0,0 +1,40 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.2 2004/06/10 01:41:49 jcatki Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here

27
see Executable file
View File

@ -0,0 +1,27 @@
#! /bin/sh
INFO='
man DefaultRootWindow
man XAllowEvents
man XGrabButton
man XSendEvent
man XQueryTree
man XQueryPointer
man XGetInputFocus
man XGetDeviceFocus
man XOpenDevice
man XSendExtensionEvent
less /usr/X11R6/include/X11/X.h
less /usr/X11R6/include/X11/keysymdef.h
less /usr/X11R6/include/X11/extensions/XTest.h
less /usr/X11R6/include/X11/extensions/XInput.h
'
if [ $# -gt 0 ]
then
`cat << . | grep -i "$1" | awk 'NR==1'
$INFO
.`
else
echo -n "Info available:$INFO"
fi

80
setimps2.c Normal file
View File

@ -0,0 +1,80 @@
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <time.h>
#include <termios.h>
char readps2(int fd)
{
char ch;
while(read(fd,&ch,1) && (ch==(char)0xfa || ch==(char)0xaa))
{
fprintf(stderr,"<%02X>",ch&0xff);
}
fprintf(stderr,"[%02X]",ch&0xff);
return(ch);
}
int main(int argc, char **argv)
{
int fd;
char ch,
getdevtype=0xf2,
disabledev=0xf5,
setimps2[6]={0xf3,200,0xf3,100,0xf3,80},
setupmore[7]={0xf6,0xe6,0xf4,0xf3,100,0xe8,3},
resetps2=0xff;
if(argc>1)
fd=open(argv[1],O_RDWR);
else
fd=open("/dev/mouse",O_RDWR);
fprintf(stderr,"write disable\n");
write(fd,&disabledev,1);
tcflush(fd, TCIFLUSH);
write(fd,&getdevtype,1);
sleep(1);
ch=readps2(fd);
fprintf(stderr,"device type=%02X(%4d)\n",ch&0xff,ch);
write(fd,&resetps2,1);
sleep(1);
//ch=readps2(fd);
//fprintf(stderr,"reset response=%02X(%4d)\n",ch&0xff,ch);
fprintf(stderr,"reset complete\n");
tcflush(fd, TCIFLUSH);
write(fd,&getdevtype,1);
sleep(1);
ch=readps2(fd);
fprintf(stderr,"device type=%02X(%4d)\n",ch&0xff,ch);
write(fd,&setimps2,6);
//write(fd,&setupmore,7);
tcflush(fd, TCIFLUSH);
write(fd,&getdevtype,1);
sleep(1);
ch=readps2(fd);
fprintf(stderr,"device type=%02X(%4d)\n",ch&0xff,ch);
tcflush(fd, TCIFLUSH);
write(fd,&getdevtype,1);
sleep(1);
ch=readps2(fd);
fprintf(stderr,"device type=%02X(%4d)\n",ch&0xff,ch);
close(fd);
return(0);
}

79
setmmplus.c Normal file
View File

@ -0,0 +1,79 @@
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <time.h>
#include <termios.h>
char readps2(int fd)
{
char ch;
while(read(fd,&ch,1) && (ch==(char)0xfa || ch==(char)0xaa))
{
fprintf(stderr,"<%02X>",ch&0xff);
fflush(stdout);
}
fprintf(stderr,"[%02X]",ch&0xff);
return(ch);
}
int main(int argc, char **argv)
{
int fd;
char ch,
getdevtype=0xf2,
disabledev=0xf5,
setmmplus[]={0xe6,0xe8,0,0xe8,3,0xe8,2,0xe8,1,0xe6,0xe8,3,0xe8,1,0xe8,2,0xe8,3,},
setupmore[7]={0xf6,0xe6,0xf4,0xf3,100,0xe8,3},
resetps2=0xff;
if(argc>1)
fd=open(argv[1],O_RDWR);
else
fd=open("/dev/mouse",O_RDWR);
write(fd,&disabledev,1);
tcflush(fd, TCIFLUSH);
write(fd,&getdevtype,1);
sleep(1);
ch=readps2(fd);
fprintf(stderr,"device type=%02X(%4d)\n",ch&0xff,ch);
write(fd,&resetps2,1);
sleep(1);
ch=readps2(fd);
fprintf(stderr,"reset response=%02X(%4d)\n",ch&0xff,ch);
tcflush(fd, TCIFLUSH);
write(fd,&getdevtype,1);
sleep(1);
ch=readps2(fd);
fprintf(stderr,"device type=%02X(%4d)\n",ch&0xff,ch);
write(fd,&setmmplus,sizeof(setmmplus));
write(fd,&setupmore,7);
tcflush(fd, TCIFLUSH);
write(fd,&getdevtype,1);
sleep(1);
ch=readps2(fd);
fprintf(stderr,"device type=%02X(%4d)\n",ch&0xff,ch);
tcflush(fd, TCIFLUSH);
write(fd,&getdevtype,1);
sleep(1);
ch=readps2(fd);
fprintf(stderr,"device type=%02X(%4d)\n",ch&0xff,ch);
close(fd);
return(0);
}

75
setps2.c Normal file
View File

@ -0,0 +1,75 @@
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <time.h>
#include <termios.h>
char readps2(int fd)
{
char ch;
while(read(fd,&ch,1) && (ch==(char)0xfa || ch==(char)0xaa))
{
fprintf(stderr,"<%02X>",ch&0xff);
fflush(stdout);
}
return(ch);
}
int main(int argc, char **argv)
{
int fd;
char ch,
getdevtype=0xF2,
enabledev=0xF4,
disabledev=0xF5,
resetps2=0xFF;
if(argc>1)
fd=open(argv[1],O_RDWR);
else
fd=open("/dev/mouse",O_RDWR);
fprintf(stderr,"disable\n");
write(fd,&disabledev,1);
fprintf(stderr,"flush\n");
tcflush(fd, TCIFLUSH);
fprintf(stderr,"getdev\n");
write(fd,&getdevtype,1);
fprintf(stderr,"sleep(1)\n");
sleep(1);
fprintf(stderr,"read\n");
ch=readps2(fd);
fprintf(stderr,"device type=%02X(%4d)\n",ch&0xff,ch);
fprintf(stderr,"reset ps2\n");
write(fd,&resetps2,1);
fprintf(stderr,"sleep(1)\n");
sleep(1);
fprintf(stderr,"read\n");
ch=readps2(fd);
fprintf(stderr,"reset response=%02X(%4d)\n",ch&0xff,ch);
fprintf(stderr,"flush\n");
tcflush(fd, TCIFLUSH);
fprintf(stderr,"getdev\n");
write(fd,&getdevtype,1);
fprintf(stderr,"sleep(1)\n");
sleep(1);
fprintf(stderr,"read\n");
ch=readps2(fd);
fprintf(stderr,"device type=%02X(%4d)\n",ch&0xff,ch);
close(fd);
return(0);
}

18
setps2rate.c Normal file
View File

@ -0,0 +1,18 @@
#include <stdio.h>
int main(int argc, char **argv)
{
char *device="/dev/psaux";
FILE *f;
char buf[2]={0xF3, 100};
if(!(f=fopen(device, "w")))
{
perror(device);
exit(1);
}
if(argc>1)
buf[1]=atoi(argv[1]);
fwrite(buf,1,2,f);
fclose(f);
}

82
slack.sh Executable file
View File

@ -0,0 +1,82 @@
#!/bin/sh
# pre cleanup
rm -rf build
# config vars
ARCH=i486
ETC=etc/X11/imwheel
# configure
CFLAGS="-march=$ARCH -Os" ./configure --prefix=/usr
# safe build
make clean
make
# install to build dir
make prefix="build/usr" ETCDIR="build/$ETC" install
# get name and version
eval `egrep "^VERSION =" Makefile | sed -e 's/ //g'`
eval `egrep "^PACKAGE =" Makefile | sed -e 's/ //g'`
PKG=$PACKAGE-$VERSION-$ARCH-${1-1}
cd build || exit 1
# fix perms
chown -R root .
chgrp -R bin .
# alter config file names
mv $ETC/imwheelrc $ETC/imwheelrc.new
# strip execs
echo stripping...
find -perm 755 -print \
| while read f
do
file "$f" | grep -q "not stripped" && {
echo "$f"
strip "$f"
}
done
# gzip manpages
echo gzipping...
find -name '*.[123456789]' -exec gzip -v {} \;
# make description
mkdir install
cat >install/slack-desc << EOF
$PACKAGE: IMWheel-$VERSION (mouse wheel handler for X11)
$PACKAGE:
$PACKAGE: imwheel is an X11 application that allows a user
$PACKAGE: to alter the actions resulting from a mouse wheel
$PACKAGE: or thumb button press. It is able to have individual
$PACKAGE: configurations for each application by name.
$PACKAGE: imwheel is particularly useful for old applications
$PACKAGE: that don't know about the new mouse wheel and buttons.
$PACKAGE:
$PACKAGE: You can find the latest release of imwheel at:
$PACKAGE: http://jonatkins.org/iwheel/
$PACKAGE:
$PACKAGE:
EOF
# make post install script
cat >install/doinst.sh <<EOF
#!/bin/sh
#
# postinstall script, created by hand
#
if [ ! -f /$ETC/imwheelrc ]
then
mv /$ETC/imwheelrc.new /$ETC/imwheelrc
echo new default config created at /$ETC/imwheelrc
else
echo new default config created at /$ETC/imwheelrc.new
echo merge with /$ETC/imwheelrc yourself...
fi
EOF
# make package
makepkg -c n -l y "../$PKG.tgz"
# cleanup
cd ..
rm -rf build

1498
util.c Normal file

File diff suppressed because it is too large Load Diff

90
util.h Normal file
View File

@ -0,0 +1,90 @@
/* IMWheel Utility Definitions
* Copylefted under the Linux GNU Public License
* Author : Jonathan Atkins <jcatki@jonatkins.org>
* PLEASE: contact me if you have any improvements, I will gladly code good ones
*/
#ifndef UTIL_H
#define UTIL_H
#include <config.h>
#include <getopt.h>
#define PIDFILE PIDDIR"/imwheel.pid"
#define NUM_BUTTONS 6
#define STATE_MASK (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)
#define NUM_STATES 3
#define MAX_MASKTRANS 8
#define ABS(a) ((a)<0?(-a):(a))
/* commands */
enum {
UNGRAB =100,
REPEAT =200,
GRAB =400,
PRIORITY=800
};
#define MIN_COMMAND UNGRAB
struct Trans
{
char *name;
int val;
};
struct WinAction
{
int pri; //used to determine priority of some conflicting matches
char *id; //window identifier (for regex match)
int button; //mouse button number or command
char **in; //keysyms in mask
char **out; //keysyms out
int reps; //number of repetitions
int delay; //microsecond delay until next keypress
int delayup;//microsecond delay while key down
};
extern int buttons[NUM_BUTTONS+1];
extern int statebits[STATE_MASK+1];
extern int debug;
extern struct WinAction *wa;
extern int num_wa;
extern struct Trans masktrans[MAX_MASKTRANS];
extern const int reps[1<<NUM_STATES];
extern const char *keys[NUM_BUTTONS][1<<NUM_STATES];
extern char *wname;
extern XClassHint xch;
extern const char *button_names[];
extern Atom ATOM_NET_WM_NAME, ATOM_UTF8_STRING, ATOM_WM_NAME, ATOM_STRING;
void getOptions(int,char**,char*,const struct option*);
char *windowName(Display*, Window);
void Printf(char *,...);
void printUsage(char*, const struct option[], const char*[][2]);
void printXEvent(XEvent*);
void delay(unsigned long);
void printXModifierKeymap(Display*, XModifierKeymap*);
void printKeymap(Display *d, char[32]);
int getbit(char*, int);
void setbit(char*, int, Bool);
void setupstatebits(void);
int isMod(XModifierKeymap*, int);
unsigned int makeModMask(XModifierKeymap*, char[32]);
unsigned int makeKeysymModMask(Display*,XModifierKeymap*, char**);
void printfState(int);
void exitString(char*, char*);
struct WinAction *getRC(void);
int wacmp(const void*, const void*);
char **getPipeArray(char*);
void printWA(struct WinAction*);
void writeRC(struct WinAction*);
struct WinAction *findWA(Display*,int,char*,char*,char*,XModifierKeymap*,char[32]);
void doWA(Display*,XButtonEvent*,XModifierKeymap*,char[32],struct WinAction*);
void modMods(Display*, char*, XModifierKeymap*, Bool, int);
void flushFifo(void);
void closeFifo(void);
void openFifo(void);
void KillIMWheel(void);
void WritePID(void);
int isUsedButton(int b);
int buttonIndex(int b);
#endif