i have 2 screen modes. window mode and full screen mode.
if i add code to the window mode to hide the cursor until moved, and hide it again if moved and is inactive for 1 second, it works great.
but if i than take that same exact code out of my window mode class and place it on my full screen mode class, it doesn't work! well, it doesn't work as expected anyway, because in order to make the cursor disappear after 1 second while in full screen mode, i have to actually click the screen and make it a key window (i'm assuming) but i don't have to do this if the code is inserted in the window mode class... i'm totally TOTALLY stumped...
so this works for hiding cursor on window mode. it also works if switched to fullscreen mode and than back to window mode:
but if i switch these window subclasses around, and set the fullScreen window to accept mouse events and add the code to the fullscreen class (while removing the code from the window mode class), it doesn't work properly. it also doesn't work properly if switched to window mode and than back to fullscreen mode:
an anomaly, i sware to god...
if i add code to the window mode to hide the cursor until moved, and hide it again if moved and is inactive for 1 second, it works great.
but if i than take that same exact code out of my window mode class and place it on my full screen mode class, it doesn't work! well, it doesn't work as expected anyway, because in order to make the cursor disappear after 1 second while in full screen mode, i have to actually click the screen and make it a key window (i'm assuming) but i don't have to do this if the code is inserted in the window mode class... i'm totally TOTALLY stumped...
so this works for hiding cursor on window mode. it also works if switched to fullscreen mode and than back to window mode:
Code:
#import "windowMode.h"
@implementation windowMode
- (void)awakeFromNib
{
[self setAcceptsMouseMovedEvents:YES];
[self setFrameAutosaveName:@"MAINWINDOWPositionHeightWidth"];
}
- (void)zoom:(id)sender
{
if (zoom)
{
[[self animator] setFrame:originalFrame display:YES];
zoom = NO;
}
else
{
originalFrame = [self frame];
[[self animator] setFrame:[[self screen] visibleFrame] display:YES];
zoom = YES;
}
}
-(void)mouseMoved:(NSEvent *)theEvent
{
if ([self isVisible])
{
NSLog (@"Timer Reset");
[timer invalidate];
NSLog(@"Timer Started");
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(hideMouse:) userInfo:nil repeats:NO];
}
}
-(void)hideMouse:(NSTimer *)theTimer
{
[NSCursor setHiddenUntilMouseMoves:YES];
timer = nil;
}
@end
----------------------------------------------------------------------------------------
#import "fullScreen.h"
@implementation fullScreen
-(id)initWithContentRect: (NSRect) contentRect
styleMask: (unsigned int) aStyle
backing: (NSBackingStoreType) bufferingType
defer: (BOOL) flag
{
if (self = [super initWithContentRect: contentRect
styleMask: NSBorderlessWindowMask
backing: bufferingType
defer: flag])
{
}
return self;
}
@end
but if i switch these window subclasses around, and set the fullScreen window to accept mouse events and add the code to the fullscreen class (while removing the code from the window mode class), it doesn't work properly. it also doesn't work properly if switched to window mode and than back to fullscreen mode:
Code:
#import "windowMode.h"
@implementation windowMode
- (void)awakeFromNib
{
[self setFrameAutosaveName:@"MAINWINDOWPositionHeightWidth"];
}
- (void)zoom:(id)sender
{
if (zoom)
{
[[self animator] setFrame:originalFrame display:YES];
zoom = NO;
}
else
{
originalFrame = [self frame];
[[self animator] setFrame:[[self screen] visibleFrame] display:YES];
zoom = YES;
}
}
@end
----------------------------------------------------------------------------------------
#import "fullScreenMode.h"
@implementation fullScreenMode
- (void)awakeFromNib
{
[self setAcceptsMouseMovedEvents:YES];
}
-(id)initWithContentRect: (NSRect) contentRect
styleMask: (unsigned int) aStyle
backing: (NSBackingStoreType) bufferingType
defer: (BOOL) flag
{
if (self = [super initWithContentRect: contentRect
styleMask: NSBorderlessWindowMask
backing: bufferingType
defer: flag])
{
}
return self;
}
-(void)mouseMoved:(NSEvent *)theEvent
{
if ([self isVisible])
{
NSLog (@"Timer Reset");
[timer invalidate];
NSLog(@"Timer Started");
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(hideMouse:) userInfo:nil repeats:NO];
}
}
-(void)hideMouse:(NSTimer *)theTimer
{
[NSCursor setHiddenUntilMouseMoves:YES];
timer = nil;
}
@end
an anomaly, i sware to god...