From d9b73c6365578b40ce7ee02dbf3e093f49695bbf Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Sep 2014 17:43:01 +0000 Subject: [PATCH] refine the implementation of SetFocus, clean up unused static variables git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77835 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/x11/window.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/x11/window.cpp b/src/x11/window.cpp index 8cf3a8ec56..65761b347d 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -68,11 +68,6 @@ static wxWindowX11* g_captureWindow = NULL; static GC g_eraseGC; -// the window that has keyboard focus: -static wxWindow* gs_focusedWindow = NULL; -// the window that is about to be focused after currently focused -// one looses focus: -static wxWindow* gs_toBeFocusedWindow = NULL; // ---------------------------------------------------------------------------- // macros @@ -396,11 +391,13 @@ void wxWindowX11::SetFocus() if (!AcceptsFocus()) return; - if ( DoFindFocus() == (wxWindow*)this ) + wxWindow* focusedWindow = DoFindFocus(); + + if ( focusedWindow == (wxWindow*)this ) return; // nothing to do, focused already - if ( DoFindFocus() ) - DoFindFocus()->KillFocus(); + if ( focusedWindow ) + focusedWindow->KillFocus(); #if 0 if (GetName() == "scrollBar")