]> git.eshelyaron.com Git - emacs.git/commit
Simplify macOS drawing code
authorAlan Third <alan@idiocy.org>
Sat, 29 May 2021 08:48:51 +0000 (09:48 +0100)
committerAlan Third <alan@idiocy.org>
Sat, 31 Jul 2021 10:13:05 +0000 (11:13 +0100)
commita4d2c88cdee90a3e4863a62c4ff69896d0c1a347
treea65b4e33e2be7b4aa41c9f9a928cb2db0a420033
parent0992335d128f6fc2ac1b5abc4f4106e58110a6da
Simplify macOS drawing code

Convert EmacsSurface into a CALayer subclass so we can use the
built-in relationships.  Also simplify the macOS versioning code.
This will result in more warnings on older versions of macOS but makes
reading the code easier.

* configure.ac: Add QuartzCore framework.
* src/nsterm.h (NS_DRAW_TO_BUFFER): Remove define and all references.
(EmacsSurface, EmacsLayer): Rename EmacsSurface to EmacsLayer and
modify the definition to fit the new function.
* src/nsterm.m (ns_update_begin):
(ns_update_end):
(ns_focus):
(ns_unfocus): Use the new overridden lockFocus and unlockFocus and
simplify the frame management.
([EmacsView dealloc]):
([EmacsView viewDidResize:]):Don't explicitly release surfaces.
([EmacsView initFrameFromEmacs:]): Move the layer code to after the
NSWindow has been created as creating the layer now relies on some of
it's properties.
([EmacsView makeBackingLayer]): New function.
([EmacsView lockFocus]):
([EmacsView focusOnDrawingBuffer]): Rename to lockFocus.
([EmacsView unlockFocus]):
([EmacsView unfocusDrawingBuffer]): Rename to unlockFocus.
([EmacsView windowDidChangeBackingProperties]): Don't explicitly
release surfaces but reset EmacsLayer properties.
([EmacsView layout]):
([EmacsView viewWillDraw]): Rename to layout.
([EmacsView wantsUpdateLayer]): Remove function and change all callers
to [EmacsView wantsLayer].
(EmacsSurface, EmacsLayer): Rename to EmacsLayer.
([EmacsSurface getSize]):
([EmacsSurface initWithSize:ColorSpace:Scale:]): Remove methods.
([EmacsSurface initWithColorSpace:]):
([EmacsLayer checkDimensions]):
([EmacsLayer releaseSurfaces]):
([EmacsLayer display]): New functions.
* src/nsterm.m ([EmacsLayer dealloc]): Use releaseSurfaces.
([EmacsSurface getContext]): Automatically detect frame property
changes and clear the cache if required.  Use built-in CALayer
properties where available.
([EmacsLayer copyContentsTo:]): Use [CALayer contents] as source.
configure.ac
src/nsterm.h
src/nsterm.m