mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Focus fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5647 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5ae01adca9
commit
5c769d641e
3 changed files with 63 additions and 65 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun Jan 2 20:20:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSApplication.m: Fixes for focusm handling.
|
||||
* Source/NSWindow.m: ditto
|
||||
|
||||
Fri Dec 31 17:28:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSSlider.m: ([drawRect:]) minor drawing fix to ensure that
|
||||
|
|
|
@ -262,7 +262,6 @@ static NSCell* tileCell = nil;
|
|||
- _appIconInit
|
||||
{
|
||||
NSAppIconView *iv;
|
||||
NSGraphicsContext *context = GSCurrentContext();
|
||||
|
||||
if (app_icon == nil)
|
||||
app_icon = [[NSImage imageNamed: @"GNUstep"] retain];
|
||||
|
@ -279,7 +278,7 @@ static NSCell* tileCell = nil;
|
|||
[iv setImage: app_icon];
|
||||
|
||||
[_app_icon_window orderFrontRegardless];
|
||||
DPSsetinputfocus(context, [_app_icon_window windowNumber]);
|
||||
DPSsetinputfocus(GSCurrentContext(), [_app_icon_window windowNumber]);
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -487,9 +486,7 @@ static NSCell* tileCell = nil;
|
|||
*/
|
||||
if ([self keyWindow] == nil)
|
||||
{
|
||||
NSGraphicsContext *context = GSCurrentContext();
|
||||
|
||||
DPSsetinputfocus(context, [_app_icon_window windowNumber]);
|
||||
DPSsetinputfocus(GSCurrentContext(), [_app_icon_window windowNumber]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -716,7 +713,6 @@ static NSCell* tileCell = nil;
|
|||
{
|
||||
if (app_is_active == NO)
|
||||
{
|
||||
NSWindow *kw;
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
unsigned count = [_inactive count];
|
||||
unsigned i;
|
||||
|
@ -729,17 +725,20 @@ static NSCell* tileCell = nil;
|
|||
object: self];
|
||||
|
||||
NSDebugLog(@"activateIgnoringOtherApps start.");
|
||||
|
||||
app_is_active = YES;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
[[_inactive objectAtIndex: i] orderFrontRegardless];
|
||||
}
|
||||
if ([self keyWindow] == nil && [_inactive containsObject: _hidden_key])
|
||||
[_inactive removeAllObjects];
|
||||
if (_hidden_key != nil
|
||||
&& [[self windows] indexOfObjectIdenticalTo: _hidden_key] != NSNotFound)
|
||||
{
|
||||
[_hidden_key makeKeyWindow];
|
||||
_hidden_key = nil;
|
||||
}
|
||||
[_inactive removeAllObjects];
|
||||
|
||||
[main_menu update];
|
||||
[main_menu display];
|
||||
|
@ -749,14 +748,6 @@ static NSCell* tileCell = nil;
|
|||
[self unhide: nil];
|
||||
}
|
||||
|
||||
kw = [self keyWindow];
|
||||
if (kw != nil)
|
||||
{
|
||||
[kw resignKeyWindow];
|
||||
[kw orderFront: self];
|
||||
[kw makeKeyWindow];
|
||||
}
|
||||
|
||||
NSDebugLog(@"activateIgnoringOtherApps end.");
|
||||
|
||||
[nc postNotificationName: NSApplicationDidBecomeActiveNotification
|
||||
|
@ -776,9 +767,13 @@ static NSCell* tileCell = nil;
|
|||
[nc postNotificationName: NSApplicationWillResignActiveNotification
|
||||
object: self];
|
||||
|
||||
app_is_active = NO;
|
||||
|
||||
if ([self keyWindow] != nil)
|
||||
{
|
||||
_hidden_key = [self keyWindow];
|
||||
[_hidden_key resignKeyWindow];
|
||||
DPSsetinputfocus(GSCurrentContext(), [_app_icon_window windowNumber]);
|
||||
}
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
|
@ -799,8 +794,6 @@ static NSCell* tileCell = nil;
|
|||
}
|
||||
}
|
||||
|
||||
app_is_active = NO;
|
||||
|
||||
[nc postNotificationName: NSApplicationDidResignActiveNotification
|
||||
object: self];
|
||||
}
|
||||
|
@ -1391,6 +1384,8 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
if ([self keyWindow] != nil)
|
||||
{
|
||||
_hidden_key = [self keyWindow];
|
||||
[_hidden_key resignKeyWindow];
|
||||
DPSsetinputfocus(GSCurrentContext(), [_app_icon_window windowNumber]);
|
||||
}
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
|
@ -1451,26 +1446,26 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
if (app_is_hidden == YES)
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
unsigned count = [_hidden count];
|
||||
unsigned count;
|
||||
unsigned i;
|
||||
|
||||
[nc postNotificationName: NSApplicationWillUnhideNotification
|
||||
object: self];
|
||||
|
||||
app_is_hidden = NO;
|
||||
count = [_hidden count];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
[[_hidden objectAtIndex: i] orderFrontRegardless];
|
||||
}
|
||||
if ([self keyWindow] == nil && [_hidden containsObject: _hidden_key])
|
||||
[_hidden removeAllObjects];
|
||||
if (_hidden_key != nil
|
||||
&& [[self windows] indexOfObjectIdenticalTo: _hidden_key] != NSNotFound)
|
||||
{
|
||||
NSGraphicsContext *context = GSCurrentContext();
|
||||
|
||||
[_hidden_key makeKeyAndOrderFront: self];
|
||||
DPSsetinputfocus(context, [_hidden_key windowNumber]);
|
||||
_hidden_key = nil;
|
||||
}
|
||||
[_hidden removeAllObjects];
|
||||
|
||||
app_is_hidden = NO;
|
||||
|
||||
[nc postNotificationName: NSApplicationDidUnhideNotification
|
||||
object: self];
|
||||
|
|
|
@ -549,10 +549,7 @@ static NSMapTable* windowmaps = NULL;
|
|||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
_f.is_key = YES;
|
||||
if ([self isVisible] == YES)
|
||||
{
|
||||
DPSsetinputfocus(GSCurrentContext(), [self windowNumber]);
|
||||
}
|
||||
DPSsetinputfocus(GSCurrentContext(), [self windowNumber]);
|
||||
[self resetCursorRects];
|
||||
[nc postNotificationName: NSWindowDidBecomeKeyNotification object: self];
|
||||
}
|
||||
|
@ -670,6 +667,7 @@ static NSMapTable* windowmaps = NULL;
|
|||
unsigned i;
|
||||
NSWindow *w;
|
||||
|
||||
_f.visible = NO;
|
||||
if (_rFlags.needs_display == YES)
|
||||
{
|
||||
/*
|
||||
|
@ -697,19 +695,18 @@ static NSMapTable* windowmaps = NULL;
|
|||
}
|
||||
}
|
||||
/*
|
||||
* if we didn't find a possible key window - use tha app icon or,
|
||||
* if we didn't find a possible key window - use the app icon or,
|
||||
* failing that, use the menu window.
|
||||
*/
|
||||
if (i == pos)
|
||||
{
|
||||
w = [NSApp iconWindow];
|
||||
if (w != nil && [w isVisible] == YES)
|
||||
{
|
||||
[GSCurrentContext() DPSsetinputfocus: [w windowNumber]];
|
||||
}
|
||||
else
|
||||
if (w == nil || [w isVisible] == NO)
|
||||
{
|
||||
w = [[NSApp mainMenu] window];
|
||||
}
|
||||
if (w != nil && [w isVisible] == YES)
|
||||
{
|
||||
[GSCurrentContext() DPSsetinputfocus: [w windowNumber]];
|
||||
}
|
||||
}
|
||||
|
@ -721,7 +718,7 @@ static NSMapTable* windowmaps = NULL;
|
|||
[self resignMainWindow];
|
||||
if (w != nil && [w canBecomeMainWindow])
|
||||
{
|
||||
[w makeKeyWindow];
|
||||
[w makeMainWindow];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1819,35 +1816,36 @@ resetCursorRectsForView(NSView *theView)
|
|||
switch (type)
|
||||
{
|
||||
case NSLeftMouseDown: // Left mouse down
|
||||
v = [content_view hitTest: [theEvent locationInWindow]];
|
||||
if (first_responder != v)
|
||||
{
|
||||
[self makeFirstResponder: v];
|
||||
if (_f.is_key || [v acceptsFirstMouse: theEvent] == YES)
|
||||
{
|
||||
if([NSHelpManager isContextHelpModeActive])
|
||||
{
|
||||
[v helpRequested: theEvent];
|
||||
}
|
||||
else
|
||||
{
|
||||
[v mouseDown: theEvent];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if([NSHelpManager isContextHelpModeActive])
|
||||
{
|
||||
[v helpRequested: theEvent];
|
||||
}
|
||||
else
|
||||
{
|
||||
[v mouseDown: theEvent];
|
||||
}
|
||||
}
|
||||
last_point = [theEvent locationInWindow];
|
||||
break;
|
||||
{
|
||||
BOOL wasKey = _f.is_key;
|
||||
|
||||
if ([NSApp isActive] == NO && self != [NSApp iconWindow])
|
||||
{
|
||||
[NSApp activateIgnoringOtherApps: YES];
|
||||
}
|
||||
if (_f.is_key == NO)
|
||||
{
|
||||
[self makeKeyAndOrderFront: self];
|
||||
}
|
||||
v = [content_view hitTest: [theEvent locationInWindow]];
|
||||
if (first_responder != v)
|
||||
{
|
||||
[self makeFirstResponder: v];
|
||||
}
|
||||
if (wasKey == YES || [v acceptsFirstMouse: theEvent] == YES)
|
||||
{
|
||||
if ([NSHelpManager isContextHelpModeActive])
|
||||
{
|
||||
[v helpRequested: theEvent];
|
||||
}
|
||||
else
|
||||
{
|
||||
[v mouseDown: theEvent];
|
||||
}
|
||||
}
|
||||
last_point = [theEvent locationInWindow];
|
||||
break;
|
||||
}
|
||||
|
||||
case NSLeftMouseUp: // Left mouse up
|
||||
v = first_responder; /* Send to the view that got the mouse down. */
|
||||
|
|
Loading…
Reference in a new issue