mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Partial code for using miniaturised app icon to unhide a hidden app.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28832 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
11ad2da52b
commit
c72cc49307
4 changed files with 115 additions and 35 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2009-10-17 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSWindow.m:
|
||||
* Source/NSApplication.m:
|
||||
* Headers/AppKit/NSEvent.h:
|
||||
Changes to unhide app when a suppressed app icon is deminiaturised.
|
||||
Code conditional on defining MINI_ICON to 1 in NSApplication.m
|
||||
Currently doesn't work because the backend is not notifying the gui
|
||||
when a window is deminiaturised :-(
|
||||
|
||||
2009-10-17 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSApplication.m: Make GSSuppressAppIconhide the icon window
|
||||
|
|
|
@ -474,7 +474,8 @@ typedef enum {
|
|||
GSAppKitDraggingExit,
|
||||
GSAppKitDraggingDrop,
|
||||
GSAppKitDraggingFinished,
|
||||
GSAppKitRegionExposed
|
||||
GSAppKitRegionExposed,
|
||||
GSAppKitWindowDeminiaturize,
|
||||
} GSAppKitSubtype;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -87,6 +87,9 @@
|
|||
#include "NSDocumentFrameworkPrivate.h"
|
||||
#include "NSToolbarFrameworkPrivate.h"
|
||||
|
||||
// minimize icon when suppressed?
|
||||
#define MINI_ICON 0
|
||||
|
||||
/* The -gui thread. See the comment in initialize_gnustep_backend. */
|
||||
NSThread *GSAppKitThread;
|
||||
|
||||
|
@ -439,6 +442,19 @@ NSApplication *NSApp = nil;
|
|||
[self setTitle: [[NSProcessInfo processInfo] processName]];
|
||||
[self setExcludedFromWindowsMenu: YES];
|
||||
[self setReleasedWhenClosed: NO];
|
||||
|
||||
#if MINI_ICON
|
||||
/* Hack ...
|
||||
* At least one window manager won't miniaturize a window unless
|
||||
* it's at the standard level. If the app icon is suppressed, we
|
||||
* may still want a miniaturised version while the app is hidden.
|
||||
*/
|
||||
if (YES == [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"GSSuppressAppIcon"])
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
_windowLevel = NSDockWindowLevel;
|
||||
}
|
||||
|
||||
|
@ -2343,12 +2359,25 @@ image.</p><p>See Also: -applicationIconImage</p>
|
|||
[win orderOut: self];
|
||||
}
|
||||
_app_is_hidden = YES;
|
||||
[[_app_icon_window contentView] setNeedsDisplay: YES];
|
||||
|
||||
if ([[NSUserDefaults standardUserDefaults]
|
||||
if (YES == [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"GSSuppressAppIcon"])
|
||||
{
|
||||
#if MINI_ICON
|
||||
NSRect f = [[[self mainMenu] window] frame];
|
||||
NSPoint p = f.origin;
|
||||
|
||||
p.y += f.size.height;
|
||||
[_app_icon_window setFrameTopLeftPoint: p];
|
||||
[_app_icon_window orderFrontRegardless];
|
||||
[_app_icon_window miniaturize: self];
|
||||
#else
|
||||
[_app_icon_window orderFrontRegardless];
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
[[_app_icon_window contentView] setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3611,9 +3640,20 @@ struct _DelegateWrapper
|
|||
NSAppIconView *iv;
|
||||
NSSize iconSize = [GSCurrentServer() iconSize];
|
||||
NSRect iconRect = NSMakeRect(0, 0, iconSize.width, iconSize.height);
|
||||
unsigned mask = NSIconWindowMask;
|
||||
BOOL suppress;
|
||||
|
||||
suppress = [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"GSSuppressAppIcon"];
|
||||
#if MINI_ICON
|
||||
if (suppress)
|
||||
{
|
||||
mask = NSMiniaturizableWindowMask;
|
||||
}
|
||||
#endif
|
||||
|
||||
_app_icon_window = [[NSIconWindow alloc] initWithContentRect: iconRect
|
||||
styleMask: NSIconWindowMask
|
||||
styleMask: mask
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO
|
||||
screen: nil];
|
||||
|
@ -3623,8 +3663,7 @@ struct _DelegateWrapper
|
|||
[_app_icon_window setContentView: iv];
|
||||
RELEASE(iv);
|
||||
|
||||
if (NO == [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"GSSuppressAppIcon"])
|
||||
if (NO == suppress)
|
||||
{
|
||||
/* The icon window is not suppressed ... display it.
|
||||
*/
|
||||
|
|
|
@ -2673,8 +2673,18 @@ resetCursorRectsForView(NSView *theView)
|
|||
*/
|
||||
- (void) _didDeminiaturize: sender
|
||||
{
|
||||
_f.is_miniaturized = NO;
|
||||
[nc postNotificationName: NSWindowDidDeminiaturizeNotification object: self];
|
||||
if (_f.is_miniaturized == YES)
|
||||
{
|
||||
_f.is_miniaturized = NO;
|
||||
_f.visible = YES;
|
||||
if (self == [NSApp iconWindow])
|
||||
{
|
||||
[NSApp unhide: self];
|
||||
[self orderOut: self];
|
||||
}
|
||||
[nc postNotificationName: NSWindowDidDeminiaturizeNotification
|
||||
object: self];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2728,11 +2738,27 @@ resetCursorRectsForView(NSView *theView)
|
|||
GSDisplayServer *srv = GSServerForWindow(self);
|
||||
NSSize iconSize = [GSCurrentServer() iconSize];
|
||||
|
||||
if (_f.is_miniaturized
|
||||
|| (!(_styleMask & NSMiniaturizableWindowMask))
|
||||
|| (_styleMask & (NSIconWindowMask | NSMiniWindowMask))
|
||||
|| (![self isVisible]))
|
||||
return;
|
||||
if (_f.is_miniaturized || (_styleMask & NSMiniWindowMask))
|
||||
{
|
||||
/* Can't miniaturize a miniwindow or a miniaturized window.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
if (self == [NSApp iconWindow])
|
||||
{
|
||||
if (NO == [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"GSSuppressAppIcon"])
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ((!(_styleMask & (NSIconWindowMask | NSMiniaturizableWindowMask)))
|
||||
|| (_styleMask & NSMiniWindowMask)
|
||||
|| (![self isVisible]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[nc postNotificationName: NSWindowWillMiniaturizeNotification
|
||||
object: self];
|
||||
|
@ -3835,37 +3861,41 @@ resetCursorRectsForView(NSView *theView)
|
|||
[self performClose: NSApp];
|
||||
break;
|
||||
|
||||
case GSAppKitWindowDeminiaturize:
|
||||
[self _didDeminiaturize: NSApp];
|
||||
break;
|
||||
|
||||
case GSAppKitWindowMiniaturize:
|
||||
[self performMiniaturize: NSApp];
|
||||
break;
|
||||
|
||||
case GSAppKitWindowFocusIn:
|
||||
if (_f.is_miniaturized)
|
||||
{
|
||||
/* Window Manager just deminiaturized us */
|
||||
[self deminiaturize: self];
|
||||
}
|
||||
{
|
||||
/* Window Manager just deminiaturized us */
|
||||
[self deminiaturize: self];
|
||||
}
|
||||
if ([NSApp modalWindow]
|
||||
&& self != [NSApp modalWindow])
|
||||
{
|
||||
/* Ignore this request. We're in a modal loop and the
|
||||
user pressed on the title bar of another window. */
|
||||
break;
|
||||
}
|
||||
&& self != [NSApp modalWindow])
|
||||
{
|
||||
/* Ignore this request. We're in a modal loop and the
|
||||
user pressed on the title bar of another window. */
|
||||
break;
|
||||
}
|
||||
if ([self canBecomeKeyWindow] == YES)
|
||||
{
|
||||
NSDebugLLog(@"Focus", @"Making %d key", _windowNum);
|
||||
[self makeKeyWindow];
|
||||
[self makeMainWindow];
|
||||
[NSApp activateIgnoringOtherApps: YES];
|
||||
}
|
||||
{
|
||||
NSDebugLLog(@"Focus", @"Making %d key", _windowNum);
|
||||
[self makeKeyWindow];
|
||||
[self makeMainWindow];
|
||||
[NSApp activateIgnoringOtherApps: YES];
|
||||
}
|
||||
if (self == [[NSApp mainMenu] window])
|
||||
{
|
||||
/* We should really find another window that can become
|
||||
key (if possible)
|
||||
*/
|
||||
[self _lossOfKeyOrMainWindow];
|
||||
}
|
||||
{
|
||||
/* We should really find another window that can become
|
||||
key (if possible)
|
||||
*/
|
||||
[self _lossOfKeyOrMainWindow];
|
||||
}
|
||||
break;
|
||||
|
||||
case GSAppKitWindowFocusOut:
|
||||
|
|
Loading…
Reference in a new issue