Ejemplo n.º 1
0
        protected void OnUpdateFrame(object sender, FrameEventArgs e)
        {
            // update the window mode if we have an update queued
            WindowMode?mode = newWindowMode;

            if (mode.HasValue)
            {
                newWindowMode = null;

                bool currentFullScreen = styleMask.HasFlag(NSWindowStyleMask.FullScreen);
                bool toggleFullScreen  = mode.Value == Configuration.WindowMode.Borderless || mode.Value == Configuration.WindowMode.Fullscreen ? !currentFullScreen : currentFullScreen;

                if (toggleFullScreen)
                {
                    Cocoa.SendVoid(WindowInfo.Handle, selToggleFullScreen, IntPtr.Zero);
                }
                else if (currentFullScreen)
                {
                    NSApplication.PresentationOptions = fullscreen_presentation_options;
                }

                WindowMode.Value = mode.Value;
            }

            // If the cursor should be hidden, but something in the system has made it appear (such as a notification),
            // invalidate the cursor rects to hide it.  OpenTK has a private function that does this.
            if (CursorState.HasFlag(CursorState.Hidden) && Cocoa.CGCursorIsVisible() && !menuBarVisible)
            {
                methodInvalidateCursorRects.Invoke(nativeWindow, new object[0]);
            }
        }
 private void refreshCursorState(object sender, OpenTK.FrameEventArgs e)
 {
     // If the cursor should be hidden, but something in the system has made it appear (such as a notification),
     // invalidate the cursor rects to hide it.  OpenTK has a private function that does this.
     if (CursorState.HasFlag(CursorState.Hidden) && Cocoa.CGCursorIsVisible())
     {
         methodInvalidateCursorRects.Invoke(nativeWindow, new object[0]);
     }
 }