Made handling of focus in and out more explicit.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@25403 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2007-08-20 22:31:09 +00:00
parent 86a9213e9f
commit 5e75161bf3
2 changed files with 135 additions and 124 deletions

View file

@ -1,3 +1,8 @@
2007-08-21 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGServerEvent.m (-processEvent:): Made handling of
focus in and out more explicit.
2007-08-16 Fred Kiefer <FredKiefer@gmx.de>
* Source/xlib/XGFontManager.m (load_cache),

View file

@ -995,6 +995,7 @@ static int check_modifier (XEvent *xEvent, KeySym key_sym,
break;
NSDebugLLog(@"Focus", @"%d got focus on %d\n",
xEvent.xfocus.window, cWin->number);
// Store this for debugging, may not be the real focus window
generic.currentFocusWindow = cWin->number;
if (xEvent.xfocus.serial == generic.focusRequestNumber)
{
@ -1023,6 +1024,8 @@ static int check_modifier (XEvent *xEvent, KeySym key_sym,
XGetInputFocus(xEvent.xfocus.display, &fw, &rev);
NSDebugLLog(@"NSEvent", @"%d FocusOut\n",
xEvent.xfocus.window);
if (fw != None && fw != PointerRoot)
{
generic.cachedWindow = [XGServer _windowForXWindow: fw];
if (cWin == 0)
{
@ -1036,19 +1039,21 @@ static int check_modifier (XEvent *xEvent, KeySym key_sym,
{
nswin = GSWindowWithNumber(cWin->number);
}
NSDebugLLog(@"Focus", @"Focus went to %d (xwin %d)\n",
(cWin) ? cWin->number : 0, fw);
if (nswin == nil)
{
if (fw == 0)
{
/* What? This is bogus. Focus has to go somewhere. */
}
else
{
nswin = nil;
}
NSDebugLLog(@"Focus", @"Focus went to %d (xwin %d)\n",
(nswin != nil) ? cWin->number : 0, fw);
// Focus went to a window not in this application.
if (nswin == nil)
{
[NSApp deactivate];
}
}
// Clean up old focus request
generic.cachedWindow
= [XGServer _windowForXWindow: xEvent.xfocus.window];
NSDebugLLog(@"Focus", @"%d lost focus on %d\n",
@ -1564,7 +1569,8 @@ static int check_modifier (XEvent *xEvent, KeySym key_sym,
cWin->number, generic.currentFocusWindow, key_num);
/* Sometimes window managers lose the setinputfocus on the key window
* e.g. when ordering out a window with focus then ordering in the key window. * it might search for a window until one accepts its take focus request.
* e.g. when ordering out a window with focus then ordering in the key window.
* it might search for a window until one accepts its take focus request.
*/
if (key_num == cWin->number)
cWin->ignore_take_focus = NO;