add option to remove titlebar

This commit is contained in:
Kasper de Bruin 2024-01-19 13:58:24 +01:00
parent 8e6c8d7eff
commit f906f7ae3f
8 changed files with 3093 additions and 3192 deletions

File diff suppressed because it is too large Load Diff

View File

@ -169,8 +169,7 @@ extern "C" {
* of the specified monitor, or `NULL` if an [error](@ref error_handling)
* occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -187,8 +186,7 @@ GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -204,8 +202,7 @@ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
* @return The `HWND` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @remark The `HDC` associated with the window can be queried with the
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
@ -231,8 +228,8 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
* @return The `HGLRC` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @remark The `HDC` associated with the window can be queried with the
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
@ -258,8 +255,7 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
* @return The `CGDirectDisplayID` of the specified monitor, or
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -275,8 +271,7 @@ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
* @return The `NSWindow` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -294,8 +289,8 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
* @return The `NSOpenGLContext` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -313,8 +308,7 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
* @return The `Display` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -330,8 +324,7 @@ GLFWAPI Display* glfwGetX11Display(void);
* @return The `RRCrtc` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -347,8 +340,7 @@ GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
* @return The `RROutput` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -364,8 +356,7 @@ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
* @return The `Window` of the specified window, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -380,8 +371,8 @@ GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
*
* @param[in] string A UTF-8 encoded string.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR.
*
* @pointer_lifetime The specified string is copied before this function
* returns.
@ -406,8 +397,8 @@ GLFWAPI void glfwSetX11SelectionString(const char* string);
* @return The contents of the selection as a UTF-8 encoded string, or `NULL`
* if an [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR.
*
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
* should not free it yourself. It is valid until the next call to @ref
@ -433,8 +424,8 @@ GLFWAPI const char* glfwGetX11SelectionString(void);
* @return The `GLXContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -450,8 +441,8 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
* @return The `GLXWindow` of the specified window, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -469,8 +460,7 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
* @return The `struct wl_display*` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -486,8 +476,7 @@ GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
* @return The `struct wl_output*` of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -503,8 +492,7 @@ GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
* @return The main `struct wl_surface*` of the specified window, or `NULL` if
* an [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -541,8 +529,8 @@ GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_NO_WINDOW_CONTEXT.
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -558,8 +546,8 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_NO_WINDOW_CONTEXT.
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -584,8 +572,8 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_NO_WINDOW_CONTEXT.
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -608,8 +596,8 @@ GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_NO_WINDOW_CONTEXT.
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
@ -625,8 +613,8 @@ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height
* @return The `OSMesaContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_NO_WINDOW_CONTEXT.
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.

View File

@ -59,9 +59,7 @@ static void changeToResourcesDirectory(void)
if (!CFURLGetFileSystemRepresentation(resourcesURL,
true,
(UInt8*) resourcesPath,
MAXPATHLEN))
{
(UInt8 *)resourcesPath, MAXPATHLEN)) {
CFRelease(resourcesURL);
return;
}
@ -76,12 +74,10 @@ static void changeToResourcesDirectory(void)
// could go away at any moment, lots of stuff that really should be
// localize(d|able), etc. Add a nib to save us this horror.
//
static void createMenuBar(void)
{
NSString* appName = nil;
NSDictionary* bundleInfo = [[NSBundle mainBundle] infoDictionary];
NSString* nameKeys[] =
{
static void createMenuBar(void) {
NSString *appName = nil;
NSDictionary *bundleInfo = [[NSBundle mainBundle] infoDictionary];
NSString *nameKeys[] = {
@"CFBundleDisplayName",
@"CFBundleName",
@"CFBundleExecutable",
@ -89,43 +85,39 @@ static void createMenuBar(void)
// Try to figure out what the calling application is called
for (size_t i = 0; i < sizeof(nameKeys) / sizeof(nameKeys[0]); i++)
{
for (size_t i = 0; i < sizeof(nameKeys) / sizeof(nameKeys[0]); i++) {
id name = bundleInfo[nameKeys[i]];
if (name &&
[name isKindOfClass:[NSString class]] &&
![name isEqualToString:@""])
{
if (name && [name isKindOfClass:[NSString class]] &&
![name isEqualToString:@""]) {
appName = name;
break;
}
}
if (!appName)
{
char** progname = _NSGetProgname();
if (!appName) {
char **progname = _NSGetProgname();
if (progname && *progname)
appName = @(*progname);
else
appName = @"GLFW Application";
}
NSMenu* bar = [[NSMenu alloc] init];
NSMenu *bar = [[NSMenu alloc] init];
[NSApp setMainMenu:bar];
NSMenuItem* appMenuItem =
[bar addItemWithTitle:@"" action:NULL keyEquivalent:@""];
NSMenu* appMenu = [[NSMenu alloc] init];
NSMenuItem *appMenuItem = [bar addItemWithTitle:@""
action:NULL
keyEquivalent:@""];
NSMenu *appMenu = [[NSMenu alloc] init];
[appMenuItem setSubmenu:appMenu];
[appMenu addItemWithTitle:[NSString stringWithFormat:@"About %@", appName]
action:@selector(orderFrontStandardAboutPanel:)
keyEquivalent:@""];
[appMenu addItem:[NSMenuItem separatorItem]];
NSMenu* servicesMenu = [[NSMenu alloc] init];
NSMenu *servicesMenu = [[NSMenu alloc] init];
[NSApp setServicesMenu:servicesMenu];
[[appMenu addItemWithTitle:@"Services"
action:NULL
[[appMenu addItemWithTitle:@"Services" action:NULL
keyEquivalent:@""] setSubmenu:servicesMenu];
[servicesMenu release];
[appMenu addItem:[NSMenuItem separatorItem]];
@ -135,7 +127,8 @@ static void createMenuBar(void)
[[appMenu addItemWithTitle:@"Hide Others"
action:@selector(hideOtherApplications:)
keyEquivalent:@"h"]
setKeyEquivalentModifierMask:NSEventModifierFlagOption | NSEventModifierFlagCommand];
setKeyEquivalentModifierMask:NSEventModifierFlagOption |
NSEventModifierFlagCommand];
[appMenu addItemWithTitle:@"Show All"
action:@selector(unhideAllApplications:)
keyEquivalent:@""];
@ -144,10 +137,11 @@ static void createMenuBar(void)
action:@selector(terminate:)
keyEquivalent:@"q"];
NSMenuItem* windowMenuItem =
[bar addItemWithTitle:@"" action:NULL keyEquivalent:@""];
NSMenuItem *windowMenuItem = [bar addItemWithTitle:@""
action:NULL
keyEquivalent:@""];
[bar release];
NSMenu* windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
NSMenu *windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
[NSApp setWindowsMenu:windowMenu];
[windowMenuItem setSubmenu:windowMenu];
@ -167,7 +161,8 @@ static void createMenuBar(void)
[[windowMenu addItemWithTitle:@"Enter Full Screen"
action:@selector(toggleFullScreen:)
keyEquivalent:@"f"]
setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand];
setKeyEquivalentModifierMask:NSEventModifierFlagControl |
NSEventModifierFlagCommand];
// Prior to Snow Leopard, we need to use this oddly-named semi-private API
// to get the application menu working properly.
@ -177,8 +172,7 @@ static void createMenuBar(void)
// Create key code translation tables
//
static void createKeyTables(void)
{
static void createKeyTables(void) {
memset(_glfw.ns.keycodes, -1, sizeof(_glfw.ns.keycodes));
memset(_glfw.ns.scancodes, -1, sizeof(_glfw.ns.scancodes));
@ -297,8 +291,7 @@ static void createKeyTables(void)
_glfw.ns.keycodes[0x43] = GLFW_KEY_KP_MULTIPLY;
_glfw.ns.keycodes[0x4E] = GLFW_KEY_KP_SUBTRACT;
for (int scancode = 0; scancode < 256; scancode++)
{
for (int scancode = 0; scancode < 256; scancode++) {
// Store the reverse translation for faster key name lookup
if (_glfw.ns.keycodes[scancode] >= 0)
_glfw.ns.scancodes[_glfw.ns.keycodes[scancode]] = scancode;
@ -307,28 +300,23 @@ static void createKeyTables(void)
// Retrieve Unicode data for the current keyboard layout
//
static GLFWbool updateUnicodeData(void)
{
if (_glfw.ns.inputSource)
{
static GLFWbool updateUnicodeData(void) {
if (_glfw.ns.inputSource) {
CFRelease(_glfw.ns.inputSource);
_glfw.ns.inputSource = NULL;
_glfw.ns.unicodeData = nil;
}
_glfw.ns.inputSource = TISCopyCurrentKeyboardLayoutInputSource();
if (!_glfw.ns.inputSource)
{
if (!_glfw.ns.inputSource) {
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to retrieve keyboard layout input source");
return GLFW_FALSE;
}
_glfw.ns.unicodeData =
TISGetInputSourceProperty(_glfw.ns.inputSource,
kTISPropertyUnicodeKeyLayoutData);
if (!_glfw.ns.unicodeData)
{
_glfw.ns.unicodeData = TISGetInputSourceProperty(
_glfw.ns.inputSource, kTISPropertyUnicodeKeyLayoutData);
if (!_glfw.ns.unicodeData) {
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to retrieve keyboard layout Unicode data");
return GLFW_FALSE;
@ -339,43 +327,36 @@ static GLFWbool updateUnicodeData(void)
// Load HIToolbox.framework and the TIS symbols we need from it
//
static GLFWbool initializeTIS(void)
{
static GLFWbool initializeTIS(void) {
// This works only because Cocoa has already loaded it properly
_glfw.ns.tis.bundle =
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.HIToolbox"));
if (!_glfw.ns.tis.bundle)
{
if (!_glfw.ns.tis.bundle) {
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to load HIToolbox.framework");
return GLFW_FALSE;
}
CFStringRef* kPropertyUnicodeKeyLayoutData =
CFBundleGetDataPointerForName(_glfw.ns.tis.bundle,
CFSTR("kTISPropertyUnicodeKeyLayoutData"));
CFStringRef *kPropertyUnicodeKeyLayoutData = CFBundleGetDataPointerForName(
_glfw.ns.tis.bundle, CFSTR("kTISPropertyUnicodeKeyLayoutData"));
_glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource =
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
CFBundleGetFunctionPointerForName(
_glfw.ns.tis.bundle,
CFSTR("TISCopyCurrentKeyboardLayoutInputSource"));
_glfw.ns.tis.GetInputSourceProperty =
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
CFSTR("TISGetInputSourceProperty"));
_glfw.ns.tis.GetKbdType =
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
CFSTR("LMGetKbdType"));
_glfw.ns.tis.GetInputSourceProperty = CFBundleGetFunctionPointerForName(
_glfw.ns.tis.bundle, CFSTR("TISGetInputSourceProperty"));
_glfw.ns.tis.GetKbdType = CFBundleGetFunctionPointerForName(
_glfw.ns.tis.bundle, CFSTR("LMGetKbdType"));
if (!kPropertyUnicodeKeyLayoutData ||
!TISCopyCurrentKeyboardLayoutInputSource ||
!TISGetInputSourceProperty ||
!LMGetKbdType)
{
!TISCopyCurrentKeyboardLayoutInputSource || !TISGetInputSourceProperty ||
!LMGetKbdType) {
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to load TIS API symbols");
return GLFW_FALSE;
}
_glfw.ns.tis.kPropertyUnicodeKeyLayoutData =
*kPropertyUnicodeKeyLayoutData;
_glfw.ns.tis.kPropertyUnicodeKeyLayoutData = *kPropertyUnicodeKeyLayoutData;
return updateUnicodeData();
}
@ -385,13 +366,11 @@ static GLFWbool initializeTIS(void)
@implementation GLFWHelper
- (void)selectedKeyboardInputSourceChanged:(NSObject* )object
{
- (void)selectedKeyboardInputSourceChanged:(NSObject *)object {
updateUnicodeData();
}
- (void)doNothing:(id)object
{
- (void)doNothing:(id)object {
}
@end // GLFWHelper
@ -401,18 +380,18 @@ static GLFWbool initializeTIS(void)
@implementation GLFWApplicationDelegate
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{
for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
- (NSApplicationTerminateReply)applicationShouldTerminate:
(NSApplication *)sender {
for (_GLFWwindow *window = _glfw.windowListHead; window;
window = window->next)
_glfwInputWindowCloseRequest(window);
return NSTerminateCancel;
}
- (void)applicationDidChangeScreenParameters:(NSNotification *) notification
{
for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
{
- (void)applicationDidChangeScreenParameters:(NSNotification *)notification {
for (_GLFWwindow *window = _glfw.windowListHead; window;
window = window->next) {
if (window->context.client != GLFW_NO_API)
[window->context.nsgl.object update];
}
@ -420,45 +399,37 @@ static GLFWbool initializeTIS(void)
_glfwPollMonitorsCocoa();
}
- (void)applicationWillFinishLaunching:(NSNotification *)notification
{
if (_glfw.hints.init.ns.menubar)
{
- (void)applicationWillFinishLaunching:(NSNotification *)notification {
if (_glfw.hints.init.ns.menubar) {
// Menu bar setup must go between sharedApplication and finishLaunching
// in order to properly emulate the behavior of NSApplicationMain
if ([[NSBundle mainBundle] pathForResource:@"MainMenu" ofType:@"nib"])
{
if ([[NSBundle mainBundle] pathForResource:@"MainMenu" ofType:@"nib"]) {
[[NSBundle mainBundle] loadNibNamed:@"MainMenu"
owner:NSApp
topLevelObjects:&_glfw.ns.nibObjects];
}
else
} else
createMenuBar();
}
}
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
- (void)applicationDidFinishLaunching:(NSNotification *)notification {
_glfwPostEmptyEventCocoa();
[NSApp stop:nil];
}
- (void)applicationDidHide:(NSNotification *)notification
{
- (void)applicationDidHide:(NSNotification *)notification {
for (int i = 0; i < _glfw.monitorCount; i++)
_glfwRestoreVideoModeCocoa(_glfw.monitors[i]);
}
@end // GLFWApplicationDelegate
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
void* _glfwLoadLocalVulkanLoaderCocoa(void)
{
void *_glfwLoadLocalVulkanLoaderCocoa(void) {
CFBundleRef bundle = CFBundleGetMainBundle();
if (!bundle)
return NULL;
@ -469,16 +440,16 @@ void* _glfwLoadLocalVulkanLoaderCocoa(void)
CFURLRef loaderUrl = CFURLCreateCopyAppendingPathComponent(
kCFAllocatorDefault, frameworksUrl, CFSTR("libvulkan.1.dylib"), false);
if (!loaderUrl)
{
if (!loaderUrl) {
CFRelease(frameworksUrl);
return NULL;
}
char path[PATH_MAX];
void* handle = NULL;
void *handle = NULL;
if (CFURLGetFileSystemRepresentation(loaderUrl, true, (UInt8*) path, sizeof(path) - 1))
if (CFURLGetFileSystemRepresentation(loaderUrl, true, (UInt8 *)path,
sizeof(path) - 1))
handle = _glfwPlatformLoadModule(path);
CFRelease(loaderUrl);
@ -486,15 +457,12 @@ void* _glfwLoadLocalVulkanLoaderCocoa(void)
return handle;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform* platform)
{
const _GLFWplatform cocoa =
{
GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform *platform) {
const _GLFWplatform cocoa = {
GLFW_PLATFORM_COCOA,
_glfwInitCocoa,
_glfwTerminateCocoa,
@ -554,6 +522,7 @@ GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform* platform)
_glfwGetWindowOpacityCocoa,
_glfwSetWindowResizableCocoa,
_glfwSetWindowDecoratedCocoa,
_glfwSetWindowTitlebarCocoa,
_glfwSetWindowFloatingCocoa,
_glfwSetWindowOpacityCocoa,
_glfwSetWindowMousePassthroughCocoa,
@ -611,7 +580,7 @@ int _glfwInitCocoa(void)
changeToResourcesDirectory();
// Press and Hold prevents some keys from emitting repeated characters
NSDictionary* defaults = @{@"ApplePressAndHoldEnabled":@NO};
NSDictionary *defaults = @{@"ApplePressAndHoldEnabled" : @NO};
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
[[NSNotificationCenter defaultCenter]
@ -622,7 +591,8 @@ int _glfwInitCocoa(void)
createKeyTables();
_glfw.ns.eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
_glfw.ns.eventSource =
CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
if (!_glfw.ns.eventSource)
return GLFW_FALSE;
@ -645,38 +615,33 @@ int _glfwInitCocoa(void)
} // autoreleasepool
}
void _glfwTerminateCocoa(void)
{
void _glfwTerminateCocoa(void) {
@autoreleasepool {
if (_glfw.ns.inputSource)
{
if (_glfw.ns.inputSource) {
CFRelease(_glfw.ns.inputSource);
_glfw.ns.inputSource = NULL;
_glfw.ns.unicodeData = nil;
}
if (_glfw.ns.eventSource)
{
if (_glfw.ns.eventSource) {
CFRelease(_glfw.ns.eventSource);
_glfw.ns.eventSource = NULL;
}
if (_glfw.ns.delegate)
{
if (_glfw.ns.delegate) {
[NSApp setDelegate:nil];
[_glfw.ns.delegate release];
_glfw.ns.delegate = nil;
}
if (_glfw.ns.helper)
{
if (_glfw.ns.helper) {
[[NSNotificationCenter defaultCenter]
removeObserver:_glfw.ns.helper
name:NSTextInputContextKeyboardSelectionDidChangeNotification
name:
NSTextInputContextKeyboardSelectionDidChangeNotification
object:nil];
[[NSNotificationCenter defaultCenter]
removeObserver:_glfw.ns.helper];
[[NSNotificationCenter defaultCenter] removeObserver:_glfw.ns.helper];
[_glfw.ns.helper release];
_glfw.ns.helper = nil;
}
@ -694,4 +659,3 @@ void _glfwTerminateCocoa(void)
}
#endif // _GLFW_COCOA

View File

@ -243,6 +243,7 @@ GLFWbool _glfwWindowHoveredCocoa(_GLFWwindow* window);
GLFWbool _glfwFramebufferTransparentCocoa(_GLFWwindow* window);
void _glfwSetWindowResizableCocoa(_GLFWwindow* window, GLFWbool enabled);
void _glfwSetWindowDecoratedCocoa(_GLFWwindow* window, GLFWbool enabled);
void _glfwSetWindowTitlebarCocoa(_GLFWwindow* window, GLFWbool enabled);
void _glfwSetWindowFloatingCocoa(_GLFWwindow* window, GLFWbool enabled);
float _glfwGetWindowOpacityCocoa(_GLFWwindow* window);
void _glfwSetWindowOpacityCocoa(_GLFWwindow* window, float opacity);

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,8 @@
// distribution.
//
//========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h"

View File

@ -28,21 +28,16 @@
#pragma once
#if defined(_GLFW_USE_CONFIG_H)
#include "glfw_config.h"
#include "glfw_config.h"
#endif
#if defined(GLFW_INCLUDE_GLCOREARB) || \
defined(GLFW_INCLUDE_ES1) || \
defined(GLFW_INCLUDE_ES2) || \
defined(GLFW_INCLUDE_ES3) || \
defined(GLFW_INCLUDE_ES31) || \
defined(GLFW_INCLUDE_ES32) || \
defined(GLFW_INCLUDE_NONE) || \
defined(GLFW_INCLUDE_GLEXT) || \
defined(GLFW_INCLUDE_GLU) || \
defined(GLFW_INCLUDE_VULKAN) || \
#if defined(GLFW_INCLUDE_GLCOREARB) || defined(GLFW_INCLUDE_ES1) || \
defined(GLFW_INCLUDE_ES2) || defined(GLFW_INCLUDE_ES3) || \
defined(GLFW_INCLUDE_ES31) || defined(GLFW_INCLUDE_ES32) || \
defined(GLFW_INCLUDE_NONE) || defined(GLFW_INCLUDE_GLEXT) || \
defined(GLFW_INCLUDE_GLU) || defined(GLFW_INCLUDE_VULKAN) || \
defined(GLFW_DLL)
#error "You must not define any header option macros when compiling GLFW"
#error "You must not define any header option macros when compiling GLFW"
#endif
#define GLFW_INCLUDE_NONE
@ -103,15 +98,15 @@ typedef unsigned int GLenum;
typedef unsigned int GLbitfield;
typedef unsigned char GLubyte;
typedef void (APIENTRY * PFNGLCLEARPROC)(GLbitfield);
typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGPROC)(GLenum);
typedef void (APIENTRY * PFNGLGETINTEGERVPROC)(GLenum,GLint*);
typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGIPROC)(GLenum,GLuint);
typedef void(APIENTRY *PFNGLCLEARPROC)(GLbitfield);
typedef const GLubyte *(APIENTRY *PFNGLGETSTRINGPROC)(GLenum);
typedef void(APIENTRY *PFNGLGETINTEGERVPROC)(GLenum, GLint *);
typedef const GLubyte *(APIENTRY *PFNGLGETSTRINGIPROC)(GLenum, GLuint);
#if defined(_GLFW_WIN32)
#define EGLAPIENTRY __stdcall
#define EGLAPIENTRY __stdcall
#else
#define EGLAPIENTRY
#define EGLAPIENTRY
#endif
#define EGL_SUCCESS 0x3000
@ -152,10 +147,10 @@ typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGIPROC)(GLenum,GLuint);
#define EGL_EXTENSIONS 0x3055
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
#define EGL_NATIVE_VISUAL_ID 0x302e
#define EGL_NO_SURFACE ((EGLSurface) 0)
#define EGL_NO_DISPLAY ((EGLDisplay) 0)
#define EGL_NO_CONTEXT ((EGLContext) 0)
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType) 0)
#define EGL_NO_SURFACE ((EGLSurface)0)
#define EGL_NO_DISPLAY ((EGLDisplay)0)
#define EGL_NO_CONTEXT ((EGLContext)0)
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
@ -191,31 +186,40 @@ typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGIPROC)(GLenum,GLuint);
typedef int EGLint;
typedef unsigned int EGLBoolean;
typedef unsigned int EGLenum;
typedef void* EGLConfig;
typedef void* EGLContext;
typedef void* EGLDisplay;
typedef void* EGLSurface;
typedef void *EGLConfig;
typedef void *EGLContext;
typedef void *EGLDisplay;
typedef void *EGLSurface;
typedef void* EGLNativeDisplayType;
typedef void* EGLNativeWindowType;
typedef void *EGLNativeDisplayType;
typedef void *EGLNativeWindowType;
// EGL function pointer typedefs
typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay,EGLConfig,EGLint,EGLint*);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigs)(EGLDisplay,EGLConfig*,EGLint,EGLint*);
typedef EGLDisplay (EGLAPIENTRY * PFN_eglGetDisplay)(EGLNativeDisplayType);
typedef EGLint (EGLAPIENTRY * PFN_eglGetError)(void);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglInitialize)(EGLDisplay,EGLint*,EGLint*);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglTerminate)(EGLDisplay);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglBindAPI)(EGLenum);
typedef EGLContext (EGLAPIENTRY * PFN_eglCreateContext)(EGLDisplay,EGLConfig,EGLContext,const EGLint*);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglDestroySurface)(EGLDisplay,EGLSurface);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglDestroyContext)(EGLDisplay,EGLContext);
typedef EGLSurface (EGLAPIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay,EGLConfig,EGLNativeWindowType,const EGLint*);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglMakeCurrent)(EGLDisplay,EGLSurface,EGLSurface,EGLContext);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapBuffers)(EGLDisplay,EGLSurface);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapInterval)(EGLDisplay,EGLint);
typedef const char* (EGLAPIENTRY * PFN_eglQueryString)(EGLDisplay,EGLint);
typedef GLFWglproc (EGLAPIENTRY * PFN_eglGetProcAddress)(const char*);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglGetConfigAttrib)(EGLDisplay, EGLConfig,
EGLint, EGLint *);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglGetConfigs)(EGLDisplay, EGLConfig *,
EGLint, EGLint *);
typedef EGLDisplay(EGLAPIENTRY *PFN_eglGetDisplay)(EGLNativeDisplayType);
typedef EGLint(EGLAPIENTRY *PFN_eglGetError)(void);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglInitialize)(EGLDisplay, EGLint *,
EGLint *);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglTerminate)(EGLDisplay);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglBindAPI)(EGLenum);
typedef EGLContext(EGLAPIENTRY *PFN_eglCreateContext)(EGLDisplay, EGLConfig,
EGLContext,
const EGLint *);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglDestroySurface)(EGLDisplay, EGLSurface);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglDestroyContext)(EGLDisplay, EGLContext);
typedef EGLSurface(EGLAPIENTRY *PFN_eglCreateWindowSurface)(EGLDisplay,
EGLConfig,
EGLNativeWindowType,
const EGLint *);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglMakeCurrent)(EGLDisplay, EGLSurface,
EGLSurface, EGLContext);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglSwapBuffers)(EGLDisplay, EGLSurface);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglSwapInterval)(EGLDisplay, EGLint);
typedef const char *(EGLAPIENTRY *PFN_eglQueryString)(EGLDisplay, EGLint);
typedef GLFWglproc(EGLAPIENTRY *PFN_eglGetProcAddress)(const char *);
#define eglGetConfigAttrib _glfw.egl.GetConfigAttrib
#define eglGetConfigs _glfw.egl.GetConfigs
#define eglGetDisplay _glfw.egl.GetDisplay
@ -233,10 +237,13 @@ typedef GLFWglproc (EGLAPIENTRY * PFN_eglGetProcAddress)(const char*);
#define eglQueryString _glfw.egl.QueryString
#define eglGetProcAddress _glfw.egl.GetProcAddress
typedef EGLDisplay (EGLAPIENTRY * PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum,void*,const EGLint*);
typedef EGLSurface (EGLAPIENTRY * PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay,EGLConfig,void*,const EGLint*);
typedef EGLDisplay(EGLAPIENTRY *PFNEGLGETPLATFORMDISPLAYEXTPROC)(
EGLenum, void *, const EGLint *);
typedef EGLSurface(EGLAPIENTRY *PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(
EGLDisplay, EGLConfig, void *, const EGLint *);
#define eglGetPlatformDisplayEXT _glfw.egl.GetPlatformDisplayEXT
#define eglCreatePlatformWindowSurfaceEXT _glfw.egl.CreatePlatformWindowSurfaceEXT
#define eglCreatePlatformWindowSurfaceEXT \
_glfw.egl.CreatePlatformWindowSurfaceEXT
#define OSMESA_RGBA 0x1908
#define OSMESA_FORMAT 0x22
@ -249,16 +256,22 @@ typedef EGLSurface (EGLAPIENTRY * PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLD
#define OSMESA_CONTEXT_MAJOR_VERSION 0x36
#define OSMESA_CONTEXT_MINOR_VERSION 0x37
typedef void* OSMesaContext;
typedef void *OSMesaContext;
typedef void (*OSMESAproc)(void);
typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextExt)(GLenum,GLint,GLint,GLint,OSMesaContext);
typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextAttribs)(const int*,OSMesaContext);
typedef void (GLAPIENTRY * PFN_OSMesaDestroyContext)(OSMesaContext);
typedef int (GLAPIENTRY * PFN_OSMesaMakeCurrent)(OSMesaContext,void*,int,int,int);
typedef int (GLAPIENTRY * PFN_OSMesaGetColorBuffer)(OSMesaContext,int*,int*,int*,void**);
typedef int (GLAPIENTRY * PFN_OSMesaGetDepthBuffer)(OSMesaContext,int*,int*,int*,void**);
typedef GLFWglproc (GLAPIENTRY * PFN_OSMesaGetProcAddress)(const char*);
typedef OSMesaContext(GLAPIENTRY *PFN_OSMesaCreateContextExt)(GLenum, GLint,
GLint, GLint,
OSMesaContext);
typedef OSMesaContext(GLAPIENTRY *PFN_OSMesaCreateContextAttribs)(
const int *, OSMesaContext);
typedef void(GLAPIENTRY *PFN_OSMesaDestroyContext)(OSMesaContext);
typedef int(GLAPIENTRY *PFN_OSMesaMakeCurrent)(OSMesaContext, void *, int, int,
int);
typedef int(GLAPIENTRY *PFN_OSMesaGetColorBuffer)(OSMesaContext, int *, int *,
int *, void **);
typedef int(GLAPIENTRY *PFN_OSMesaGetDepthBuffer)(OSMesaContext, int *, int *,
int *, void **);
typedef GLFWglproc(GLAPIENTRY *PFN_OSMesaGetProcAddress)(const char *);
#define OSMesaCreateContextExt _glfw.osmesa.CreateContextExt
#define OSMesaCreateContextAttribs _glfw.osmesa.CreateContextAttribs
#define OSMesaDestroyContext _glfw.osmesa.DestroyContext
@ -269,14 +282,13 @@ typedef GLFWglproc (GLAPIENTRY * PFN_OSMesaGetProcAddress)(const char*);
#define VK_NULL_HANDLE 0
typedef void* VkInstance;
typedef void* VkPhysicalDevice;
typedef void *VkInstance;
typedef void *VkPhysicalDevice;
typedef uint64_t VkSurfaceKHR;
typedef uint32_t VkFlags;
typedef uint32_t VkBool32;
typedef enum VkStructureType
{
typedef enum VkStructureType {
VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000,
VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000,
VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000,
@ -286,8 +298,7 @@ typedef enum VkStructureType
VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
} VkStructureType;
typedef enum VkResult
{
typedef enum VkResult {
VK_SUCCESS = 0,
VK_NOT_READY = 1,
VK_TIMEOUT = 2,
@ -316,30 +327,29 @@ typedef enum VkResult
typedef struct VkAllocationCallbacks VkAllocationCallbacks;
typedef struct VkExtensionProperties
{
typedef struct VkExtensionProperties {
char extensionName[256];
uint32_t specVersion;
} VkExtensionProperties;
typedef void (APIENTRY * PFN_vkVoidFunction)(void);
typedef void(APIENTRY *PFN_vkVoidFunction)(void);
typedef PFN_vkVoidFunction (APIENTRY * PFN_vkGetInstanceProcAddr)(VkInstance,const char*);
typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const char*,uint32_t*,VkExtensionProperties*);
typedef PFN_vkVoidFunction(APIENTRY *PFN_vkGetInstanceProcAddr)(VkInstance,
const char *);
typedef VkResult(APIENTRY *PFN_vkEnumerateInstanceExtensionProperties)(
const char *, uint32_t *, VkExtensionProperties *);
#define vkGetInstanceProcAddr _glfw.vk.GetInstanceProcAddr
#include "platform.h"
// Checks for whether the library has been initialized
#define _GLFW_REQUIRE_INIT() \
if (!_glfw.initialized) \
{ \
if (!_glfw.initialized) { \
_glfwInputError(GLFW_NOT_INITIALIZED, NULL); \
return; \
}
#define _GLFW_REQUIRE_INIT_OR_RETURN(x) \
if (!_glfw.initialized) \
{ \
if (!_glfw.initialized) { \
_glfwInputError(GLFW_NOT_INITIALIZED, NULL); \
return x; \
}
@ -355,9 +365,8 @@ typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const c
// Per-thread error structure
//
struct _GLFWerror
{
_GLFWerror* next;
struct _GLFWerror {
_GLFWerror *next;
int code;
char description[_GLFW_MESSAGE_SIZE];
};
@ -366,8 +375,7 @@ struct _GLFWerror
//
// Parameters relating to the initialization of the library
//
struct _GLFWinitconfig
{
struct _GLFWinitconfig {
GLFWbool hatButtons;
int angleType;
int platformID;
@ -390,16 +398,16 @@ struct _GLFWinitconfig
// to the framebuffer. This is used to pass window creation parameters from
// shared code to the platform API.
//
struct _GLFWwndconfig
{
struct _GLFWwndconfig {
int xpos;
int ypos;
int width;
int height;
const char* title;
const char *title;
GLFWbool resizable;
GLFWbool visible;
GLFWbool decorated;
GLFWbool titlebar;
GLFWbool focused;
GLFWbool autoIconify;
GLFWbool floating;
@ -430,8 +438,7 @@ struct _GLFWwndconfig
// to the framebuffer. This is used to pass context creation parameters from
// shared code to the platform API.
//
struct _GLFWctxconfig
{
struct _GLFWctxconfig {
int client;
int source;
int major;
@ -442,7 +449,7 @@ struct _GLFWctxconfig
int profile;
int robustness;
int release;
_GLFWwindow* share;
_GLFWwindow *share;
struct {
GLFWbool offline;
} nsgl;
@ -456,8 +463,7 @@ struct _GLFWctxconfig
// It is used to pass framebuffer parameters from shared code to the platform
// API and also to enumerate and select available framebuffer configs.
//
struct _GLFWfbconfig
{
struct _GLFWfbconfig {
int redBits;
int greenBits;
int blueBits;
@ -479,8 +485,7 @@ struct _GLFWfbconfig
// Context structure
//
struct _GLFWcontext
{
struct _GLFWcontext {
int client;
int source;
int major, minor, revision;
@ -493,25 +498,25 @@ struct _GLFWcontext
PFNGLGETINTEGERVPROC GetIntegerv;
PFNGLGETSTRINGPROC GetString;
void (*makeCurrent)(_GLFWwindow*);
void (*swapBuffers)(_GLFWwindow*);
void (*makeCurrent)(_GLFWwindow *);
void (*swapBuffers)(_GLFWwindow *);
void (*swapInterval)(int);
int (*extensionSupported)(const char*);
GLFWglproc (*getProcAddress)(const char*);
void (*destroy)(_GLFWwindow*);
int (*extensionSupported)(const char *);
GLFWglproc (*getProcAddress)(const char *);
void (*destroy)(_GLFWwindow *);
struct {
EGLConfig config;
EGLContext handle;
EGLSurface surface;
void* client;
void *client;
} egl;
struct {
OSMesaContext handle;
int width;
int height;
void* buffer;
void *buffer;
} osmesa;
// This is defined in platform.h
@ -520,9 +525,8 @@ struct _GLFWcontext
// Window and context structure
//
struct _GLFWwindow
{
struct _GLFWwindow* next;
struct _GLFWwindow {
struct _GLFWwindow *next;
// Window settings and state
GLFWbool resizable;
@ -532,11 +536,11 @@ struct _GLFWwindow
GLFWbool focusOnShow;
GLFWbool mousePassthrough;
GLFWbool shouldClose;
void* userPointer;
void *userPointer;
GLFWbool doublebuffer;
GLFWvidmode videoMode;
_GLFWmonitor* monitor;
_GLFWcursor* cursor;
_GLFWmonitor *monitor;
_GLFWcursor *cursor;
int minwidth, minheight;
int maxwidth, maxheight;
@ -556,6 +560,7 @@ struct _GLFWwindow
struct {
GLFWwindowposfun pos;
GLFWtitlebarhittestfun tbhittest;
GLFWwindowsizefun size;
GLFWwindowclosefun close;
GLFWwindowrefreshfun refresh;
@ -580,18 +585,17 @@ struct _GLFWwindow
// Monitor structure
//
struct _GLFWmonitor
{
struct _GLFWmonitor {
char name[128];
void* userPointer;
void *userPointer;
// Physical dimensions in millimeters.
int widthMM, heightMM;
// The window whose video mode is current on this monitor
_GLFWwindow* window;
_GLFWwindow *window;
GLFWvidmode* modes;
GLFWvidmode *modes;
int modeCount;
GLFWvidmode currentMode;
@ -604,17 +608,15 @@ struct _GLFWmonitor
// Cursor structure
//
struct _GLFWcursor
{
_GLFWcursor* next;
struct _GLFWcursor {
_GLFWcursor *next;
// This is defined in platform.h
GLFW_PLATFORM_CURSOR_STATE
};
// Gamepad mapping element structure
//
struct _GLFWmapelement
{
struct _GLFWmapelement {
uint8_t type;
uint8_t index;
int8_t axisScale;
@ -623,8 +625,7 @@ struct _GLFWmapelement
// Gamepad mapping structure
//
struct _GLFWmapping
{
struct _GLFWmapping {
char name[128];
char guid[33];
_GLFWmapelement buttons[15];
@ -633,20 +634,19 @@ struct _GLFWmapping
// Joystick structure
//
struct _GLFWjoystick
{
struct _GLFWjoystick {
GLFWbool allocated;
GLFWbool connected;
float* axes;
float *axes;
int axisCount;
unsigned char* buttons;
unsigned char *buttons;
int buttonCount;
unsigned char* hats;
unsigned char *hats;
int hatCount;
char name[128];
void* userPointer;
void *userPointer;
char guid[33];
_GLFWmapping* mapping;
_GLFWmapping *mapping;
// This is defined in platform.h
GLFW_PLATFORM_JOYSTICK_STATE
@ -654,108 +654,110 @@ struct _GLFWjoystick
// Thread local storage structure
//
struct _GLFWtls
{
struct _GLFWtls {
// This is defined in platform.h
GLFW_PLATFORM_TLS_STATE
};
// Mutex structure
//
struct _GLFWmutex
{
struct _GLFWmutex {
// This is defined in platform.h
GLFW_PLATFORM_MUTEX_STATE
};
// Platform API structure
//
struct _GLFWplatform
{
struct _GLFWplatform {
int platformID;
// init
GLFWbool (*init)(void);
void (*terminate)(void);
// input
void (*getCursorPos)(_GLFWwindow*,double*,double*);
void (*setCursorPos)(_GLFWwindow*,double,double);
void (*setCursorMode)(_GLFWwindow*,int);
void (*setRawMouseMotion)(_GLFWwindow*,GLFWbool);
void (*getCursorPos)(_GLFWwindow *, double *, double *);
void (*setCursorPos)(_GLFWwindow *, double, double);
void (*setCursorMode)(_GLFWwindow *, int);
void (*setRawMouseMotion)(_GLFWwindow *, GLFWbool);
GLFWbool (*rawMouseMotionSupported)(void);
GLFWbool (*createCursor)(_GLFWcursor*,const GLFWimage*,int,int);
GLFWbool (*createStandardCursor)(_GLFWcursor*,int);
void (*destroyCursor)(_GLFWcursor*);
void (*setCursor)(_GLFWwindow*,_GLFWcursor*);
const char* (*getScancodeName)(int);
GLFWbool (*createCursor)(_GLFWcursor *, const GLFWimage *, int, int);
GLFWbool (*createStandardCursor)(_GLFWcursor *, int);
void (*destroyCursor)(_GLFWcursor *);
void (*setCursor)(_GLFWwindow *, _GLFWcursor *);
const char *(*getScancodeName)(int);
int (*getKeyScancode)(int);
void (*setClipboardString)(const char*);
const char* (*getClipboardString)(void);
void (*setClipboardString)(const char *);
const char *(*getClipboardString)(void);
GLFWbool (*initJoysticks)(void);
void (*terminateJoysticks)(void);
GLFWbool (*pollJoystick)(_GLFWjoystick*,int);
const char* (*getMappingName)(void);
void (*updateGamepadGUID)(char*);
GLFWbool (*pollJoystick)(_GLFWjoystick *, int);
const char *(*getMappingName)(void);
void (*updateGamepadGUID)(char *);
// monitor
void (*freeMonitor)(_GLFWmonitor*);
void (*getMonitorPos)(_GLFWmonitor*,int*,int*);
void (*getMonitorContentScale)(_GLFWmonitor*,float*,float*);
void (*getMonitorWorkarea)(_GLFWmonitor*,int*,int*,int*,int*);
GLFWvidmode* (*getVideoModes)(_GLFWmonitor*,int*);
void (*getVideoMode)(_GLFWmonitor*,GLFWvidmode*);
GLFWbool (*getGammaRamp)(_GLFWmonitor*,GLFWgammaramp*);
void (*setGammaRamp)(_GLFWmonitor*,const GLFWgammaramp*);
void (*freeMonitor)(_GLFWmonitor *);
void (*getMonitorPos)(_GLFWmonitor *, int *, int *);
void (*getMonitorContentScale)(_GLFWmonitor *, float *, float *);
void (*getMonitorWorkarea)(_GLFWmonitor *, int *, int *, int *, int *);
GLFWvidmode *(*getVideoModes)(_GLFWmonitor *, int *);
void (*getVideoMode)(_GLFWmonitor *, GLFWvidmode *);
GLFWbool (*getGammaRamp)(_GLFWmonitor *, GLFWgammaramp *);
void (*setGammaRamp)(_GLFWmonitor *, const GLFWgammaramp *);
// window
GLFWbool (*createWindow)(_GLFWwindow*,const _GLFWwndconfig*,const _GLFWctxconfig*,const _GLFWfbconfig*);
void (*destroyWindow)(_GLFWwindow*);
void (*setWindowTitle)(_GLFWwindow*,const char*);
void (*setWindowIcon)(_GLFWwindow*,int,const GLFWimage*);
void (*getWindowPos)(_GLFWwindow*,int*,int*);
void (*setWindowPos)(_GLFWwindow*,int,int);
void (*getWindowSize)(_GLFWwindow*,int*,int*);
void (*setWindowSize)(_GLFWwindow*,int,int);
void (*setWindowSizeLimits)(_GLFWwindow*,int,int,int,int);
void (*setWindowAspectRatio)(_GLFWwindow*,int,int);
void (*getFramebufferSize)(_GLFWwindow*,int*,int*);
void (*getWindowFrameSize)(_GLFWwindow*,int*,int*,int*,int*);
void (*getWindowContentScale)(_GLFWwindow*,float*,float*);
void (*iconifyWindow)(_GLFWwindow*);
void (*restoreWindow)(_GLFWwindow*);
void (*maximizeWindow)(_GLFWwindow*);
void (*showWindow)(_GLFWwindow*);
void (*hideWindow)(_GLFWwindow*);
void (*requestWindowAttention)(_GLFWwindow*);
void (*focusWindow)(_GLFWwindow*);
void (*setWindowMonitor)(_GLFWwindow*,_GLFWmonitor*,int,int,int,int,int);
GLFWbool (*windowFocused)(_GLFWwindow*);
GLFWbool (*windowIconified)(_GLFWwindow*);
GLFWbool (*windowVisible)(_GLFWwindow*);
GLFWbool (*windowMaximized)(_GLFWwindow*);
GLFWbool (*windowHovered)(_GLFWwindow*);
GLFWbool (*framebufferTransparent)(_GLFWwindow*);
float (*getWindowOpacity)(_GLFWwindow*);
void (*setWindowResizable)(_GLFWwindow*,GLFWbool);
void (*setWindowDecorated)(_GLFWwindow*,GLFWbool);
void (*setWindowFloating)(_GLFWwindow*,GLFWbool);
void (*setWindowOpacity)(_GLFWwindow*,float);
void (*setWindowMousePassthrough)(_GLFWwindow*,GLFWbool);
GLFWbool (*createWindow)(_GLFWwindow *, const _GLFWwndconfig *,
const _GLFWctxconfig *, const _GLFWfbconfig *);
void (*destroyWindow)(_GLFWwindow *);
void (*setWindowTitle)(_GLFWwindow *, const char *);
void (*setWindowIcon)(_GLFWwindow *, int, const GLFWimage *);
void (*getWindowPos)(_GLFWwindow *, int *, int *);
void (*setWindowPos)(_GLFWwindow *, int, int);
void (*getWindowSize)(_GLFWwindow *, int *, int *);
void (*setWindowSize)(_GLFWwindow *, int, int);
void (*setWindowSizeLimits)(_GLFWwindow *, int, int, int, int);
void (*setWindowAspectRatio)(_GLFWwindow *, int, int);
void (*getFramebufferSize)(_GLFWwindow *, int *, int *);
void (*getWindowFrameSize)(_GLFWwindow *, int *, int *, int *, int *);
void (*getWindowContentScale)(_GLFWwindow *, float *, float *);
void (*iconifyWindow)(_GLFWwindow *);
void (*restoreWindow)(_GLFWwindow *);
void (*maximizeWindow)(_GLFWwindow *);
void (*showWindow)(_GLFWwindow *);
void (*hideWindow)(_GLFWwindow *);
void (*requestWindowAttention)(_GLFWwindow *);
void (*focusWindow)(_GLFWwindow *);
void (*setWindowMonitor)(_GLFWwindow *, _GLFWmonitor *, int, int, int, int,
int);
GLFWbool (*windowFocused)(_GLFWwindow *);
GLFWbool (*windowIconified)(_GLFWwindow *);
GLFWbool (*windowVisible)(_GLFWwindow *);
GLFWbool (*windowMaximized)(_GLFWwindow *);
GLFWbool (*windowHovered)(_GLFWwindow *);
GLFWbool (*framebufferTransparent)(_GLFWwindow *);
float (*getWindowOpacity)(_GLFWwindow *);
void (*setWindowResizable)(_GLFWwindow *, GLFWbool);
void (*setWindowDecorated)(_GLFWwindow *, GLFWbool);
void (*setWindowTitlebar)(_GLFWwindow *, GLFWbool);
void (*setWindowFloating)(_GLFWwindow *, GLFWbool);
void (*setWindowOpacity)(_GLFWwindow *, float);
void (*setWindowMousePassthrough)(_GLFWwindow *, GLFWbool);
void (*pollEvents)(void);
void (*waitEvents)(void);
void (*waitEventsTimeout)(double);
void (*postEmptyEvent)(void);
// EGL
EGLenum (*getEGLPlatform)(EGLint**);
EGLenum (*getEGLPlatform)(EGLint **);
EGLNativeDisplayType (*getEGLNativeDisplay)(void);
EGLNativeWindowType (*getEGLNativeWindow)(_GLFWwindow*);
EGLNativeWindowType (*getEGLNativeWindow)(_GLFWwindow *);
// vulkan
void (*getRequiredInstanceExtensions)(char**);
GLFWbool (*getPhysicalDevicePresentationSupport)(VkInstance,VkPhysicalDevice,uint32_t);
VkResult (*createWindowSurface)(VkInstance,_GLFWwindow*,const VkAllocationCallbacks*,VkSurfaceKHR*);
void (*getRequiredInstanceExtensions)(char **);
GLFWbool (*getPhysicalDevicePresentationSupport)(VkInstance, VkPhysicalDevice,
uint32_t);
VkResult (*createWindowSurface)(VkInstance, _GLFWwindow *,
const VkAllocationCallbacks *,
VkSurfaceKHR *);
};
// Library global data
//
struct _GLFWlibrary
{
struct _GLFWlibrary {
GLFWbool initialized;
GLFWallocator allocator;
@ -769,16 +771,16 @@ struct _GLFWlibrary
int refreshRate;
} hints;
_GLFWerror* errorListHead;
_GLFWcursor* cursorListHead;
_GLFWwindow* windowListHead;
_GLFWerror *errorListHead;
_GLFWcursor *cursorListHead;
_GLFWwindow *windowListHead;
_GLFWmonitor** monitors;
_GLFWmonitor **monitors;
int monitorCount;
GLFWbool joysticksInitialized;
_GLFWjoystick joysticks[GLFW_JOYSTICK_LAST + 1];
_GLFWmapping* mappings;
_GLFWmapping *mappings;
int mappingCount;
_GLFWtls errorSlot;
@ -813,7 +815,7 @@ struct _GLFWlibrary
GLFWbool ANGLE_platform_angle_vulkan;
GLFWbool ANGLE_platform_angle_metal;
void* handle;
void *handle;
PFN_eglGetConfigAttrib GetConfigAttrib;
PFN_eglGetConfigs GetConfigs;
@ -837,7 +839,7 @@ struct _GLFWlibrary
} egl;
struct {
void* handle;
void *handle;
PFN_OSMesaCreateContextExt CreateContextExt;
PFN_OSMesaCreateContextAttribs CreateContextAttribs;
@ -851,8 +853,8 @@ struct _GLFWlibrary
struct {
GLFWbool available;
void* handle;
char* extensions[2];
void *handle;
char *extensions[2];
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
GLFWbool KHR_surface;
GLFWbool KHR_win32_surface;
@ -878,7 +880,6 @@ struct _GLFWlibrary
//
extern _GLFWlibrary _glfw;
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
@ -887,126 +888,183 @@ void _glfwPlatformInitTimer(void);
uint64_t _glfwPlatformGetTimerValue(void);
uint64_t _glfwPlatformGetTimerFrequency(void);
GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls);
void _glfwPlatformDestroyTls(_GLFWtls* tls);
void* _glfwPlatformGetTls(_GLFWtls* tls);
void _glfwPlatformSetTls(_GLFWtls* tls, void* value);
int _glfwPlatformCreateWindow(_GLFWwindow *window,
const _GLFWwndconfig *wndconfig,
const _GLFWctxconfig *ctxconfig,
const _GLFWfbconfig *fbconfig);
void _glfwPlatformDestroyWindow(_GLFWwindow *window);
void _glfwPlatformSetWindowTitle(_GLFWwindow *window, const char *title);
void _glfwPlatformSetWindowIcon(_GLFWwindow *window, int count,
const GLFWimage *images);
void _glfwPlatformGetWindowPos(_GLFWwindow *window, int *xpos, int *ypos);
void _glfwPlatformSetWindowPos(_GLFWwindow *window, int xpos, int ypos);
void _glfwPlatformGetWindowSize(_GLFWwindow *window, int *width, int *height);
void _glfwPlatformSetWindowSize(_GLFWwindow *window, int width, int height);
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow *window, int minwidth,
int minheight, int maxwidth,
int maxheight);
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow *window, int numer,
int denom);
void _glfwPlatformGetFramebufferSize(_GLFWwindow *window, int *width,
int *height);
void _glfwPlatformGetWindowFrameSize(_GLFWwindow *window, int *left, int *top,
int *right, int *bottom);
void _glfwPlatformGetWindowContentScale(_GLFWwindow *window, float *xscale,
float *yscale);
void _glfwPlatformIconifyWindow(_GLFWwindow *window);
void _glfwPlatformRestoreWindow(_GLFWwindow *window);
void _glfwPlatformMaximizeWindow(_GLFWwindow *window);
void _glfwPlatformShowWindow(_GLFWwindow *window);
void _glfwPlatformHideWindow(_GLFWwindow *window);
void _glfwPlatformRequestWindowAttention(_GLFWwindow *window);
void _glfwPlatformFocusWindow(_GLFWwindow *window);
void _glfwPlatformSetWindowMonitor(_GLFWwindow *window, _GLFWmonitor *monitor,
int xpos, int ypos, int width, int height,
int refreshRate);
int _glfwPlatformWindowFocused(_GLFWwindow *window);
int _glfwPlatformWindowIconified(_GLFWwindow *window);
int _glfwPlatformWindowVisible(_GLFWwindow *window);
int _glfwPlatformWindowMaximized(_GLFWwindow *window);
int _glfwPlatformWindowHovered(_GLFWwindow *window);
int _glfwPlatformFramebufferTransparent(_GLFWwindow *window);
float _glfwPlatformGetWindowOpacity(_GLFWwindow *window);
void _glfwPlatformSetWindowResizable(_GLFWwindow *window, GLFWbool enabled);
void _glfwPlatformSetWindowDecorated(_GLFWwindow *window, GLFWbool enabled);
void _glfwPlatformSetWindowTitlebar(_GLFWwindow *window, GLFWbool enabled);
void _glfwPlatformSetWindowFloating(_GLFWwindow *window, GLFWbool enabled);
void _glfwPlatformSetWindowOpacity(_GLFWwindow *window, float opacity);
GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex);
void _glfwPlatformDestroyMutex(_GLFWmutex* mutex);
void _glfwPlatformLockMutex(_GLFWmutex* mutex);
void _glfwPlatformUnlockMutex(_GLFWmutex* mutex);
void _glfwPlatformPollEvents(void);
void _glfwPlatformWaitEvents(void);
void _glfwPlatformWaitEventsTimeout(double timeout);
void _glfwPlatformPostEmptyEvent(void);
void* _glfwPlatformLoadModule(const char* path);
void _glfwPlatformFreeModule(void* module);
GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name);
void _glfwPlatformGetRequiredInstanceExtensions(char **extensions);
int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
VkPhysicalDevice device,
uint32_t queuefamily);
VkResult
_glfwPlatformCreateWindowSurface(VkInstance instance, _GLFWwindow *window,
const VkAllocationCallbacks *allocator,
VkSurfaceKHR *surface);
GLFWbool _glfwPlatformCreateTls(_GLFWtls *tls);
void _glfwPlatformDestroyTls(_GLFWtls *tls);
void *_glfwPlatformGetTls(_GLFWtls *tls);
void _glfwPlatformSetTls(_GLFWtls *tls, void *value);
GLFWbool _glfwPlatformCreateMutex(_GLFWmutex *mutex);
void _glfwPlatformDestroyMutex(_GLFWmutex *mutex);
void _glfwPlatformLockMutex(_GLFWmutex *mutex);
void _glfwPlatformUnlockMutex(_GLFWmutex *mutex);
void *_glfwPlatformLoadModule(const char *path);
void _glfwPlatformFreeModule(void *module);
GLFWproc _glfwPlatformGetModuleSymbol(void *module, const char *name);
//////////////////////////////////////////////////////////////////////////
////// GLFW event API //////
//////////////////////////////////////////////////////////////////////////
void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused);
void _glfwInputWindowPos(_GLFWwindow* window, int xpos, int ypos);
void _glfwInputWindowSize(_GLFWwindow* window, int width, int height);
void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height);
void _glfwInputWindowContentScale(_GLFWwindow* window,
float xscale, float yscale);
void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified);
void _glfwInputWindowMaximize(_GLFWwindow* window, GLFWbool maximized);
void _glfwInputWindowDamage(_GLFWwindow* window);
void _glfwInputWindowCloseRequest(_GLFWwindow* window);
void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor);
void _glfwInputWindowFocus(_GLFWwindow *window, GLFWbool focused);
void _glfwInputWindowPos(_GLFWwindow *window, int xpos, int ypos);
void _glfwInputWindowSize(_GLFWwindow *window, int width, int height);
void _glfwInputTitleBarHitTest(_GLFWwindow *window, int posX, int posY,
int *hit);
void _glfwInputFramebufferSize(_GLFWwindow *window, int width, int height);
void _glfwInputWindowContentScale(_GLFWwindow *window, float xscale,
float yscale);
void _glfwInputWindowIconify(_GLFWwindow *window, GLFWbool iconified);
void _glfwInputWindowMaximize(_GLFWwindow *window, GLFWbool maximized);
void _glfwInputWindowDamage(_GLFWwindow *window);
void _glfwInputWindowCloseRequest(_GLFWwindow *window);
void _glfwInputWindowMonitor(_GLFWwindow *window, _GLFWmonitor *monitor);
void _glfwInputKey(_GLFWwindow* window,
int key, int scancode, int action, int mods);
void _glfwInputChar(_GLFWwindow* window,
uint32_t codepoint, int mods, GLFWbool plain);
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset);
void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods);
void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos);
void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered);
void _glfwInputDrop(_GLFWwindow* window, int count, const char** names);
void _glfwInputJoystick(_GLFWjoystick* js, int event);
void _glfwInputJoystickAxis(_GLFWjoystick* js, int axis, float value);
void _glfwInputJoystickButton(_GLFWjoystick* js, int button, char value);
void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value);
void _glfwInputKey(_GLFWwindow *window, int key, int scancode, int action,
int mods);
void _glfwInputChar(_GLFWwindow *window, uint32_t codepoint, int mods,
GLFWbool plain);
void _glfwInputScroll(_GLFWwindow *window, double xoffset, double yoffset);
void _glfwInputMouseClick(_GLFWwindow *window, int button, int action,
int mods);
void _glfwInputCursorPos(_GLFWwindow *window, double xpos, double ypos);
void _glfwInputCursorEnter(_GLFWwindow *window, GLFWbool entered);
void _glfwInputDrop(_GLFWwindow *window, int count, const char **names);
void _glfwInputJoystick(_GLFWjoystick *js, int event);
void _glfwInputJoystickAxis(_GLFWjoystick *js, int axis, float value);
void _glfwInputJoystickButton(_GLFWjoystick *js, int button, char value);
void _glfwInputJoystickHat(_GLFWjoystick *js, int hat, char value);
void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement);
void _glfwInputMonitorWindow(_GLFWmonitor* monitor, _GLFWwindow* window);
void _glfwInputMonitor(_GLFWmonitor *monitor, int action, int placement);
void _glfwInputMonitorWindow(_GLFWmonitor *monitor, _GLFWwindow *window);
#if defined(__GNUC__)
void _glfwInputError(int code, const char* format, ...)
void _glfwInputError(int code, const char *format, ...)
__attribute__((format(printf, 2, 3)));
#else
void _glfwInputError(int code, const char* format, ...);
void _glfwInputError(int code, const char *format, ...);
#endif
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
GLFWbool _glfwSelectPlatform(int platformID, _GLFWplatform* platform);
GLFWbool _glfwSelectPlatform(int platformID, _GLFWplatform *platform);
GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions);
const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
const _GLFWfbconfig* alternatives,
GLFWbool _glfwStringInExtensionString(const char *string,
const char *extensions);
const _GLFWfbconfig *_glfwChooseFBConfig(const _GLFWfbconfig *desired,
const _GLFWfbconfig *alternatives,
unsigned int count);
GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig);
GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig);
GLFWbool _glfwRefreshContextAttribs(_GLFWwindow *window,
const _GLFWctxconfig *ctxconfig);
GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig *ctxconfig);
const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor,
const GLFWvidmode* desired);
int _glfwCompareVideoModes(const GLFWvidmode* first, const GLFWvidmode* second);
_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM);
void _glfwFreeMonitor(_GLFWmonitor* monitor);
void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size);
void _glfwFreeGammaArrays(GLFWgammaramp* ramp);
void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
const GLFWvidmode *_glfwChooseVideoMode(_GLFWmonitor *monitor,
const GLFWvidmode *desired);
int _glfwCompareVideoModes(const GLFWvidmode *first, const GLFWvidmode *second);
_GLFWmonitor *_glfwAllocMonitor(const char *name, int widthMM, int heightMM);
void _glfwFreeMonitor(_GLFWmonitor *monitor);
void _glfwAllocGammaArrays(GLFWgammaramp *ramp, unsigned int size);
void _glfwFreeGammaArrays(GLFWgammaramp *ramp);
void _glfwSplitBPP(int bpp, int *red, int *green, int *blue);
void _glfwInitGamepadMappings(void);
_GLFWjoystick* _glfwAllocJoystick(const char* name,
const char* guid,
int axisCount,
int buttonCount,
int hatCount);
void _glfwFreeJoystick(_GLFWjoystick* js);
void _glfwCenterCursorInContentArea(_GLFWwindow* window);
_GLFWjoystick *_glfwAllocJoystick(const char *name, const char *guid,
int axisCount, int buttonCount, int hatCount);
void _glfwFreeJoystick(_GLFWjoystick *js);
void _glfwCenterCursorInContentArea(_GLFWwindow *window);
GLFWbool _glfwInitEGL(void);
void _glfwTerminateEGL(void);
GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig);
GLFWbool _glfwCreateContextEGL(_GLFWwindow *window,
const _GLFWctxconfig *ctxconfig,
const _GLFWfbconfig *fbconfig);
#if defined(_GLFW_X11)
GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig,
Visual** visual, int* depth);
GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig *wndconfig,
const _GLFWctxconfig *ctxconfig,
const _GLFWfbconfig *fbconfig, Visual **visual,
int *depth);
#endif /*_GLFW_X11*/
GLFWbool _glfwInitOSMesa(void);
void _glfwTerminateOSMesa(void);
GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig);
GLFWbool _glfwCreateContextOSMesa(_GLFWwindow *window,
const _GLFWctxconfig *ctxconfig,
const _GLFWfbconfig *fbconfig);
GLFWbool _glfwInitVulkan(int mode);
void _glfwTerminateVulkan(void);
const char* _glfwGetVulkanResultString(VkResult result);
const char *_glfwGetVulkanResultString(VkResult result);
size_t _glfwEncodeUTF8(char* s, uint32_t codepoint);
char** _glfwParseUriList(char* text, int* count);
size_t _glfwEncodeUTF8(char *s, uint32_t codepoint);
char **_glfwParseUriList(char *text, int *count);
char* _glfw_strdup(const char* source);
char *_glfw_strdup(const char *source);
int _glfw_min(int a, int b);
int _glfw_max(int a, int b);
float _glfw_fminf(float a, float b);
float _glfw_fmaxf(float a, float b);
void* _glfw_calloc(size_t count, size_t size);
void* _glfw_realloc(void* pointer, size_t size);
void _glfw_free(void* pointer);
void *_glfw_calloc(size_t count, size_t size);
void *_glfw_realloc(void *pointer, size_t size);
void _glfw_free(void *pointer);

View File

@ -2130,6 +2130,10 @@ int main(const int argc, const char *argv[]) {
demo_create_window(&demo);
demo_init_vk_swapchain(&demo);
glfwSetWindowAttrib(demo.window, GLFW_RESIZABLE, GLFW_TRUE);
glfwSetWindowAttrib(demo.window, GLFW_TITLEBAR, GLFW_FALSE);
demo_prepare(&demo);
demo_run(&demo);