Applied patch [ 1307056 ] [wxMSW] Focus showing fix for Win2k/XP

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35989 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2005-10-23 10:53:16 +00:00
parent dbeb8eacae
commit 1ca78aa1dc
3 changed files with 18 additions and 14 deletions

View File

@@ -34,6 +34,10 @@
#define WM_UPDATEUISTATE 0x0128 #define WM_UPDATEUISTATE 0x0128
#endif #endif
#ifndef WM_CHANGEUISTATE
#define WM_CHANGEUISTATE 0x0127
#endif
#ifndef WM_PRINTCLIENT #ifndef WM_PRINTCLIENT
#define WM_PRINTCLIENT 0x318 #define WM_PRINTCLIENT 0x318
#endif #endif

View File

@@ -469,10 +469,13 @@ protected:
// the background, false otherwise (i.e. the system should erase it) // the background, false otherwise (i.e. the system should erase it)
bool DoEraseBackground(WXHDC hDC); bool DoEraseBackground(WXHDC hDC);
// generate WM_UPDATEUISTATE if it's needed for the OS we're running under // generate WM_CHANGEUISTATE if it's needed for the OS we're running under
// //
// the parameter should be one of UIS_XXX constants // action should be one of the UIS_XXX constants
void MSWUpdateUIState(int action); // state should be one or more of the UISF_XXX constants
// if action == UIS_INITIALIZE then it doesn't seem to matter what we use
// for state as the system will decide for us what needs to be set
void MSWUpdateUIState(int action, int state = 0);
private: private:
// common part of all ctors // common part of all ctors

View File

@@ -831,9 +831,9 @@ void wxWindowMSW::WarpPointer(int x, int y)
} }
} }
void wxWindowMSW::MSWUpdateUIState(int action) void wxWindowMSW::MSWUpdateUIState(int action, int state)
{ {
// WM_UPDATEUISTATE only appeared in Windows 2000 so it can do us no good // WM_CHANGEUISTATE only appeared in Windows 2000 so it can do us no good
// to use it on older systems -- and could possibly do some harm // to use it on older systems -- and could possibly do some harm
static int s_needToUpdate = -1; static int s_needToUpdate = -1;
if ( s_needToUpdate == -1 ) if ( s_needToUpdate == -1 )
@@ -845,11 +845,9 @@ void wxWindowMSW::MSWUpdateUIState(int action)
if ( s_needToUpdate ) if ( s_needToUpdate )
{ {
// NB: it doesn't seem to matter what we put in wParam, whether we // we send WM_CHANGEUISTATE so if nothing needs changing then the system
// include just one UISF_XXX or both, both are affected, no idea // won't send WM_UPDATEUISTATE
// why ::SendMessage(GetHwnd(), WM_CHANGEUISTATE, MAKEWPARAM(action, state), 0);
::SendMessage(GetHwnd(), WM_UPDATEUISTATE,
MAKEWPARAM(action, UISF_HIDEFOCUS | UISF_HIDEACCEL), 0);
} }
} }
@@ -2106,9 +2104,8 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
{ {
// as we don't call IsDialogMessage(), which would take of // as we don't call IsDialogMessage(), which would take of
// this by default, we need to manually send this message // this by default, we need to manually send this message
// so that controls could change their appearance // so that controls can change their UI state if needed
// appropriately MSWUpdateUIState(UIS_CLEAR, UISF_HIDEFOCUS);
MSWUpdateUIState(UIS_CLEAR);
return true; return true;
} }
@@ -4656,7 +4653,7 @@ bool wxWindowMSW::HandleMouseMove(int x, int y, WXUINT flags)
GenerateMouseLeave(); GenerateMouseLeave();
} }
} }
#endif // HAVE_TRACKMOUSEEVENT #endif // HAVE_TRACKMOUSEEVENT
#if wxUSE_MOUSEEVENT_HACK #if wxUSE_MOUSEEVENT_HACK
// Windows often generates mouse events even if mouse position hasn't // Windows often generates mouse events even if mouse position hasn't