mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-26 18:50:58 +00:00
Window focus fixes.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18095 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f6376f7f65
commit
c5f62bc38c
3 changed files with 50 additions and 21 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
2003-11-19 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
|
* Window Focus fixes.
|
||||||
|
* Source/NSApplication.m (-activateIgnoringOtherApps:): Make
|
||||||
|
hidden_key key only if we have no key, make main key if neither,
|
||||||
|
make menu key as last resort.
|
||||||
|
(-deactivate): Resign main window.
|
||||||
|
(Patches from Benhur Stein <benhur@inf.ufsm.br>).
|
||||||
|
(-unhideWithoutActivation): Set hidden=no before ordering windows
|
||||||
|
to avoid possible recursive loops.
|
||||||
|
* Source/NSWindow.m (-sendEvent:)(NSLeftMouseDown): Activate app
|
||||||
|
after ordering window front.
|
||||||
|
(-sendEvent:)(GSAppKitWindowFocusIn): Don't make ourselves key
|
||||||
|
if we're not the modal window. Remove check for app isHidden.
|
||||||
|
|
||||||
2003-11-19 03:17 Alexander Malmberg <alexander@malmberg.org>
|
2003-11-19 03:17 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
* Source/NSClipView.m (-autoscroll:): Reimplement correctly.
|
* Source/NSClipView.m (-autoscroll:): Reimplement correctly.
|
||||||
|
|
|
@ -931,7 +931,7 @@ static NSCell* tileCell = nil;
|
||||||
[[_inactive objectAtIndex: i] orderFrontRegardless];
|
[[_inactive objectAtIndex: i] orderFrontRegardless];
|
||||||
}
|
}
|
||||||
[_inactive removeAllObjects];
|
[_inactive removeAllObjects];
|
||||||
if (_hidden_key != nil
|
if ([self keyWindow] == nil && _hidden_key != nil
|
||||||
&& [[self windows] indexOfObjectIdenticalTo: _hidden_key] != NSNotFound)
|
&& [[self windows] indexOfObjectIdenticalTo: _hidden_key] != NSNotFound)
|
||||||
{
|
{
|
||||||
[_hidden_key makeKeyWindow];
|
[_hidden_key makeKeyWindow];
|
||||||
|
@ -949,8 +949,17 @@ static NSCell* tileCell = nil;
|
||||||
}
|
}
|
||||||
else if ([self mainWindow] != nil)
|
else if ([self mainWindow] != nil)
|
||||||
{
|
{
|
||||||
[[self mainWindow] orderFront: self];
|
[[self mainWindow] makeKeyAndOrderFront: self];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* We need give input focus to some window otherwise we'll never get
|
||||||
|
keyboard events. FIXME: doesn't work. */
|
||||||
|
NSWindow *menu_window= [[self mainMenu] window];
|
||||||
|
NSDebugLLog(@"Focus", @"No key on activation - make menu key");
|
||||||
|
[GSServerForWindow(menu_window) setinputfocus:
|
||||||
|
[menu_window windowNumber]];
|
||||||
|
}
|
||||||
|
|
||||||
[nc postNotificationName: NSApplicationDidBecomeActiveNotification
|
[nc postNotificationName: NSApplicationDidBecomeActiveNotification
|
||||||
object: self];
|
object: self];
|
||||||
|
@ -975,6 +984,10 @@ static NSCell* tileCell = nil;
|
||||||
_hidden_key = [self keyWindow];
|
_hidden_key = [self keyWindow];
|
||||||
[_hidden_key resignKeyWindow];
|
[_hidden_key resignKeyWindow];
|
||||||
}
|
}
|
||||||
|
// FIXME: main window is not saved for when the app is activated again.
|
||||||
|
// This is not a problem if it is also key, and I'm not sure if it
|
||||||
|
// is a problem at all. May be annoying in the case of workspace switch.
|
||||||
|
[[self mainWindow] resignMainWindow];
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
NSModalSession theSession;
|
NSModalSession theSession;
|
||||||
|
@ -1496,13 +1509,11 @@ See -runModalForWindow:
|
||||||
if (!theEvent)
|
if (!theEvent)
|
||||||
NSDebugLLog(@"NSEvent", @"NSEvent is nil!\n");
|
NSDebugLLog(@"NSEvent", @"NSEvent is nil!\n");
|
||||||
if (type == NSMouseMoved)
|
if (type == NSMouseMoved)
|
||||||
NSDebugLLog(@"NSMotionEvent", @"Send move (%d) to window %@",
|
NSDebugLLog(@"NSMotionEvent", @"Send move (%d) to window %d",
|
||||||
type, ((window != nil) ? [window description]
|
type, [window windowNumber]);
|
||||||
: @"No window"));
|
|
||||||
else
|
else
|
||||||
NSDebugLLog(@"NSEvent", @"Send NSEvent type: %d to window %@",
|
NSDebugLLog(@"NSEvent", @"Send NSEvent type: %d to window %d",
|
||||||
type, ((window != nil) ? [window description]
|
type, [window windowNumber]);
|
||||||
: @"No window"));
|
|
||||||
if (window)
|
if (window)
|
||||||
[window sendEvent: theEvent];
|
[window sendEvent: theEvent];
|
||||||
else if (type == NSRightMouseDown)
|
else if (type == NSRightMouseDown)
|
||||||
|
@ -1884,6 +1895,11 @@ image.
|
||||||
[nc postNotificationName: NSApplicationWillUnhideNotification
|
[nc postNotificationName: NSApplicationWillUnhideNotification
|
||||||
object: self];
|
object: self];
|
||||||
|
|
||||||
|
/* Make sure we set this before ordering windows to avoid possible
|
||||||
|
recursive loops (some methods window/backend methods check if
|
||||||
|
the app is hidden before ordering a window). */
|
||||||
|
_app_is_hidden = NO;
|
||||||
|
|
||||||
count = [_hidden count];
|
count = [_hidden count];
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
@ -1897,8 +1913,6 @@ image.
|
||||||
_hidden_key = nil;
|
_hidden_key = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
_app_is_hidden = NO;
|
|
||||||
|
|
||||||
[nc postNotificationName: NSApplicationDidUnhideNotification
|
[nc postNotificationName: NSApplicationDidUnhideNotification
|
||||||
object: self];
|
object: self];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2852,10 +2852,6 @@ Code shared with [NSPanel -sendEvent:], remember to update both places.
|
||||||
{
|
{
|
||||||
BOOL wasKey = _f.is_key;
|
BOOL wasKey = _f.is_key;
|
||||||
|
|
||||||
if ([NSApp isActive] == NO && self != [NSApp iconWindow])
|
|
||||||
{
|
|
||||||
[NSApp activateIgnoringOtherApps: YES];
|
|
||||||
}
|
|
||||||
if (_f.has_closed == NO)
|
if (_f.has_closed == NO)
|
||||||
{
|
{
|
||||||
v = [_contentView hitTest: [theEvent locationInWindow]];
|
v = [_contentView hitTest: [theEvent locationInWindow]];
|
||||||
|
@ -2863,6 +2859,12 @@ Code shared with [NSPanel -sendEvent:], remember to update both places.
|
||||||
{
|
{
|
||||||
[self makeKeyAndOrderFront: self];
|
[self makeKeyAndOrderFront: self];
|
||||||
}
|
}
|
||||||
|
/* Activate the app *after* making the receiver key, as app
|
||||||
|
activation tries to make the previous key window key. */
|
||||||
|
if ([NSApp isActive] == NO && self != [NSApp iconWindow])
|
||||||
|
{
|
||||||
|
[NSApp activateIgnoringOtherApps: YES];
|
||||||
|
}
|
||||||
if (_firstResponder != v)
|
if (_firstResponder != v)
|
||||||
{
|
{
|
||||||
[self makeFirstResponder: v];
|
[self makeFirstResponder: v];
|
||||||
|
@ -3075,19 +3077,17 @@ Code shared with [NSPanel -sendEvent:], remember to update both places.
|
||||||
{
|
{
|
||||||
/* Window Manager just deminiaturized us */
|
/* Window Manager just deminiaturized us */
|
||||||
[self deminiaturize: self];
|
[self deminiaturize: self];
|
||||||
//[self _didDeminiaturize: self];
|
|
||||||
}
|
}
|
||||||
if ([NSApp isHidden])
|
if ([NSApp modalWindow]
|
||||||
|
&& self != [NSApp modalWindow])
|
||||||
{
|
{
|
||||||
/* This often occurs when hidding an app, since a bunch
|
/* Ignore this request. We're in a modal loop and the
|
||||||
of windows get hidden at once, and the WM is searching
|
user pressed on the title bar of another window. */
|
||||||
for a window to take focus after each one gets
|
|
||||||
hidden. */
|
|
||||||
NSDebugLLog(@"Focus", @"WM take focus while hiding");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ([self canBecomeKeyWindow] == YES)
|
if ([self canBecomeKeyWindow] == YES)
|
||||||
{
|
{
|
||||||
|
NSDebugLLog(@"Focus", @"Making %d key", _windowNum);
|
||||||
[self makeKeyWindow];
|
[self makeKeyWindow];
|
||||||
[self makeMainWindow];
|
[self makeMainWindow];
|
||||||
[NSApp activateIgnoringOtherApps: YES];
|
[NSApp activateIgnoringOtherApps: YES];
|
||||||
|
|
Loading…
Reference in a new issue