Only send event on take focus if we don't have a key window.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@14799 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-10-19 03:04:37 +00:00
parent f6fec66519
commit 3024169398
2 changed files with 25 additions and 16 deletions

View file

@ -1,3 +1,9 @@
2002-10-18 Adam Fedor <fedor@gnu.org>
* Source/x11/XGServerEvent.m ([XGServer
-receivedEvent:type:extra:forMode:] (ClientMessage:TAKE_FOCUS)):
Only send event if we don't have a key window.
2002-10-15 01:37 Alexander Malmberg <alexander@malmberg.org>
* Tools/GNUmakefile: Use BUILD_SERVER to decide whether to build

View file

@ -496,13 +496,26 @@ static inline int check_modifier (XEvent *xEvent, KeyCode key_code)
/*
* WM is asking us to take the keyboard focus
*/
NSDebugLLog(@"Focus", @"check focus: %d", cWin->number);
nswin = [NSApp keyWindow];
if (nswin == nil
|| [nswin windowNumber] != cWin->number)
NSDebugLLog(@"Focus", @"take focus:%d (current=%d key=%d)",
cWin->number,
generic.currentFocusWindow,
[nswin windowNumber]);
if (generic.desiredFocusWindow
&& cWin->number != generic.desiredFocusWindow)
{
NSDebugLLog(@"Focus", @" but desired focus is %d",
generic.desiredFocusWindow);
}
generic.desiredFocusWindow = 0;
generic.focusRequestNumber = 0;
/* Only send an event if we don't have a key
window already (If we have a key window, that
means the AppKit originated whatever event got us
here). This would happen if the app was inactive
and this is a call for the app to activate */
if (nswin == nil)
{
generic.desiredFocusWindow = 0;
generic.focusRequestNumber = 0;
eventLocation = NSMakePoint(0,0);
e = [NSEvent otherEventWithType:NSAppKitDefined
location: eventLocation
@ -514,16 +527,6 @@ static inline int check_modifier (XEvent *xEvent, KeyCode key_code)
data1: 0
data2: 0];
}
else if (generic.desiredFocusWindow != 0)
{
/*
* We reassert our desire to have input
* focus in our existing key window.
*/
[self setinputstate: GSTitleBarKey
: [nswin windowNumber]];
[self setinputfocus: [nswin windowNumber]];
}
}
}
else if (xEvent.xclient.message_type == dnd.XdndEnter)
@ -908,7 +911,7 @@ static inline int check_modifier (XEvent *xEvent, KeyCode key_code)
}
cWin = [XGServer _windowForXWindow: xEvent.xfocus.window];
NSDebugLLog(@"Focus", @"%d lost focus on %d\n",
xEvent.xfocus.window, cWin->number);
xEvent.xfocus.window, (cWin) ? cWin->number : 0);
}
break;