From c8e3c72b3a8e3e6f0b49d3d6f67fc0d9900dd196 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 23 Jan 2012 23:20:47 +0000 Subject: [PATCH] catch keyboard focus, mouse capture --- direct/src/wxwidgets/WxPandaWindow.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/direct/src/wxwidgets/WxPandaWindow.py b/direct/src/wxwidgets/WxPandaWindow.py index 1761d19777..585a75558b 100644 --- a/direct/src/wxwidgets/WxPandaWindow.py +++ b/direct/src/wxwidgets/WxPandaWindow.py @@ -174,6 +174,7 @@ else: raise StandardError, "Couldn't get an OpenGL pipe." self.win = base.openWindow(callbackWindowDict = callbackWindowDict, pipe = pipe, gsg = gsg, type = 'onscreen') + self.hasCapture = False self.inputDevice = None if hasattr(self.win, 'getInputDevice'): self.inputDevice = self.win.getInputDevice(0) @@ -216,9 +217,16 @@ else: self.win = None def __buttonDown(self, button): + self.SetFocus() + if not self.hasCapture: + self.CaptureMouse() + self.hasCapture = True self.inputDevice.buttonDown(button) def __buttonUp(self, button): + if self.hasCapture: + self.ReleaseMouse() + self.hasCapture = False self.inputDevice.buttonUp(button) def __mouseMotion(self, event):