Commits

evands  committed 2dfcd14

Fixed issue reported by dzurn on the forums at http://forums.cocoaforge.com/viewtopic.php?sid=a4bebe12af7bf3ba65c06a35c85f26f6&p=97194#97194 : We now default to the menu bar's screen if the desired screen is not available when we attempt to display a notification.

  • Participants
  • Parent commits 351b18c
  • Branches default

Comments (0)

Files changed (8)

File Plugins/Displays/Animation & Transitions/Window Transitions/AWRippler.m

     return _windowNum;
 }
 - (void)scaleX:(double)x Y:(double)y {
-        CGAffineTransform original;
-        NSPoint scalePoint;
-        NSRect screenFrame;
-		//NSLog(@"%@", NSStringFromRect(_frame));
-        NSPoint point = NSMakePoint(_frame.size.width / 2.0, _frame.size.height / 2.0);
+	CGAffineTransform original;
+	NSPoint scalePoint;
+	NSRect screenFrame;
+	//NSLog(@"%@", NSStringFromRect(_frame));
+	NSPoint point = NSMakePoint(_frame.size.width / 2.0, _frame.size.height / 2.0);
         
+	if ([[NSScreen screens] count]) {
         screenFrame = [[[NSScreen screens] objectAtIndex:0] frame];
         
         scalePoint.x = _frame.origin.x + point.x;
         original = CGAffineTransformTranslate(original, -scalePoint.x, -scalePoint.y);
         
         CGSSetWindowTransform(_CGSDefaultConnection(), _windowNum, original);
+	}
 }
 
 @end

File Plugins/Displays/Bezel/GrowlBezelWindowController.m

 							  MIN_DISPLAY_TIME)];
 
 	READ_GROWL_PREF_INT(BEZEL_SCREEN_PREF, GrowlBezelPrefDomain, &screenNumber);
-	[self setScreen:[[NSScreen screens] objectAtIndex:screenNumber]];
+	NSArray *screens = [NSScreen screens];
+	int screensCount = [screens count];
+	if (screensCount) {
+		[self setScreen:((screensCount >= (screenNumber + 1)) ? [screens objectAtIndex:screenNumber] : [screens objectAtIndex:0])];
+	}
 
 	READ_GROWL_PREF_INT(BEZEL_SIZE_PREF, GrowlBezelPrefDomain, &sizePref);
 	READ_GROWL_PREF_BOOL(BEZEL_SHRINK_PREF, GrowlBezelPrefDomain, &shrinkEnabled);

File Plugins/Displays/Brushed/GrowlBrushedWindowController.m

 	// Read prefs...
 	screenNumber = 0U;
 	READ_GROWL_PREF_INT(GrowlBrushedScreenPref, GrowlBrushedPrefDomain, &screenNumber);
-	[self setScreen:[[NSScreen screens] objectAtIndex:screenNumber]];
+	NSArray *screens = [NSScreen screens];
+	int screensCount = [screens count];
+	if (screensCount) {
+		[self setScreen:((screensCount >= (screenNumber + 1)) ? [screens objectAtIndex:screenNumber] : [screens objectAtIndex:0])];
+	}
 	unsigned styleMask = NSBorderlessWindowMask | NSNonactivatingPanelMask;
 
 	BOOL aquaPref = GrowlBrushedAquaPrefDefault;

File Plugins/Displays/Bubbles/GrowlBubblesWindowController.m

 - (id) init {
 	screenNumber = 0U;
 	READ_GROWL_PREF_INT(GrowlBubblesScreen, GrowlBubblesPrefDomain, &screenNumber);
-	[self setScreen:[[NSScreen screens] objectAtIndex:screenNumber]];
+	NSArray *screens = [NSScreen screens];
+	int screensCount = [screens count];
+	if (screensCount) {
+		[self setScreen:((screensCount >= (screenNumber + 1)) ? [screens objectAtIndex:screenNumber] : [screens objectAtIndex:0])];
+	}
 
 	CFNumberRef prefsDuration = NULL;
 	READ_GROWL_PREF_VALUE(GrowlBubblesDuration, GrowlBubblesPrefDomain, CFNumberRef, &prefsDuration);

File Plugins/Displays/MusicVideo/GrowlMusicVideoWindowController.m

 
 	screenNumber = 0U;
 	READ_GROWL_PREF_INT(MUSICVIDEO_SCREEN_PREF, GrowlMusicVideoPrefDomain, &screenNumber);
-	[self setScreen:[[NSScreen screens] objectAtIndex:screenNumber]];
+	NSArray *screens = [NSScreen screens];
+	int screensCount = [screens count];
+	if (screensCount) {
+		[self setScreen:((screensCount >= (screenNumber + 1)) ? [screens objectAtIndex:screenNumber] : [screens objectAtIndex:0])];
+	}
 	
 	NSRect sizeRect;
 	NSRect screen = [[self screen] frame];

File Plugins/Displays/Nano/GrowlNanoWindowController.m

 
 	screenNumber = 0U;
 	READ_GROWL_PREF_INT(Nano_SCREEN_PREF, GrowlNanoPrefDomain, &screenNumber);
-	[self setScreen:[[NSScreen screens] objectAtIndex:screenNumber]];
-
+	NSArray *screens = [NSScreen screens];
+	unsigned int screensCount = [screens count];
+	if (screensCount) {
+		[self setScreen:((screensCount >= (screenNumber + 1)) ? [screens objectAtIndex:screenNumber] : [screens objectAtIndex:0])];
+	}
+				 
 	NSRect sizeRect;
 	NSRect screen = [[self screen] frame];
 	READ_GROWL_PREF_INT(Nano_SIZE_PREF, GrowlNanoPrefDomain, &sizePref);

File Plugins/Displays/Smoke/GrowlSmokeWindowController.m

 - (id) init {
 	screenNumber = 0U;
 	READ_GROWL_PREF_INT(GrowlSmokeScreenPref, GrowlSmokePrefDomain, &screenNumber);
-	[self setScreen:[[NSScreen screens] objectAtIndex:screenNumber]];
+	NSArray *screens = [NSScreen screens];
+	int screensCount = [screens count];
+	if (screensCount) {
+		[self setScreen:((screensCount >= (screenNumber + 1)) ? [screens objectAtIndex:screenNumber] : [screens objectAtIndex:0])];
+	}
 
 	CFNumberRef prefsDuration = NULL;
 	READ_GROWL_PREF_VALUE(GrowlSmokeDurationPref, GrowlSmokePrefDomain, CFNumberRef, &prefsDuration);

File Plugins/Displays/iCal/GrowliCalWindowController.m

 - (id) init {
 	screenNumber = 0U;
 	READ_GROWL_PREF_INT(GrowliCalScreen, GrowliCalPrefDomain, &screenNumber);
-	[self setScreen:[[NSScreen screens] objectAtIndex:screenNumber]];
+	NSArray *screens = [NSScreen screens];
+	int screensCount = [screens count];
+	if (screensCount) {
+		[self setScreen:((screensCount >= (screenNumber + 1)) ? [screens objectAtIndex:screenNumber] : [screens objectAtIndex:0])];
+	}
 
 	CFNumberRef prefsDuration = NULL;
 	READ_GROWL_PREF_VALUE(GrowliCalDuration, GrowliCalPrefDomain, CFNumberRef, &prefsDuration);