mtl: support macOS 13 (guard CADisplayLink behind @available)
-[NSScreen displayLinkWithTarget:selector:] and CADisplayLink are macOS 14+ APIs. Guard startAnimating/stopAnimating behind @available so the backend builds and runs with a 13.0 deployment target; continuous animation is driven by the Lisp 30fps timer anyway. Bump version to 0.1.2.
This commit is contained in:
parent
6356c92f02
commit
9d72210b59
2 changed files with 19 additions and 8 deletions
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2026 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Andros Fenollosa
|
||||
;; Version: 0.1.1
|
||||
;; Version: 0.1.2
|
||||
;; Package-Requires: ((emacs "30.1"))
|
||||
;; Keywords: hardware, display, macos, metal, gpu
|
||||
;; URL: https://github.com/tanrax/emacs-gpu
|
||||
|
|
|
|||
|
|
@ -898,17 +898,28 @@ mtl_log_seq_p (void)
|
|||
|
||||
- (void)startAnimating
|
||||
{
|
||||
if (self.displayLink) return;
|
||||
self.displayLink = [NSScreen.mainScreen
|
||||
displayLinkWithTarget:self selector:@selector(animationTick:)];
|
||||
[self.displayLink addToRunLoop:[NSRunLoop mainRunLoop]
|
||||
forMode:NSRunLoopCommonModes];
|
||||
/* -[NSScreen displayLinkWithTarget:selector:] is macOS 14+. On older
|
||||
systems this is a no-op: the continuous animation is driven by the
|
||||
Lisp 30fps timer (gpu-anim-tick / gpu-video-tick) anyway, which is
|
||||
also what keeps things moving when the event loop starves the display
|
||||
link while idle. See the tickWithDt: comment. */
|
||||
if (@available (macOS 14.0, *))
|
||||
{
|
||||
if (self.displayLink) return;
|
||||
self.displayLink = [NSScreen.mainScreen
|
||||
displayLinkWithTarget:self selector:@selector(animationTick:)];
|
||||
[self.displayLink addToRunLoop:[NSRunLoop mainRunLoop]
|
||||
forMode:NSRunLoopCommonModes];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)stopAnimating
|
||||
{
|
||||
[self.displayLink invalidate];
|
||||
self.displayLink = nil;
|
||||
if (@available (macOS 14.0, *))
|
||||
{
|
||||
[self.displayLink invalidate];
|
||||
self.displayLink = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setCursorX:(int)x y:(int)y width:(int)w height:(int)h
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue