Hmm, okay, follow-up:
If I “stash” “base.mouseWatcher”, I seem to lose keyboard events, which I do want to keep.
(Perhaps I should temporarily replace “base.mouseWatcher” with a keyboard-only watcher…?)
If I set up a new MouseWatcherRegion, it seems–at least under my current implementation–to have no apparent effect: I still get mouse-over effects from things like buttons.
In case I’m doing something wrong in the latter implementation, here is, roughly, what I’m doing:
In my setup code:
# I'm presuming that the coordinates used match
# those of "render2d". However, I've also tried
# very high values (10000) to similar effect
MenuController.mouseSuppressor = MouseWatcherRegion("mouse suppressor", -1, 1, -1, 1)
# I want the suppression to initially be off, and to
# not affect the keyboard
MenuController.mouseSuppressor.setActive(False)
MenuController.mouseSuppressor.setKeyboard(False)
# And just to be safe, I'm giving this object a
# high priority
MenuController.mouseSuppressor.setSort(100)
# Finally, I set the suppression-flags.
# I haven't found a multi-flag example, so I'm
# guessing somewhat at usage.
MenuController.mouseSuppressor.setSuppressFlags(MouseWatcherRegion.SF_any_button | MouseWatcherRegion.SF_mouse_position)
When I “cease mouse mode”–i.e. enter “non-mouse mode”:
MenuController.mouseSuppressor.setActive(True)
And when I “enter mouse mode”–i.e. exit “non-mouse mode”:
MenuController.mouseSuppressor.setActive(False)
(Entering mouse-mode is driven by watching for movements of the mouse, or clicks of the mouse-buttons.)
[edit]
Okay, the creation of a new thrower/watcher seems to have done the job!
In short, this is what I now do:
In my setup code:
MenuController.keyboardOnlyThrower = ButtonThrower("keyboardOnlyThrower")
MenuController.keyboardOnlyWatcher = MouseWatcher("keyboardOnlyWatcher")
MenuController.keyboardOnlyWatcher.addChild(MenuController.keyboardOnlyThrower)
base.mouseWatcher.getParent().node().addChild(MenuController.keyboardOnlyWatcher)
MenuController.keyboardOnlyNodePath = base.mouseWatcher.getParent().find("keyboardOnlyWatcher")
MenuController.keyboardOnlyNodePath.stash()
When I “cease mouse mode”–i.e. enter “non-mouse mode”:
Common.framework.mouseWatcher.stash()
MenuController.keyboardOnlyNodePath.unstash()
And when I “enter mouse mode”–i.e. exit “non-mouse mode”:
Common.framework.mouseWatcher.unstash()
MenuController.keyboardOnlyNodePath.stash()
I’ll confess that I’m not clear on why this new watcher/thrower pair doesn’t produce the normal mouse-events–but it seems that it doesn’t. So, for now at least, it seems to be working!