Mouse hiding is now only enabled during full screen mode

This commit is contained in:
Lior Halphon 2016-08-21 00:38:26 +03:00
parent 9479fce7d0
commit 33da8734fe
1 changed files with 4 additions and 2 deletions

View File

@ -113,7 +113,7 @@ static uint32_t rgbEncode(GB_gameboy_t *gb, uint8_t r, uint8_t g, uint8_t b)
- (void) vblank - (void) vblank
{ {
self.view.mouseHidingEnabled = YES; self.view.mouseHidingEnabled = (self.mainWindow.styleMask & NSFullScreenWindowMask) != 0;
[self.view flip]; [self.view flip];
GB_set_pixels_output(&gb, self.view.pixels); GB_set_pixels_output(&gb, self.view.pixels);
} }
@ -127,7 +127,7 @@ static uint32_t rgbEncode(GB_gameboy_t *gb, uint8_t r, uint8_t g, uint8_t b)
self.audioClient = [[GBAudioClient alloc] initWithRendererBlock:^(UInt32 sampleRate, UInt32 nFrames, GB_sample_t *buffer) { self.audioClient = [[GBAudioClient alloc] initWithRendererBlock:^(UInt32 sampleRate, UInt32 nFrames, GB_sample_t *buffer) {
GB_apu_copy_buffer(&gb, buffer, nFrames); GB_apu_copy_buffer(&gb, buffer, nFrames);
} andSampleRate:96000]; } andSampleRate:96000];
self.view.mouseHidingEnabled = YES; self.view.mouseHidingEnabled = (self.mainWindow.styleMask & NSFullScreenWindowMask) != 0;
[self.audioClient start]; [self.audioClient start];
NSTimer *hex_timer = [NSTimer timerWithTimeInterval:0.25 target:self selector:@selector(reloadMemoryView) userInfo:nil repeats:YES]; NSTimer *hex_timer = [NSTimer timerWithTimeInterval:0.25 target:self selector:@selector(reloadMemoryView) userInfo:nil repeats:YES];
[[NSRunLoop mainRunLoop] addTimer:hex_timer forMode:NSDefaultRunLoopMode]; [[NSRunLoop mainRunLoop] addTimer:hex_timer forMode:NSDefaultRunLoopMode];
@ -347,11 +347,13 @@ static uint32_t rgbEncode(GB_gameboy_t *gb, uint8_t r, uint8_t g, uint8_t b)
- (void) windowWillEnterFullScreen:(NSNotification *)notification - (void) windowWillEnterFullScreen:(NSNotification *)notification
{ {
fullScreen = true; fullScreen = true;
self.view.mouseHidingEnabled = running;
} }
- (void) windowWillExitFullScreen:(NSNotification *)notification - (void) windowWillExitFullScreen:(NSNotification *)notification
{ {
fullScreen = false; fullScreen = false;
self.view.mouseHidingEnabled = NO;
} }
- (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)newFrame - (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)newFrame