src/video/x11/imKStoUCS.h
author Ryan C. Gordon <icculus@icculus.org>
Fri, 10 Apr 2020 00:37:35 -0400
changeset 13724 aca267270368
parent 10063 c5e3a4f88be9
permissions -rw-r--r--
metal: Added some support interfaces to Apple's Metal API (thanks, Caleb!).

Caleb Cornett's comments:

"A few weeks ago, Alex added a partial Metal API to SDL2:

https://hg.libsdl.org/SDL/rev/b87ba0fad17e

I noticed it was missing a few features that would help Metal become a
first-class citizen in SDL, so I went ahead and wrote them! Here are the new
APIs:

1. SDL_WINDOW_METAL flag for SDL_CreateWindow(). This allows the programmer
to specify that they intend to create a window for use with SDL_MetalView.
The flag is used to ensure correct usage of the API and to prevent
accidentally defaulting to OpenGL on iOS.

2. SDL_Metal_GetLayer(). This function takes a SDL_MetalView and returns a
pointer to the view's backing CAMetalLayer. This simplifies things
considerably, since in the current version of the SDL_Metal API the
programmer is required to bridge-cast a SDL_MetalView handle to an NSView or
UIView (depending on the platform) and then extract the layer from there.
SDL_Metal_GetLayer automatically handles all of that, making the operation
simple and cross-platform.

3. SDL_Metal_GetDrawableSize(). This function already exists in the current
SDL_Metal API (and is used behind-the-scenes for SDL_Vulkan_GetDrawableSize
on Apple platforms) but was not publicly exposed. My patch exposes this
function for public use. It works just like you'd expect.

Tested on macOS 10.14 and iOS 12.4."

Fixes Bugzilla #4796.
     1 #ifndef _imKStoUCS_h
     2 #define _imKStoUCS_h
     3 
     4 /*
     5 Copyright (C) 2003-2006,2008 Jamey Sharp, Josh Triplett
     6 Copyright © 2009 Red Hat, Inc.
     7 Copyright 1990-1992,1999,2000,2004,2009,2010 Oracle and/or its affiliates.
     8 All rights reserved.
     9 
    10 Permission is hereby granted, free of charge, to any person obtaining a
    11 copy of this software and associated documentation files (the "Software"),
    12 to deal in the Software without restriction, including without limitation
    13 the rights to use, copy, modify, merge, publish, distribute, sublicense,
    14 and/or sell copies of the Software, and to permit persons to whom the
    15 Software is furnished to do so, subject to the following conditions:
    16 
    17 The above copyright notice and this permission notice (including the next
    18 paragraph) shall be included in all copies or substantial portions of the
    19 Software.
    20 
    21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    22 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    23 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
    24 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    25 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    26 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    27 DEALINGS IN THE SOFTWARE.
    28 */
    29 
    30 extern unsigned int X11_KeySymToUcs4(KeySym keysym);
    31 
    32 #endif /* _imKStoUCS_h */