Revision: 6613
http://skim-app.svn.sourceforge.net/skim-app/?rev=6613&view=rev
Author: hofman
Date: 2010-07-13 00:14:11 +0000 (Tue, 13 Jul 2010)
Log Message:
-----------
invert inheritance of full screen window classes
Modified Paths:
--------------
trunk/SKFullScreenWindow.h
trunk/SKFullScreenWindow.m
trunk/SKMainWindowController.m
Modified: trunk/SKFullScreenWindow.h
===================================================================
--- trunk/SKFullScreenWindow.h 2010-07-13 00:02:39 UTC (rev 6612)
+++ trunk/SKFullScreenWindow.h 2010-07-13 00:14:11 UTC (rev 6613)
@@ -40,19 +40,21 @@
#import "SKMainWindow.h"
-...@interface SKFullScreenWindow : SKMainWindow <NSAnimationDelegate> {
+...@interface SKBlackingFullScreenWindow : SKMainWindow <NSAnimationDelegate> {
NSViewAnimation *animation;
}
- (id)initWithScreen:(NSScreen *)screen;
-...@property (nonatomic, retain) NSView *mainView;
-
- (void)fadeOutBlocking;
- (void)fadeOut;
@end
+#pragma mark -
-...@interface SKBlackingFullScreenWindow : SKFullScreenWindow
+...@interface SKFullScreenWindow : SKBlackingFullScreenWindow
+
+...@property (nonatomic, retain) NSView *mainView;
+
@end
Modified: trunk/SKFullScreenWindow.m
===================================================================
--- trunk/SKFullScreenWindow.m 2010-07-13 00:02:39 UTC (rev 6612)
+++ trunk/SKFullScreenWindow.m 2010-07-13 00:14:11 UTC (rev 6613)
@@ -43,17 +43,12 @@
#import "SKStringConstants.h"
-...@implementation SKFullScreenWindow
+...@implementation SKBlackingFullScreenWindow
-...@dynamic mainView;
-
- (id)initWithScreen:(NSScreen *)screen {
if (screen == nil)
screen = [NSScreen mainScreen];
if (self = [self initWithContentRect:[screen frame]
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO
screen:screen]) {
- [self setReleasedWhenClosed:NO];
- [self setDisplaysWhenScreenProfileChanges:YES];
- [self setAcceptsMouseMovedEvents:YES];
[self setBackgroundColor:[NSColor blackColor]];
[self
setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
}
@@ -70,46 +65,10 @@
[super dealloc];
}
-- (BOOL)canBecomeKeyWindow { return YES; }
+- (BOOL)canBecomeKeyWindow { return NO; }
-- (BOOL)canBecomeMainWindow { return YES; }
+- (BOOL)canBecomeMainWindow { return NO; }
-- (void)keyDown:(NSEvent *)theEvent {
- unichar ch = [theEvent firstCharacter];
- NSUInteger modifierFlags = [theEvent deviceIndependentModifierFlags];
-
- if (modifierFlags == 0) {
- SKMainWindowController *wc = (SKMainWindowController *)[self
windowController];
- if (ch == SKEscapeCharacter) {
- [wc exitFullScreen:self];
- } else {
- [super keyDown:theEvent];
- }
- } else {
- [super keyDown:theEvent];
- }
-}
-
-- (NSView *)mainView {
- return [[[self contentView] subviews] lastObject];
-}
-
-- (void)setMainView:(NSView *)view {
- [view setFrame:[[self contentView] bounds]];
- [[self contentView] addSubview:view];
-}
-
-- (void)sendEvent:(NSEvent *)theEvent {
- if ([theEvent type] == NSLeftMouseDown || [theEvent type] ==
NSRightMouseDown) {
- SKMainWindowController *wc = (SKMainWindowController *)[self
windowController];
- if ([wc isPresentation] && ([theEvent type] == NSRightMouseDown ||
([theEvent modifierFlags] & NSControlKeyMask))) {
- [wc doGoToPreviousPage:self];
- return;
- }
- }
- [super sendEvent:theEvent];
-}
-
- (void)orderFront:(id)sender {
[self stopAnimation];
[self setAlphaValue:1.0];
@@ -167,11 +126,59 @@
@end
+#pragma mark -
-...@implementation SKBlackingFullScreenWindow
+...@implementation SKFullScreenWindow
-- (BOOL)canBecomeKeyWindow { return NO; }
+...@dynamic mainView;
-- (BOOL)canBecomeMainWindow { return NO; }
+- (id)initWithScreen:(NSScreen *)screen {
+ if (self = [super initWithScreen:screen]) {
+ [self setReleasedWhenClosed:NO];
+ [self setDisplaysWhenScreenProfileChanges:YES];
+ [self setAcceptsMouseMovedEvents:YES];
+ }
+ return self;
+}
+- (BOOL)canBecomeKeyWindow { return YES; }
+
+- (BOOL)canBecomeMainWindow { return YES; }
+
+- (void)sendEvent:(NSEvent *)theEvent {
+ if ([theEvent type] == NSLeftMouseDown || [theEvent type] ==
NSRightMouseDown) {
+ SKMainWindowController *wc = (SKMainWindowController *)[self
windowController];
+ if ([wc isPresentation] && ([theEvent type] == NSRightMouseDown ||
([theEvent modifierFlags] & NSControlKeyMask))) {
+ [wc doGoToPreviousPage:self];
+ return;
+ }
+ }
+ [super sendEvent:theEvent];
+}
+
+- (void)keyDown:(NSEvent *)theEvent {
+ unichar ch = [theEvent firstCharacter];
+ NSUInteger modifierFlags = [theEvent deviceIndependentModifierFlags];
+
+ if (modifierFlags == 0) {
+ SKMainWindowController *wc = (SKMainWindowController *)[self
windowController];
+ if (ch == SKEscapeCharacter) {
+ [wc exitFullScreen:self];
+ } else {
+ [super keyDown:theEvent];
+ }
+ } else {
+ [super keyDown:theEvent];
+ }
+}
+
+- (NSView *)mainView {
+ return [[[self contentView] subviews] lastObject];
+}
+
+- (void)setMainView:(NSView *)view {
+ [view setFrame:[[self contentView] bounds]];
+ [[self contentView] addSubview:view];
+}
+
@end
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2010-07-13 00:02:39 UTC (rev 6612)
+++ trunk/SKMainWindowController.m 2010-07-13 00:14:11 UTC (rev 6613)
@@ -1348,7 +1348,7 @@
[blankingWindows removeAllObjects];
for (NSScreen *screenToBlank in [NSScreen screens]) {
if ([screenToBlank isEqual:screen] == NO) {
- SKFullScreenWindow *window = [[SKBlackingFullScreenWindow
alloc] initWithScreen:screenToBlank];
+ SKBlackingFullScreenWindow *window =
[[SKBlackingFullScreenWindow alloc] initWithScreen:screenToBlank];
[window setBackgroundColor:backgroundColor];
[window setLevel:NSFloatingWindowLevel];
[window setFrame:[screenToBlank frame] display:YES];
@@ -1497,7 +1497,7 @@
if ([[fullScreenWindow firstResponder] isDescendantOf:pdfView])
[fullScreenWindow makeFirstResponder:nil];
- SKFullScreenWindow *bgWindow = [[[SKBlackingFullScreenWindow alloc]
initWithScreen:[fullScreenWindow screen]] autorelease];
+ SKBlackingFullScreenWindow *bgWindow = [[[SKBlackingFullScreenWindow
alloc] initWithScreen:[fullScreenWindow screen]] autorelease];
[bgWindow setBackgroundColor:[fullScreenWindow backgroundColor]];
[bgWindow setLevel:[fullScreenWindow level]];
[bgWindow orderWindow:NSWindowBelow relativeTo:[fullScreenWindow
windowNumber]];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit