fix problems with key window status on Windows

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@30207 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Doug Simons 2010-04-20 19:52:22 +00:00
parent 287c0049dd
commit 7d826fbd3c
2 changed files with 18 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2010-04-20 Doug Simons <doug.simons@testplant.com>
* Source/win32/WIN32Server.m:
Fix problem with key events going to window other than the key window.
Block callbacks while setting the foreground window to prevent key/main
window changes from cascading in a feedback loop.
2010-04-18 Eric Wasylishen <ewasylishen@gmail.com>
* Source/winlib/WIN32FontInfo.m:

View file

@ -1198,8 +1198,11 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
if (otherWin == (int)HWND_TOP)
SetForegroundWindow((HWND)winNum);
{
_enableCallbacks = NO;
SetForegroundWindow((HWND)winNum);
_enableCallbacks = YES;
}
/* For debug log window stack.
*/
if (GSDebugSet(@"WTrace") == YES)
@ -1834,11 +1837,16 @@ process_key_event(WIN32Server *svr, HWND hwnd, WPARAM wParam, LPARAM lParam,
if (eventFlags & NSShiftKeyMask)
ukeys = [ukeys uppercaseString];
// key events should go to the key window if we have one (Windows' focus window isn't always appropriate)
int windowNumber = [[NSApp keyWindow] windowNumber];
if (windowNumber == 0)
windowNumber = (int)hwnd;
event = [NSEvent keyEventWithType: eventType
location: eventLocation
modifierFlags: eventFlags
timestamp: time
windowNumber: (int)hwnd
windowNumber: windowNumber
context: gcontext
characters: keys
charactersIgnoringModifiers: ukeys