Revision: 7286
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7286&view=rev
Author:   hofman
Date:     2011-06-18 17:29:23 +0000 (Sat, 18 Jun 2011)

Log Message:
-----------
only bother changing gradient view when moving to an actual window

Modified Paths:
--------------
    trunk/SKGradientView.m

Modified: trunk/SKGradientView.m
===================================================================
--- trunk/SKGradientView.m      2011-06-18 17:00:22 UTC (rev 7285)
+++ trunk/SKGradientView.m      2011-06-18 17:29:23 UTC (rev 7286)
@@ -153,7 +153,7 @@
 
 - (void)viewWillMoveToWindow:(NSWindow *)newWindow {
     NSWindow *window = [self window];
-    if ([window styleMask] != NSBorderlessWindowMask) {
+    if (window && [window styleMask] != NSBorderlessWindowMask) {
         NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
         [nc removeObserver:self name:NSWindowDidBecomeMainNotification 
object:window];
         [nc removeObserver:self name:NSWindowDidResignMainNotification 
object:window];
@@ -164,16 +164,18 @@
 
 - (void)viewDidMoveToWindow {
     NSWindow *window = [self window];
-    BOOL hasBorder = [window styleMask] != NSBorderlessWindowMask;
-    if (hasBorder) {
-        NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
-        [nc addObserver:self 
selector:@selector(handleKeyOrMainStateChangedNotification:) 
name:NSWindowDidBecomeMainNotification object:window];
-        [nc addObserver:self 
selector:@selector(handleKeyOrMainStateChangedNotification:) 
name:NSWindowDidResignMainNotification object:window];
-        [nc addObserver:self 
selector:@selector(handleKeyOrMainStateChangedNotification:) 
name:NSWindowDidBecomeKeyNotification object:window];
-        [nc addObserver:self 
selector:@selector(handleKeyOrMainStateChangedNotification:) 
name:NSWindowDidResignKeyNotification object:window];
+    if (window) {
+        BOOL hasBorder = [window styleMask] != NSBorderlessWindowMask;
+        if (hasBorder) {
+            NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
+            [nc addObserver:self 
selector:@selector(handleKeyOrMainStateChangedNotification:) 
name:NSWindowDidBecomeMainNotification object:window];
+            [nc addObserver:self 
selector:@selector(handleKeyOrMainStateChangedNotification:) 
name:NSWindowDidResignMainNotification object:window];
+            [nc addObserver:self 
selector:@selector(handleKeyOrMainStateChangedNotification:) 
name:NSWindowDidBecomeKeyNotification object:window];
+            [nc addObserver:self 
selector:@selector(handleKeyOrMainStateChangedNotification:) 
name:NSWindowDidResignKeyNotification object:window];
+        }
+        if (autoTransparent)
+            [self setEdges:hasBorder ? SKMinXEdgeMask | SKMaxXEdgeMask : 
SKNoEdgeMask];
     }
-    if (autoTransparent)
-        [self setEdges:hasBorder ? SKMinXEdgeMask | SKMaxXEdgeMask : 
SKNoEdgeMask];
 }
 
 // required in order for redisplay to work properly with the controls


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to