mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 18:03:56 -04:00
oops, pgEntry bug
This commit is contained in:
parent
2fc11e2a9f
commit
4f443920f2
@ -439,7 +439,7 @@ get_release_event(const ButtonHandle &button) const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE string PGItem::
|
||||
get_keystroke_event() const {
|
||||
return get_keystroke_prefix() + "-" + get_id();
|
||||
return get_keystroke_prefix() + get_id();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -694,21 +694,34 @@ keystroke(int keycode) {
|
||||
param.set_modifier_buttons(_mods);
|
||||
param.set_mouse(_mouse);
|
||||
|
||||
// Send the event to every region that wants keyboard buttons,
|
||||
// regardless of the mouse position.
|
||||
if (_preferred_region != (MouseWatcherRegion *)NULL) {
|
||||
// Our current region, the one under the mouse, always get
|
||||
// all the keyboard events, even if it doesn't set its
|
||||
// keyboard flag.
|
||||
_preferred_region->keystroke(param);
|
||||
// Keystrokes go to all those regions that want keyboard events,
|
||||
// regardless of which is the "preferred" region (that is, without
|
||||
// respect to the mouse position). However, we do set the outside
|
||||
// flag according to whether the given region is preferred region or
|
||||
// not.
|
||||
|
||||
Regions::const_iterator ri;
|
||||
for (ri = _regions.begin(); ri != _regions.end(); ++ri) {
|
||||
MouseWatcherRegion *region = (*ri);
|
||||
|
||||
if (region->get_keyboard()) {
|
||||
param.set_outside(region != _preferred_region);
|
||||
region->keystroke(param);
|
||||
}
|
||||
}
|
||||
|
||||
if ((_suppress_flags & MouseWatcherRegion::SF_other_button) == 0) {
|
||||
// All the other regions only get the keyboard events if they
|
||||
// set their global keyboard flag, *and* the current region does
|
||||
// not suppress keyboard buttons.
|
||||
param.set_outside(true);
|
||||
global_keystroke(param);
|
||||
// Also check all of our sub-groups.
|
||||
Groups::const_iterator gi;
|
||||
for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
|
||||
MouseWatcherGroup *group = (*gi);
|
||||
for (ri = group->_regions.begin(); ri != group->_regions.end(); ++ri) {
|
||||
MouseWatcherRegion *region = (*ri);
|
||||
|
||||
if (region->get_keyboard()) {
|
||||
param.set_outside(region != _preferred_region);
|
||||
region->keystroke(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -775,38 +788,6 @@ global_keyboard_release(const MouseWatcherParameter ¶m) {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MouseWatcher::global_keystroke
|
||||
// Access: Protected
|
||||
// Description: Calls keystroke() on all regions that are interested
|
||||
// in receiving global keyboard events, except for the
|
||||
// current region (which already received this one).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void MouseWatcher::
|
||||
global_keystroke(const MouseWatcherParameter ¶m) {
|
||||
Regions::const_iterator ri;
|
||||
for (ri = _regions.begin(); ri != _regions.end(); ++ri) {
|
||||
MouseWatcherRegion *region = (*ri);
|
||||
|
||||
if (region != _preferred_region && region->get_keyboard()) {
|
||||
region->keystroke(param);
|
||||
}
|
||||
}
|
||||
|
||||
// Also check all of our sub-groups.
|
||||
Groups::const_iterator gi;
|
||||
for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
|
||||
MouseWatcherGroup *group = (*gi);
|
||||
for (ri = group->_regions.begin(); ri != group->_regions.end(); ++ri) {
|
||||
MouseWatcherRegion *region = (*ri);
|
||||
|
||||
if (region != _preferred_region && region->get_keyboard()) {
|
||||
region->keystroke(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MouseWatcher::enter_region
|
||||
// Access: Protected
|
||||
|
@ -138,7 +138,6 @@ protected:
|
||||
void keystroke(int keycode);
|
||||
void global_keyboard_press(const MouseWatcherParameter ¶m);
|
||||
void global_keyboard_release(const MouseWatcherParameter ¶m);
|
||||
void global_keystroke(const MouseWatcherParameter ¶m);
|
||||
|
||||
INLINE void within_region(MouseWatcherRegion *region, const MouseWatcherParameter ¶m);
|
||||
INLINE void without_region(MouseWatcherRegion *region, const MouseWatcherParameter ¶m);
|
||||
|
@ -32,6 +32,14 @@ output(ostream &out) const {
|
||||
output_anything = true;
|
||||
}
|
||||
|
||||
if (has_keycode()) {
|
||||
if (output_anything) {
|
||||
out << ", ";
|
||||
}
|
||||
out << "key" << _keycode;
|
||||
output_anything = true;
|
||||
}
|
||||
|
||||
if (_mods.is_any_down()) {
|
||||
if (output_anything) {
|
||||
out << ", ";
|
||||
|
Loading…
x
Reference in New Issue
Block a user