add trackball-use-alt-keys
This commit is contained in:
parent
859cb0294d
commit
93637862da
|
|
@ -54,6 +54,13 @@ ConfigVariableDouble drive_horizontal_ramp_down_time
|
|||
ConfigVariableDouble inactivity_timeout
|
||||
("inactivity-timeout", 0.0);
|
||||
|
||||
ConfigVariableBool trackball_use_alt_keys
|
||||
("trackball-use-alt-keys", true,
|
||||
PRC_DESC("Set this true to use the command and option/control keys in "
|
||||
"conjunction with the first mouse button to simulate the behavior of "
|
||||
"the second and third mouse buttons in trackball mode. Particularly "
|
||||
"useful for Macs, or laptops with limited mouse buttons."));
|
||||
|
||||
ConfigureFn(config_tform) {
|
||||
DriveInterface::init_type();
|
||||
ButtonThrower::init_type();
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "pandabase.h"
|
||||
#include "notifyCategoryProxy.h"
|
||||
#include "configVariableDouble.h"
|
||||
#include "configVariableBool.h"
|
||||
|
||||
NotifyCategoryDecl(tform, EXPCL_PANDA_TFORM, EXPTP_PANDA_TFORM);
|
||||
|
||||
|
|
@ -36,4 +37,6 @@ extern EXPCL_PANDA_TFORM ConfigVariableDouble drive_horizontal_ramp_down_time;
|
|||
|
||||
extern EXPCL_PANDA_TFORM ConfigVariableDouble inactivity_timeout;
|
||||
|
||||
extern EXPCL_PANDA_TFORM ConfigVariableBool trackball_use_alt_keys;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -63,12 +63,13 @@ Trackball(const string &name) :
|
|||
watch_button(MouseButton::two());
|
||||
watch_button(MouseButton::three());
|
||||
|
||||
#ifdef IS_OSX
|
||||
// In OSX mode, we need to use the command and option key in
|
||||
// conjunction with the (one) mouse button.
|
||||
watch_button(KeyboardButton::meta());
|
||||
watch_button(KeyboardButton::alt());
|
||||
#endif
|
||||
if (trackball_use_alt_keys) {
|
||||
// In OSX mode, we need to use the command and option key in
|
||||
// conjunction with the (one) mouse button.
|
||||
watch_button(KeyboardButton::control());
|
||||
watch_button(KeyboardButton::meta());
|
||||
watch_button(KeyboardButton::alt());
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -554,15 +555,14 @@ do_transmit_data(DataGraphTraverser *, const DataNodeTransmit &input,
|
|||
int this_button = 0;
|
||||
|
||||
if (is_down(MouseButton::one())) {
|
||||
#ifdef IS_OSX
|
||||
if (is_down(KeyboardButton::alt())) {
|
||||
// B1 + alt (option) = B2.
|
||||
this_button |= B2_MASK;
|
||||
if (is_down(KeyboardButton::meta())) {
|
||||
if (is_down(KeyboardButton::meta()) || is_down(KeyboardButton::control())) {
|
||||
this_button |= B3_MASK;
|
||||
}
|
||||
|
||||
} else if (is_down(KeyboardButton::meta())) {
|
||||
} else if (is_down(KeyboardButton::meta()) || is_down(KeyboardButton::control())) {
|
||||
// B1 + meta (command) = B3.
|
||||
this_button |= B3_MASK;
|
||||
|
||||
|
|
@ -570,9 +570,6 @@ do_transmit_data(DataGraphTraverser *, const DataNodeTransmit &input,
|
|||
// Without a special key, B1 is B1.
|
||||
this_button |= B1_MASK;
|
||||
}
|
||||
#else // IS_OSX
|
||||
this_button |= B1_MASK;
|
||||
#endif // IS_OSX
|
||||
}
|
||||
if (is_down(MouseButton::two())) {
|
||||
this_button |= B2_MASK;
|
||||
|
|
|
|||
Loading…
Reference in New Issue