From c1f598e11777b3b4ca5c502f91435affe3a48c8c Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 20 Mar 2007 21:08:46 +0000 Subject: [PATCH] attempts at auto-focus --- panda/src/glxdisplay/glxGraphicsWindow.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/panda/src/glxdisplay/glxGraphicsWindow.cxx b/panda/src/glxdisplay/glxGraphicsWindow.cxx index 7968ecbcb8..6ec7243ec1 100644 --- a/panda/src/glxdisplay/glxGraphicsWindow.cxx +++ b/panda/src/glxdisplay/glxGraphicsWindow.cxx @@ -361,6 +361,9 @@ process_events() { case MapNotify: properties.set_minimized(false); system_changed_properties(properties); + + // Auto-focus the window when it is mapped. + XSetInputFocus(_display, _xwindow, RevertToPointerRoot, CurrentTime); break; case ClientMessage: @@ -514,6 +517,15 @@ set_properties_now(WindowProperties &properties) { properties.clear_cursor_hidden(); } + if (properties.has_foreground()) { + if (properties.get_foreground()) { + XSetInputFocus(_display, _xwindow, RevertToPointerRoot, CurrentTime); + } else { + XSetInputFocus(_display, PointerRoot, RevertToPointerRoot, CurrentTime); + } + properties.clear_foreground(); + } + set_wm_properties(wm_properties, true); }