1
0
Fork 0
Commit graph

235 commits

Author SHA1 Message Date
fredb
46a3200569 Win32 fix 2006-07-29 09:27:50 +00:00
frohlich
cdb725528d Clean up scenery center handling. It is set now less often. 2006-07-27 16:36:22 +00:00
mfranz
2c7e01133f Stefan Seifert:
- read bindings from template
- automatic deadband detection

mf:
- write js name into output file
- poor man's progress bar during deadband detection
- fix header inclusion, fix mixed indentation
2006-07-04 23:29:05 +00:00
mfranz
e48967cb1d fix another crash on exit by finally converting the rest of unguarded
SGPropertyNode to guarded ones. This is also done for JSBSim/JSBSim.hxx,
for which JSB had given explicit permission a while ago. I postponed that
back then, but now is the time.
2006-06-11 10:21:10 +00:00
mfranz
4d9d907c05 whoops, sorry, I forgot to commit that. (Thanks, Fred, for fixing).
Belongs to the SGSubsystem interface functions.
2006-06-05 16:28:20 +00:00
fredb
d1d9fb8881 Declare new member functions 2006-06-05 16:19:50 +00:00
mfranz
b2d2ec2e16 make modifier keys accessible via /devices/status/keyboard/{shift,ctrl,alt} 2006-06-05 13:45:59 +00:00
mfranz
6cfdb3e4b3 raise signal to listeners when a whole coordinate set was written 2006-03-21 17:33:54 +00:00
mfranz
537a1149a1 only evaluate click-on-terrain on left mouse button clicks 2006-03-15 07:31:57 +00:00
mfranz
c9813d1b5d new FSF address 2006-02-21 01:16:04 +00:00
david
85707f1e49 The "constrained" property for a mouse mode now actually constrains
the mouse rather than wrapping it.  Wrapping around to the other side
of the screen has very bad consequences when using the mouse for
flying or viewing -- it can result in sudden jumps in the controls or
the viewpoint when the mouse jumps to another side of the screen.

Right now, the mouse is constrained to stay between 25% and 75% of the
screen on both the X and Y axis -- whenever it hits an edge, it jumps
back to the centre of the screen again (which causes no control or
view jump).
2006-02-16 01:30:28 +00:00
mfranz
94aca555e9 whoops :-} 2006-02-15 08:34:42 +00:00
mfranz
ff9b7ebd64 cleanup 2006-02-15 08:25:23 +00:00
mfranz
470dc1b363 geo coords on button *down*. Noise reduction. 2006-02-15 08:15:28 +00:00
mfranz
38d44f2c01 only write coordinates on button press, and not again on release 2006-02-03 11:39:04 +00:00
mfranz
267e558bd2 the const-ness wasn't such a good idea :-) 2006-01-28 22:41:20 +00:00
mfranz
6de1f56f2c make it const 2006-01-27 22:26:47 +00:00
mfranz
ffc8c4d3d0 export scenery click geo coords 2006-01-27 21:14:40 +00:00
curt
7c0cf9dff9 Mathias Fröhlich's code, Curt Olson's comments:
Display the ground intersection point on mouse click (if click not consumed
by the gui or the panel.)  This should eventually get stuffed into the
property tree.
2005-12-12 22:22:28 +00:00
ehofman
5956ade90c Mathias: silence some valgrind warnings so that you can concentrate better on the real problems. 2005-12-06 18:32:07 +00:00
mfranz
a56e35ef74 of course I should have known that it would only work in tests *before*
committing, and would instantly break afterwards. Causes endless loops.
Re-uglify. Sorry for the noise.  :-/
2005-11-23 12:48:09 +00:00
mfranz
f93bb8eedc remove a few if's to make the ugly fix a little less ugly; they only save
a few CPU cycles but are really redundant
2005-11-23 12:28:27 +00:00
mfranz
0eef853caa This is an ugly fix for an ugly problem. And no, the two uglies don't cancel
each other out. The problem is this: if we press, for example, "Ctrl-a", but
release the "Ctrl" modifier button *before* the "a" button (which nobody does
intentionally, but which happens all the time), then we don't get the RELEASE
signal on "Ctrl-a" (keycode 1), but on the "a" (79). But "a" hasn't been
pressed, so the signal is dropped. And who releases "Ctrl-a"? Nobody!
So the next PRESSED signal for "Ctrl-a" is ignored, too. It is still
"pressed" after all, isn't it? That's the reason for the occasional
non-functioning of keys.

Due to the nearing 0.9.9 release, I only commit a crude last-minute fix.
It's not as intrusive as it looks, and shouldn't be "dangerous" at all.
It only makes sure that when we get an unexpected RELEASE for one letter
key ("a") that the two twins "A" and "Ctrl-A" are released if they are
still in "pressed" state.

The proper fix will be to let fg_os{,_sdl}.cxx always report presses on the
same key ("a", "Shift-a", "Ctrl-a", "Alt-a", and other combinations of
modifiers) as the *same* key (97), only with modifiers appropriately set.
2005-11-12 10:51:58 +00:00
mfranz
694426c103 make use of the new removeChildren() 2005-10-23 12:32:15 +00:00
mfranz
31fa633d74 'keep' defaults to true (which is a bad choice -- we never really want
children saved away when removing a node). This caused gui bindings to
fail in some rare cases --> don't keep.
2005-10-23 10:19:05 +00:00
ehofman
5430d87f01 Ralf Gerlich:
- automatic detection of axis directionality, so that axis inputs are appropriately inverted only when necessary
- fixed trim axis names for better understandability
- fixed signs for flaps up/down property increments
- button 0 was previously used for skipping axes and buttons in both loops. Now button 0 can be assigned a binding (e.g., brakes). Instead, moving any axis during the button-assignment-loop indicates skipping.
- The user is now told how to skip a control.
2005-07-31 14:05:55 +00:00
mfranz
af78f45550 remove my beloved removeChildren() ... sniff 2005-06-30 19:26:29 +00:00
mfranz
a62388a19c - fix type warnings
- use new removeChildren() to remove the named js nodes that we don't
  need any more (they are now *really* removed, not just detached), and
- move it into postinit(). (getChildren() returns a SGPropertyNode_ptr,
  so all nodes are refcounted and, thus, after the last sg/props change
  no longer removable in that scope ;-)  Maybe we'll need an alternative
  getChildren() that returns SGPropertyNode* ...
2005-06-27 13:59:48 +00:00
mfranz
9889d37bdb Frederic Bouvier:
- This doesn't do what the author though it would do:
  if (modifiers&KEYMOD_RELEASED == 0) ...   (see below)
- MSVC and type fixes

mf:
fixing this uncovered an old bug: the "key pressed" branch was
actually never executed -- always only "released". And that is why
the <repeatable> property didn't work. And *that* was the reason
why the Spitfire's starter didn't work with freeglut, and Vivian
had to write a nasty workaround for it.
2005-06-27 07:13:02 +00:00
mfranz
4732b96861 (Frederic Bouvier) avoid gcc'ism 2005-06-25 07:57:42 +00:00
curt
baac4a98c9 Laurie Bradshaw:
Modified fgjs.cxx so it can produce xml or property list output.
There are also a couple of other additions (like a --deadband <float>
option).
2005-06-23 19:21:17 +00:00
mfranz
1bcaf4bfdd - don't store link to a disconnected *copy* of a subtree, but a link to
that subtree in the property tree itself
- remove a binding from the property tree
2005-06-20 18:52:45 +00:00
mfranz
8027023862 - fix bug that let <mod-up> bindings be executed before the nasal init
block (this required to move most of init() into postinit())
- undo the "which" pseudo-namespace workaround, and do it proper:
- let all nasal code in a joystick config file be executed in its own
  namespace. This allows to define functions in the init block that
  can be used throughout the driver file, and to write state variables
  in one binding, while reading them in other bindings, all without
  having to make sure that the values aren't lost in between, or collide
  with another joystick driver's code.
      For this the input subsystem creates a namespace for each joystick:
  "__js0" for joystick 0, etc. The two leading underscores are there to
  avoid collisions with user defined modules (similar to internal compiler
  variables). The namespace shouldn't be used explicitly, at least not in
  releases, and not from outside code, except for testing purposes, for
  which it can be useful. (If using the Cyborg joystick as js[0], you
  can read the modifier level as "__js0.modifier" from any nasal context.)
2005-06-19 17:23:41 +00:00
mfranz
639ed2161f revert last patch, and do it differently: set /input/joysticks/which (int)
to the joystick index (x in /input/joysticks/js[x]) both when initializing
nasal init blocks & whenever updating the joystick. That's the only way to
make these nasal contexts aware of the joytick for which they were called.
And that's useful if a js maintains common variables, such as modifiers or
state variables, that should be shared between the namespace-less bindings
and initialization code. And, yes, it's over-engineered ...  :-)
2005-06-13 06:14:45 +00:00
mfranz
dec07ab83e leave temporary hint for the nasal init block, so that it can access
its own data, and can distinguish itself from other instances of the
same js driver. This property is removed after script execution.
Example:

  self = props.globals.getNode(getprop("/input/joysticks/this"));
2005-06-12 19:27:20 +00:00
mfranz
1167c31a84 even clearer error message :-/ 2005-06-12 13:54:27 +00:00
mfranz
10ab557452 clearer error message 2005-06-12 13:51:55 +00:00
mfranz
defa571d86 a missing /input/joysticks/ node is no alarming sign any more. It's
supposed to get populated from $FG_ROOT/Input/Joysticks/.
2005-06-12 13:35:55 +00:00
mfranz
4a1eadbf35 throw an exception if not even a default joystick could be found;
This can only happen if $FG_ROOT is corrupted or some developer has
broken the default js config. Better not keep that under the rug.
2005-06-11 15:26:32 +00:00
mfranz
325d545132 - read all joystick files from $FG_ROOT/Input/Joysticks automatically
(no need to list the paths explicitly in $FG_ROOT/joysticks.xml any more)
- move identified js nodes to /input/joysticks/js[0-9], but
- don't overwrite already set joystick data there
- remove all nodes when they aren't used any more
- add "id" node, which contains the js id that lead to the selection
  of a "named js" config
- add "source" node containing the path of the used js config file
- execute all nasal script groups at initialization time
2005-06-11 14:26:11 +00:00
ehofman
91cb15d9b0 Martin Spott:
Remove all dependencies of plib's SL sound library.
2005-01-24 10:17:14 +00:00
ehofman
6a6c3a0e9c ... and make sure the number can actually be negative. 2005-01-17 10:48:35 +00:00
ehofman
f88a9aab6a Oops, don't forget that the axisnumber can actually be 0 2005-01-17 10:46:39 +00:00
ehofman
b9c633721f Silently ignore platforms that are not specified within the <number></number> section 2005-01-17 10:39:55 +00:00
ehofman
def25f39d5 gcc 4.0 fixes. 2004-12-18 11:59:33 +00:00
curt
16ca655c03 More FreeBSD fixes ... add -lusbhid where needed. 2004-11-21 03:15:19 +00:00
ehofman
2a94cedeba Fix some warnings. 2004-10-26 12:09:31 +00:00
ehofman
5071415bd1 Melchior FRANZ:
input.cxx allocates memory for js->getNumAxes() axes and for jsCaps.wNumButtons
or MAX_JOYSTICK_BUTTONS buttons per joystick. But it doesn't check if some
xml config defines bindings for more axes/buttons, in which case it writes
to unallocated memory and causes crashes. This is a real world example:
sidewinder-force-feed-pro.xml defines 7 axes, but only newer versions of
this js do actually have that many. Older ones (-> gameport) don't. The patch
drops unused and unusable bindings.
2004-10-24 14:45:52 +00:00
david
25ac349fe4 On a reinit() subsystem event, reconfigure the joystick and other
inputs.  This makes it possible to hot-plug a new joystick while
FlightGear is running (as long as the user explicitly reinits the
input subsystem).
2004-06-24 02:08:38 +00:00
curt
886d003688 - Track a saved mouse pointer location from the previous frame so we can detect
motion.

- Track a timeout value so we can optionally hide the mouse pointer after
  some user specified timeout period.

- in doMouseMotion() always update m.x and m.y even if we return early because
  pui wanted the event.  Without this, we can't reliably detect motion vs.
  inactivity.

- in _update_mouse() add a dt parameter so we can decriment the timeout value
  in "real" time.

- in _update_mouse() optionally hide the mouse pointer if m.timeout goes to
  zero.  Restore the pointer (and the timeout counter) if the mouse is moved.
2004-06-14 18:46:58 +00:00
ehofman
4cc32d837a Add a macintosh identifier for joystick axis numbering support. 2004-05-06 16:07:30 +00:00
curt
72f7595273 Add calls to jsInit() which is a noop on all platforms but Mac. 2004-05-04 19:02:19 +00:00
ehofman
2069bf3eb1 Replace axe by axis. Make sure the right number of joystick buttons is used. The number of defined buttons does not always equal the maximum number of allowed buttons. 2004-04-29 09:10:06 +00:00
ehofman
dd2e2c21a6 Revert the previous patch. The <target-platform> tag is not supported
anymore. Instead Frederic Bouvier suggests to add a <number> tag to
the axis definition which accepts values for <windows> and <unix>
for now but which can be extended later on:

<axis>
 <desc>Rudder</desc>
 <number>
  <unix>2</unix>
  <windows>3</windows>
 </number>
 <binding>
  <command>property-scale</command>
  <property>/controls/flight/rudder</property>
  <offset type="double">0.0</offset>
  <factor type="double">1.0</factor>
  <power type="double">2.0</power>
 </binding>
</axis>
2004-04-28 08:03:40 +00:00
ehofman
baa49ad145 Make it possible to define a <target-platform> tag in the joystick configuration file. This would make it possible to have different configuration files for Windows. Possible values are: Windows, UNIX or All. Not specifying the tag equals to 'All'. 2004-04-27 08:43:20 +00:00
andy
f46f962ca0 Revert the hard-coded keybindings I just replaced, and turn them into real
command bindings accessible from XML.  This still probably isn't a final
solution (which would drive the HUD from propery values), but it's a step
in the right direction anyway.
2004-04-05 19:38:50 +00:00
andy
27290ab0ef Restore the hard-coded HUD keybindings that I inadvertently killed
during deglutification.
2004-04-05 18:54:53 +00:00
andy
95e8b63988 I was too agressive in the fg_os port. Glut doesn't support grabbing
the keyboard modifiers outside of a key event handler, so adding the
fgGetKeyModifiers() call to doMouseMotion was broken.  The user could
see "phantom" modifier keys.
2004-04-01 23:28:47 +00:00
curt
2acdd02879 Clean up various compiler warnings that have crept into the code. This
by no means get's them all, but it's a start.
2004-04-01 15:27:53 +00:00
andy
c0b4531d04 Yank out all the glut dependencies and concentrate them in a (easily
reimplementable) Main/fg_os.cxx file.
2004-03-31 21:10:32 +00:00
curt
a1a68b9c93 Various preparations for the next release. 2004-03-18 02:37:01 +00:00
curt
da5ea10d5d Curt Olson:
Autopilot overhaul.
2004-01-31 19:47:45 +00:00
curt
9c49534907 Attempt #1 to sort out confusion between left / right / parking brake
controls in the cockpit vs. which wheels they apply to.  FlightGear now
sets /controls/gear/brake-left, /controls/gear/brake-right, and
/controls/gear/brake-parking.  It should be up to the FDM to sort out
which wheels under which circumstances are affected by these controls
and ultimately what happens to the physical motion of the aircraft.
2004-01-12 17:39:41 +00:00
ehofman
2f764eb319 Make sure the mouse mode can be overriden by a commandline option 2003-12-28 17:42:26 +00:00
andy
d14bba8458 Fix for a premature deletion bug. The _arg SGPropertyNode* is passed
to handlers which might want to assign it to a SGPropertyNode_ptr for
reference counting (Nasal does, for instance, to prevent garbage
collector interactions).  If that smart pointer is then destroyed,
that will free this object while it is still live.

Simply use a SGPropertyNode_ptr here; the code ends up smaller as a
bonus, since FGBinding no longer has to deallocation for _arg.
2003-12-22 19:18:22 +00:00
david
d296e5a7df Use proper logging facility, and lower the priority of some of the
logging messages.  This is part of an effort to make FlightGear a bit
quieter during normal operations.
2003-11-24 17:45:35 +00:00
ehofman
4779557037 First, MSVC 7 bombs when a value greater than 255 is passed to
Frederic Bouvier:
First, MSVC 7 bombs when a value greater than 255 is passed to
issomething(), so I copy k to a char (unsigned ) kc before calling
them.

Second, with my french keyboard, and I thing this is the same for
a great number of countries, some characters from the regular ASCII
set can only be get with ALt Gr that appears to be CTRL+ALT.

Especially, I can't select the second engine because '@' is
AltGr+'' nor all because '~' is AltGr+'' (and I have to hit space
after otherwise I can get  or  that are not used in french) and
FG try to cope with the modifiers.

So, currently, we have to mask out CTRL and ALT modifiers when they
are together. The current bingings don't allow 2 simultaneous to
be declared so it shouldn't break anything.
2003-09-27 09:44:41 +00:00
ehofman
52ebc9ae4b CLear the key bindings before assigning new ones 2003-09-25 12:07:42 +00:00
ehofman
980012e168 Move FGEventMgr and FGSubsystemMgr over to SimGear, add SGEventMgr to FlightGear's globals structre and some small code cleanups 2003-09-24 17:20:55 +00:00
ehofman
a5bd132143 Make sure the joystick name gets printed 2003-09-16 08:25:16 +00:00
ehofman
6f8aa7b331 Change GLUT_H to FG_GLUT_H to prevent a naming clash with freeglut. 2003-08-21 09:12:12 +00:00
ehofman
709f57fe91 Add the ability to add repeat intervals to joystick buttons using the interval-sec property 2003-07-02 19:21:11 +00:00
ehofman
27abc68450 Jim Wilson:
This patch adds an "interval-sec" property which allows fixing an interval in seconds (or fraction of seconds) for the repeats for emulated axis controls (digital hats) on joysticks.
2003-07-01 16:32:00 +00:00
curt
fdbc4672a8 Return to predawn version of input.[ch]xx until after the 0.9.2 release. 2003-06-04 14:22:51 +00:00
ehofman
f5e68169dc Just when you think you have it all sorted out, it stabbing you in the back. Make _last_dt 1.0 otherwise the tests will fail. 2003-06-04 14:14:12 +00:00
ehofman
ae51ae6882 Back out the joystick fixed timing patch for now 2003-06-04 14:02:23 +00:00
ehofman
bc767b9bba Add the axis buttons to the list of items to check only once every 50 ms. 2003-06-04 13:35:23 +00:00
ehofman
560fd191ac Restrict the update limitation to the buttons only 2003-06-04 12:46:49 +00:00
ehofman
cc89cf32c7 Dang! A last minute update, and no way to test it. :-/ Make he joysticks work again. 2003-06-04 11:27:41 +00:00
ehofman
15c54b57f9 Skip all empty bindings 2003-06-04 09:50:00 +00:00
ehofman
a2a496a84b Update the joystick 20 times per second 2003-06-04 09:30:48 +00:00
curt
3c7bdc31d9 Cosmetic changes for new code moved into simgear to make the naming scheme
better follow simgear conventions.
2003-05-13 03:18:42 +00:00
curt
2119db35c3 This is step "1" of probably "many" in the process of separating out the
scene management code and organizing it within simgear.  My strategy is
to identify the code I want to move, and break it's direct flightgear
dependencies.  Then it will be free to move over into the simgear package.

- Moved some property specific code into simgear/props/
- Split out the condition code from fgfs/src/Main/fg_props and put it
  in it's own source file in simgear/props/
- Created a scene subdirectory for scenery, model, and material property
  related code.
- Moved location.[ch]xx into simgear/scene/model/
- The location and condition code had dependencies on flightgear's global
  state (all the globals-> stuff, the flightgear property tree, etc.)  SimGear
  code can't depend on it so that data has to be passed as parameters to the
  functions/methods/constructors.
- This need to pass data as function parameters had a dramatic cascading
  effect throughout the FlightGear code.
2003-05-06 23:46:24 +00:00
ehofman
c3cefaf883 Updates to the controls properties tree. This is a major update so there may be one or two 'old' refferences left. To simplify the transisition there is a file called README.properties in the docs-mini directory of FlightGear that explains the new controls layout. 2003-04-01 12:43:18 +00:00
ehofman
7948238156 Declare fgReshape into gui.h 2003-03-30 19:40:43 +00:00
ehofman
4b62426109 Move current_panel to globals 2003-03-30 12:46:08 +00:00
david
af38fe4803 Don't allow this subsystem to be suspended. 2003-03-01 21:29:31 +00:00
david
e4f1dbace7 Patches from Johan Walles:
Here are the two modifications I had to make to get flightgear (just
updated from CVS) to build.  The first one is for being able to specify
SimGear's location at the ./configure command line, and the second one
is to be able to link.
2003-02-05 01:09:20 +00:00
david
5d5de3c903 Removed a couple of the deprecated dialogs, and removed the old
predefined bindings for F11 and F12.  Instead, there is now a soft
binding from F11 to the autopilot dialog.
2003-01-18 21:59:25 +00:00
david
7d3c375df2 Remove the old built-in bindings for F8 and F10 (they can be done in
keyboard.xml now).
2003-01-18 21:12:27 +00:00
david
9e2707c9f8 Do late, lazy binding of commands from the command manager. 2003-01-18 16:25:50 +00:00
david
6371783e2d Include fg_props.hxx to get definition of FGConditional. 2003-01-18 15:16:54 +00:00
david
9d726c1bd8 Started a new FGMenuBar class to handle a different XML-configurable
menubar.  This one allows regular command bindings, with the
(temporary) condition that every menu item must have a unique text
label.  The new menubar is disabled by default; to enable it,
configure --with-new-menubar.
2003-01-16 18:06:27 +00:00
david
5424c65f00 Removed #ifdef FG_PLIB_JOYSTICK_GETNAME -- it's in 1.6, so we can rely
on it.
2003-01-11 16:27:56 +00:00
david
71f08e795d Patches from Erik Hofman for SGI compatibility:
Some more cmall changes to the SimGear header files and removed the
SG_HAVE_NATIVE_SGI_COMPILERS dependancies from FlightGear.

I've added a seperate JSBSim patch for the JSBSim source tree.
2002-12-31 18:26:02 +00:00
david
f85b9589da Fixed so that 2D panel bindings work again. 2002-12-23 19:16:58 +00:00
david
5c2fb92a92 Use SGPropertyNode_ptr and add a private copy constructor, both for
safety's sake.
2002-12-22 19:57:09 +00:00
david
f332d1b659 Removed redundant logging statement. 2002-12-12 17:55:49 +00:00
curt
43e48070fe - Some refactoring of the configure.ac script.
- Better Mac OS X support (they put glut.h in GLUT/glut.h) :-(
2002-12-10 20:50:48 +00:00
curt
b640aceaa8 Change library order for cygwin. 2002-12-07 13:54:13 +00:00