Revision: 6637
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6637&view=rev
Author:   hofman
Date:     2010-07-21 12:02:29 +0000 (Wed, 21 Jul 2010)

Log Message:
-----------
separate subclasses for temporary and main fullscreen windows

Modified Paths:
--------------
    trunk/SKFullScreenWindow.h
    trunk/SKFullScreenWindow.m
    trunk/SKMainWindowController.m

Modified: trunk/SKFullScreenWindow.h
===================================================================
--- trunk/SKFullScreenWindow.h  2010-07-21 11:41:47 UTC (rev 6636)
+++ trunk/SKFullScreenWindow.h  2010-07-21 12:02:29 UTC (rev 6637)
@@ -42,13 +42,11 @@
 
 @interface SKFullScreenWindow : SKMainWindow <NSAnimationDelegate> {
     NSViewAnimation *animation;
-    BOOL canBecomeMain;
 }
 
 @property (nonatomic, retain) NSView *mainView;
 
 - (id)initWithScreen:(NSScreen *)screen;
-- (id)initWithScreen:(NSScreen *)screen canBecomeMain:(BOOL)flag;
 
 - (void)fadeOutBlocking;
 - (void)fadeOut;
@@ -56,3 +54,7 @@
 - (void)fadeIn;
 
 @end
+
+
+...@interface SKMainFullScreenWindow : SKFullScreenWindow
+...@end

Modified: trunk/SKFullScreenWindow.m
===================================================================
--- trunk/SKFullScreenWindow.m  2010-07-21 11:41:47 UTC (rev 6636)
+++ trunk/SKFullScreenWindow.m  2010-07-21 12:02:29 UTC (rev 6637)
@@ -48,19 +48,12 @@
 @dynamic mainView;
 
 - (id)initWithScreen:(NSScreen *)screen {
-    return [self initWithScreen:screen canBecomeMain:YES];
-}
-
-- (id)initWithScreen:(NSScreen *)screen canBecomeMain:(BOOL)flag {
     if (screen == nil)
         screen = [NSScreen mainScreen];
     if (self = [self initWithContentRect:[screen frame] 
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO 
screen:screen]) {
-        canBecomeMain = flag;
         [self setBackgroundColor:[NSColor blackColor]];
         [self setReleasedWhenClosed:NO];
-        [self setDisplaysWhenScreenProfileChanges:canBecomeMain];
-        [self setAcceptsMouseMovedEvents:canBecomeMain];
-        [self setExcludedFromWindowsMenu:canBecomeMain == NO];
+        [self setExcludedFromWindowsMenu:YES];
     }
     return self;
 }
@@ -75,32 +68,10 @@
     [super dealloc];
 }
 
-- (BOOL)canBecomeKeyWindow { return canBecomeMain; }
+- (BOOL)canBecomeKeyWindow { return NO; }
 
-- (BOOL)canBecomeMainWindow { return canBecomeMain; }
+- (BOOL)canBecomeMainWindow { return NO; }
 
-- (void)sendEvent:(NSEvent *)theEvent {
-    if (canBecomeMain && ([theEvent type] == NSLeftMouseDown || [theEvent 
type] == NSRightMouseDown)) {
-        SKMainWindowController *wc = (SKMainWindowController *)[self 
windowController];
-        if ([wc interactionMode] == SKPresentationMode && ([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 (canBecomeMain && modifierFlags == 0 && ch == SKEscapeCharacter) {
-        [(SKMainWindowController *)[self windowController] 
exitFullScreen:self];
-        return;
-    }
-    [super keyDown:theEvent];
-}
-
 - (void)orderFront:(id)sender {
     [self stopAnimation];
     [self setAlphaValue:1.0];
@@ -196,3 +167,43 @@
 }
 
 @end
+
+...@implementation SKMainFullScreenWindow
+
+- (id)initWithScreen:(NSScreen *)screen canBecomeMain:(BOOL)flag {
+    if (self = [super initWithScreen:screen]) {
+        [self setDisplaysWhenScreenProfileChanges:YES];
+        [self setAcceptsMouseMovedEvents:YES];
+        [self setExcludedFromWindowsMenu:NO];
+    }
+    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 interactionMode] == SKPresentationMode && ([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 && ch == SKEscapeCharacter) {
+        [(SKMainWindowController *)[self windowController] 
exitFullScreen:self];
+        return;
+    }
+    [super keyDown:theEvent];
+}
+
+...@end
+

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2010-07-21 11:41:47 UTC (rev 6636)
+++ trunk/SKMainWindowController.m      2010-07-21 12:02:29 UTC (rev 6637)
@@ -1301,7 +1301,7 @@
     NSInteger level = [self interactionMode] == SKPresentationMode && 
[[NSUserDefaults standardUserDefaults] 
boolForKey:SKUseNormalLevelForPresentationKey] == NO ? NSPopUpMenuWindowLevel : 
NSNormalWindowLevel;
     
     // create a new full screen window
-    SKFullScreenWindow *fullScreenWindow = [[[SKFullScreenWindow alloc] 
initWithScreen:screen] autorelease];
+    SKMainFullScreenWindow *fullScreenWindow = [[[SKMainFullScreenWindow 
alloc] initWithScreen:screen] autorelease];
     
     if ([[mainWindow firstResponder] isDescendantOf:pdfView])
         [mainWindow makeFirstResponder:nil];
@@ -1321,7 +1321,7 @@
         [blankingWindows removeAllObjects];
         for (NSScreen *screenToBlank in [NSScreen screens]) {
             if ([screenToBlank isEqual:screen] == NO) {
-                SKFullScreenWindow *aWindow = [[SKFullScreenWindow alloc] 
initWithScreen:screenToBlank canBecomeMain:NO];
+                SKFullScreenWindow *aWindow = [[SKFullScreenWindow alloc] 
initWithScreen:screenToBlank];
                 [aWindow setBackgroundColor:backgroundColor];
                 [aWindow setLevel:NSFloatingWindowLevel];
                 [aWindow 
setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
@@ -1478,8 +1478,8 @@
     
     // first fade out the pdfView so we can move the pdfView to the main 
window before it's revealed
     // animating the view itself does no work as PDFView does not work nicely 
with CoreAnimation, so we use a temporary window
-    SKFullScreenWindow *fullScreenWindow = [[[self window] retain] 
autorelease];
-    SKFullScreenWindow *fadeWindow = [[SKFullScreenWindow alloc] 
initWithScreen:[fullScreenWindow screen] canBecomeMain:NO];
+    SKMainFullScreenWindow *fullScreenWindow = [[[self window] retain] 
autorelease];
+    SKFullScreenWindow *fadeWindow = [[SKFullScreenWindow alloc] 
initWithScreen:[fullScreenWindow screen]];
     [fadeWindow setBackgroundColor:[fullScreenWindow backgroundColor]];
     [fadeWindow setLevel:[fullScreenWindow level]];
     [fadeWindow setMainView:[fullScreenWindow mainView]];


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

Reply via email to