mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 16:10:48 +00:00
Fix management of windows whose hide on deactivate attribute is set.
In particular, such windows remain ordered out when the application orders them out while it is not active and then is activated again. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33213 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
31ff24d0c6
commit
78fb85fbcf
3 changed files with 74 additions and 2 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2011-05-31 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/NSWindow.m (-orderWindow:relativeTo:): Take care of hide
|
||||
on deactivate windows.
|
||||
* Source/NSWindow.m (-setHidesOnDeactivate:): Hide/unhide receiver
|
||||
when the flag is changed and the application is not active.
|
||||
|
||||
* Source/NSWindow.m (-_isWindowInactive:, _setWindow:inactivate:):
|
||||
New private NSApplication category to support management of hide
|
||||
on deactivate windows.
|
||||
|
||||
* Source/NSApplication.m (-deactivate): Fix order of actions when
|
||||
hiding inactive windows.
|
||||
|
||||
2011-05-31 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/NSImage.m (-bestRepresentationForDevice): Prefer
|
||||
|
|
|
@ -1433,8 +1433,12 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
|
|||
|
||||
if ([win hidesOnDeactivate] == YES)
|
||||
{
|
||||
[_inactive addObject: win];
|
||||
/* NB Order is important here. When a hide on deactivate window
|
||||
is ordered out while the application is inactive, it gets
|
||||
removed from the _inactive list. Therefore, we must first
|
||||
order out the window and then add it to the _inactive list. */
|
||||
[win orderOut: self];
|
||||
[_inactive addObject: win];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -124,6 +124,11 @@ BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
|
|||
- (id) _initWithScreenNumber: (int)screen;
|
||||
@end
|
||||
|
||||
@interface NSApplication(Inactive)
|
||||
- (BOOL) _isWindowInactive: (NSWindow *)window;
|
||||
- (void) _setWindow: (NSWindow *)window inactive: (BOOL)inactive;
|
||||
@end
|
||||
|
||||
|
||||
/*
|
||||
* Category for internal methods (for use only within the NSWindow class itself
|
||||
|
@ -1716,7 +1721,7 @@ many times.
|
|||
{
|
||||
/* Windows need to be constrained when displayed or resized - but only
|
||||
titled windows are constrained. Also, and this is the tricky part,
|
||||
don't constrain if we are merely unhidding the window or if it's
|
||||
don't constrain if we are merely unhiding the window or if it's
|
||||
already visible and is just being reordered. */
|
||||
if ((_styleMask & NSTitledWindowMask)
|
||||
&& [NSApp isHidden] == NO
|
||||
|
@ -1734,6 +1739,14 @@ many times.
|
|||
}
|
||||
}
|
||||
|
||||
/* If a hide on deactivate window is explicitly ordered in or out while
|
||||
the application is not active, remove it from the list of inactive
|
||||
windows. */
|
||||
if ([self hidesOnDeactivate] && ![NSApp isActive])
|
||||
{
|
||||
[NSApp _setWindow: self inactive: NO];
|
||||
}
|
||||
|
||||
// Draw content before backend window ordering
|
||||
if (display)
|
||||
[_wv display];
|
||||
|
@ -1841,6 +1854,28 @@ many times.
|
|||
if (flag != _f.hides_on_deactivate)
|
||||
{
|
||||
_f.hides_on_deactivate = flag;
|
||||
if (![NSApp isActive])
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
if (_f.visible)
|
||||
{
|
||||
/* Order is important here. We must first order out the window
|
||||
and then add it to the inactive list, since -orderOut:
|
||||
removes the receiver from the inactive list. */
|
||||
[self orderOut: nil];
|
||||
[NSApp _setWindow: self inactive: YES];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([NSApp _isWindowInactive: self])
|
||||
{
|
||||
[NSApp _setWindow: self inactive: NO];
|
||||
[self orderFront: nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5532,6 +5567,25 @@ current key view.<br />
|
|||
}
|
||||
@end
|
||||
|
||||
@implementation NSApplication(Inactive)
|
||||
- (BOOL) _isWindowInactive: (NSWindow *)window
|
||||
{
|
||||
return [_inactive containsObject: window];
|
||||
}
|
||||
|
||||
- (void) _setWindow: (NSWindow *)window inactive: (BOOL)inactive
|
||||
{
|
||||
if (inactive)
|
||||
{
|
||||
[_inactive addObject: window];
|
||||
}
|
||||
else
|
||||
{
|
||||
[_inactive removeObject: window];
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo)
|
||||
{
|
||||
NSPasteboard *pb = [dragInfo draggingPasteboard];
|
||||
|
|
Loading…
Reference in a new issue