Ignore:
Timestamp:
05/25/09 03:21:44 (15 years ago)
Author:
Nicholas Riley
Message:

Spaces fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source/PSApplication.m

    r364 r522  
    1818#import "PSTimer.h"
    1919#import "NJRHotKey.h"
     20#import "NSWindowCollectionBehavior.h"
    2021
    2122#import <Carbon/Carbon.h>
     
    4950- (IBAction)orderFrontSetAlarmPanel:(id)sender;
    5051{
     52    NSWindow *window = [alarmSetController window];
     53    if ([window respondsToSelector: @selector(setCollectionBehavior:)]) { // 10.5-only
     54        // XXX bug workaround - NSWindowCollectionBehaviorMoveToActiveSpace is what we want, but it doesn't work correctly, probably because we have a "chicken and egg" problem as the panel isn't visible when the app is hidden
     55        [window setCollectionBehavior: NSWindowCollectionBehaviorCanJoinAllSpaces];
     56        [alarmSetController showWindow: self];
     57        [window performSelector: @selector(setCollectionBehavior:) withObject:
     58         (id)NSWindowCollectionBehaviorDefault afterDelay: 0];
     59        [NSApp activateIgnoringOtherApps: YES]; // XXX causes title bar to flash
     60        return;
     61    }
    5162    [NSApp activateIgnoringOtherApps: YES];
    5263    [alarmSetController showWindow: self];
     
    6879    }
    6980    [preferencesController showWindow: self];
     81}
     82
     83#pragma mark Spaces interaction
     84
     85- (void)orderOutSetAlarmPanelIfHidden;
     86{
     87    // prevent set alarm panel from "yanking" focus from an alarm notification, thereby obscuring the notification
     88    if ([NSApp isActive])
     89        return;
     90   
     91    NSWindow *window = [alarmSetController window];
     92    if (![window isVisible])
     93        return;
     94
     95    [window orderOut: self];
    7096}
    7197
Note: See TracChangeset for help on using the changeset viewer.