mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -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::
|
INLINE string PGItem::
|
||||||
get_keystroke_event() const {
|
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_modifier_buttons(_mods);
|
||||||
param.set_mouse(_mouse);
|
param.set_mouse(_mouse);
|
||||||
|
|
||||||
// Send the event to every region that wants keyboard buttons,
|
// Keystrokes go to all those regions that want keyboard events,
|
||||||
// regardless of the mouse position.
|
// regardless of which is the "preferred" region (that is, without
|
||||||
if (_preferred_region != (MouseWatcherRegion *)NULL) {
|
// respect to the mouse position). However, we do set the outside
|
||||||
// Our current region, the one under the mouse, always get
|
// flag according to whether the given region is preferred region or
|
||||||
// all the keyboard events, even if it doesn't set its
|
// not.
|
||||||
// keyboard flag.
|
|
||||||
_preferred_region->keystroke(param);
|
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) {
|
// Also check all of our sub-groups.
|
||||||
// All the other regions only get the keyboard events if they
|
Groups::const_iterator gi;
|
||||||
// set their global keyboard flag, *and* the current region does
|
for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
|
||||||
// not suppress keyboard buttons.
|
MouseWatcherGroup *group = (*gi);
|
||||||
param.set_outside(true);
|
for (ri = group->_regions.begin(); ri != group->_regions.end(); ++ri) {
|
||||||
global_keystroke(param);
|
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
|
// Function: MouseWatcher::enter_region
|
||||||
// Access: Protected
|
// Access: Protected
|
||||||
|
@ -138,7 +138,6 @@ protected:
|
|||||||
void keystroke(int keycode);
|
void keystroke(int keycode);
|
||||||
void global_keyboard_press(const MouseWatcherParameter ¶m);
|
void global_keyboard_press(const MouseWatcherParameter ¶m);
|
||||||
void global_keyboard_release(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 within_region(MouseWatcherRegion *region, const MouseWatcherParameter ¶m);
|
||||||
INLINE void without_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;
|
output_anything = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (has_keycode()) {
|
||||||
|
if (output_anything) {
|
||||||
|
out << ", ";
|
||||||
|
}
|
||||||
|
out << "key" << _keycode;
|
||||||
|
output_anything = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (_mods.is_any_down()) {
|
if (_mods.is_any_down()) {
|
||||||
if (output_anything) {
|
if (output_anything) {
|
||||||
out << ", ";
|
out << ", ";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user