Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fullscreen how to block hot corners

How to block hot corners when game is in fullscreen? When hot corners are enable in system, and game is in fullscreen, when i move cursor to any corner game is minimalize.

I change to fullscreen like this:

fullscreenWindow = [[NSWindowFullscreen alloc] initWithContentRect:frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer: NO];
mainWindow = [self window];
[mainWindow setAcceptsMouseMovedEvents:NO];
[mainWindow orderOut:nil];

// Set the options for our new fullscreen window     
[fullscreenWindow setReleasedWhenClosed: YES];
[fullscreenWindow setLevel: NSFloatingWindowLevel];
[fullscreenWindow setHidesOnDeactivate:YES];            
[fullscreenWindow setContentView: self];
[fullscreenWindow makeKeyAndOrderFront:self];    
[fullscreenWindow makeFirstResponder:self];         
[fullscreenWindow setAcceptsMouseMovedEvents:YES];
like image 666
Chudziutki Avatar asked Dec 14 '25 06:12

Chudziutki


1 Answers

The mouse position you can change when mouse position on top.

- (void)mouseMoved:(NSEvent *)theEvent
    {
        NSPoint mouseLoc;
        mouseLoc = [NSEvent mouseLocation]; //get current mouse position
        //mouse position change
        CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
        int Height = (int)ScrnRect.size.height;
       // NSLog(@"Height::%d,MouSe.Y::%f",Height,mouseLoc.y);
        if(Height < mouseLoc.y+5 ){
            CGEventRef mouse = CGEventCreateMouseEvent (NULL, kCGEventMouseMoved, CGPointMake( mouseLoc.x, 5), 0);
            CGEventPost(kCGHIDEventTap, mouse);
            CFRelease(mouse);
            CFRelease(source);
        }
    }
like image 125
Sunny Avatar answered Dec 16 '25 00:12

Sunny



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!