From 211cc8dc907ee50ca6d383b8df16bba9a4d3ce2d Mon Sep 17 00:00:00 2001
From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= <vslavik@fastmail.fm>
Date: Sat, 18 Aug 2001 23:13:03 +0000
Subject: [PATCH] better focus handling (blind fix)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11407 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/univ/themes/gtk.cpp   | 2 +-
 src/univ/themes/win32.cpp | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/univ/themes/gtk.cpp b/src/univ/themes/gtk.cpp
index 23f371ec8e..ec6405a78f 100644
--- a/src/univ/themes/gtk.cpp
+++ b/src/univ/themes/gtk.cpp
@@ -2363,7 +2363,7 @@ bool wxGTKInputHandler::HandleMouse(wxControl *control,
                                     const wxMouseEvent& event)
 {
     // clicking on the control gives it focus
-    if ( event.ButtonDown() )
+    if ( event.ButtonDown() && wxWindow::FindFocus() != control )
     {
         control->SetFocus();
 
diff --git a/src/univ/themes/win32.cpp b/src/univ/themes/win32.cpp
index 349c3f088e..3f682335bc 100644
--- a/src/univ/themes/win32.cpp
+++ b/src/univ/themes/win32.cpp
@@ -1,4 +1,3 @@
-///////////////////////////////////////////////////////////////////////////////
 // Name:        univ/themes/win32.cpp
 // Purpose:     wxUniversal theme implementing Win32-like LNF
 // Author:      Vadim Zeitlin
@@ -3056,6 +3055,14 @@ bool wxWin32InputHandler::HandleKey(wxControl *control,
 bool wxWin32InputHandler::HandleMouse(wxControl *control,
                                       const wxMouseEvent& event)
 {
+    // clicking on the control gives it focus
+    if ( event.ButtonDown() && wxWindow::FindFocus() != control )
+    {
+        control->SetFocus();
+
+        return TRUE;
+    }
+
     return FALSE;
 }
 
-- 
2.45.2