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) * of the specified monitor, or `NULL` if an [error](@ref error_handling)
* occurred. * occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -187,8 +186,7 @@ GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an * `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -204,8 +202,7 @@ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
* @return The `HWND` of the specified window, or `NULL` if an * @return The `HWND` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @remark The `HDC` associated with the window can be queried with the * @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) * [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 * @return The `HGLRC` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT. * GLFW_NOT_INITIALIZED.
* *
* @remark The `HDC` associated with the window can be queried with the * @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) * [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 * @return The `CGDirectDisplayID` of the specified monitor, or
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred. * `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -275,8 +271,7 @@ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
* @return The `NSWindow` of the specified window, or `nil` if an * @return The `NSWindow` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -294,8 +289,8 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
* @return The `NSOpenGLContext` of the specified window, or `nil` if an * @return The `NSOpenGLContext` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT. * GLFW_NOT_INITIALIZED.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -313,8 +308,7 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
* @return The `Display` used by GLFW, or `NULL` if an * @return The `Display` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -330,8 +324,7 @@ GLFWAPI Display* glfwGetX11Display(void);
* @return The `RRCrtc` of the specified monitor, or `None` if an * @return The `RRCrtc` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -347,8 +340,7 @@ GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
* @return The `RROutput` of the specified monitor, or `None` if an * @return The `RROutput` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -364,8 +356,7 @@ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
* @return The `Window` of the specified window, or `None` if an * @return The `Window` of the specified window, or `None` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -380,8 +371,8 @@ GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
* *
* @param[in] string A UTF-8 encoded string. * @param[in] string A UTF-8 encoded string.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @pointer_lifetime The specified string is copied before this function * @pointer_lifetime The specified string is copied before this function
* returns. * 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` * @return The contents of the selection as a UTF-8 encoded string, or `NULL`
* if an [error](@ref error_handling) occurred. * if an [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @pointer_lifetime The returned string is allocated and freed by GLFW. You * @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 * 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 * @return The `GLXContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE. * GLFW_NOT_INITIALIZED.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -450,8 +441,8 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
* @return The `GLXWindow` of the specified window, or `None` if an * @return The `GLXWindow` of the specified window, or `None` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE. * GLFW_NOT_INITIALIZED.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -469,8 +460,7 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
* @return The `struct wl_display*` used by GLFW, or `NULL` if an * @return The `struct wl_display*` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -486,8 +476,7 @@ GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
* @return The `struct wl_output*` of the specified monitor, or `NULL` if an * @return The `struct wl_output*` of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * 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 * @return The main `struct wl_surface*` of the specified window, or `NULL` if
* an [error](@ref error_handling) occurred. * an [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -541,8 +529,8 @@ GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an * @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NO_WINDOW_CONTEXT. * GLFW_NOT_INITIALIZED.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -558,8 +546,8 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an * @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NO_WINDOW_CONTEXT. * GLFW_NOT_INITIALIZED.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -584,8 +572,8 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NO_WINDOW_CONTEXT. * GLFW_NOT_INITIALIZED.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -608,8 +596,8 @@ GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NO_WINDOW_CONTEXT. * GLFW_NOT_INITIALIZED.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * 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 * @return The `OSMesaContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NO_WINDOW_CONTEXT. * GLFW_NOT_INITIALIZED.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -31,16 +31,11 @@
#include "glfw_config.h" #include "glfw_config.h"
#endif #endif
#if defined(GLFW_INCLUDE_GLCOREARB) || \ #if defined(GLFW_INCLUDE_GLCOREARB) || defined(GLFW_INCLUDE_ES1) || \
defined(GLFW_INCLUDE_ES1) || \ defined(GLFW_INCLUDE_ES2) || defined(GLFW_INCLUDE_ES3) || \
defined(GLFW_INCLUDE_ES2) || \ defined(GLFW_INCLUDE_ES31) || defined(GLFW_INCLUDE_ES32) || \
defined(GLFW_INCLUDE_ES3) || \ defined(GLFW_INCLUDE_NONE) || defined(GLFW_INCLUDE_GLEXT) || \
defined(GLFW_INCLUDE_ES31) || \ defined(GLFW_INCLUDE_GLU) || defined(GLFW_INCLUDE_VULKAN) || \
defined(GLFW_INCLUDE_ES32) || \
defined(GLFW_INCLUDE_NONE) || \
defined(GLFW_INCLUDE_GLEXT) || \
defined(GLFW_INCLUDE_GLU) || \
defined(GLFW_INCLUDE_VULKAN) || \
defined(GLFW_DLL) 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 #endif
@ -200,18 +195,27 @@ typedef void* EGLNativeDisplayType;
typedef void *EGLNativeWindowType; typedef void *EGLNativeWindowType;
// EGL function pointer typedefs // EGL function pointer typedefs
typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay,EGLConfig,EGLint,EGLint*); typedef EGLBoolean(EGLAPIENTRY *PFN_eglGetConfigAttrib)(EGLDisplay, EGLConfig,
typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigs)(EGLDisplay,EGLConfig*,EGLint,EGLint*); EGLint, EGLint *);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglGetConfigs)(EGLDisplay, EGLConfig *,
EGLint, EGLint *);
typedef EGLDisplay(EGLAPIENTRY *PFN_eglGetDisplay)(EGLNativeDisplayType); typedef EGLDisplay(EGLAPIENTRY *PFN_eglGetDisplay)(EGLNativeDisplayType);
typedef EGLint(EGLAPIENTRY *PFN_eglGetError)(void); typedef EGLint(EGLAPIENTRY *PFN_eglGetError)(void);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglInitialize)(EGLDisplay,EGLint*,EGLint*); typedef EGLBoolean(EGLAPIENTRY *PFN_eglInitialize)(EGLDisplay, EGLint *,
EGLint *);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglTerminate)(EGLDisplay); typedef EGLBoolean(EGLAPIENTRY *PFN_eglTerminate)(EGLDisplay);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglBindAPI)(EGLenum); typedef EGLBoolean(EGLAPIENTRY *PFN_eglBindAPI)(EGLenum);
typedef EGLContext (EGLAPIENTRY * PFN_eglCreateContext)(EGLDisplay,EGLConfig,EGLContext,const EGLint*); typedef EGLContext(EGLAPIENTRY *PFN_eglCreateContext)(EGLDisplay, EGLConfig,
EGLContext,
const EGLint *);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglDestroySurface)(EGLDisplay, EGLSurface); typedef EGLBoolean(EGLAPIENTRY *PFN_eglDestroySurface)(EGLDisplay, EGLSurface);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglDestroyContext)(EGLDisplay, EGLContext); typedef EGLBoolean(EGLAPIENTRY *PFN_eglDestroyContext)(EGLDisplay, EGLContext);
typedef EGLSurface (EGLAPIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay,EGLConfig,EGLNativeWindowType,const EGLint*); typedef EGLSurface(EGLAPIENTRY *PFN_eglCreateWindowSurface)(EGLDisplay,
typedef EGLBoolean (EGLAPIENTRY * PFN_eglMakeCurrent)(EGLDisplay,EGLSurface,EGLSurface,EGLContext); EGLConfig,
EGLNativeWindowType,
const EGLint *);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglMakeCurrent)(EGLDisplay, EGLSurface,
EGLSurface, EGLContext);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglSwapBuffers)(EGLDisplay, EGLSurface); typedef EGLBoolean(EGLAPIENTRY *PFN_eglSwapBuffers)(EGLDisplay, EGLSurface);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglSwapInterval)(EGLDisplay, EGLint); typedef EGLBoolean(EGLAPIENTRY *PFN_eglSwapInterval)(EGLDisplay, EGLint);
typedef const char *(EGLAPIENTRY *PFN_eglQueryString)(EGLDisplay, EGLint); typedef const char *(EGLAPIENTRY *PFN_eglQueryString)(EGLDisplay, EGLint);
@ -233,10 +237,13 @@ typedef GLFWglproc (EGLAPIENTRY * PFN_eglGetProcAddress)(const char*);
#define eglQueryString _glfw.egl.QueryString #define eglQueryString _glfw.egl.QueryString
#define eglGetProcAddress _glfw.egl.GetProcAddress #define eglGetProcAddress _glfw.egl.GetProcAddress
typedef EGLDisplay (EGLAPIENTRY * PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum,void*,const EGLint*); typedef EGLDisplay(EGLAPIENTRY *PFNEGLGETPLATFORMDISPLAYEXTPROC)(
typedef EGLSurface (EGLAPIENTRY * PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay,EGLConfig,void*,const EGLint*); EGLenum, void *, const EGLint *);
typedef EGLSurface(EGLAPIENTRY *PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(
EGLDisplay, EGLConfig, void *, const EGLint *);
#define eglGetPlatformDisplayEXT _glfw.egl.GetPlatformDisplayEXT #define eglGetPlatformDisplayEXT _glfw.egl.GetPlatformDisplayEXT
#define eglCreatePlatformWindowSurfaceEXT _glfw.egl.CreatePlatformWindowSurfaceEXT #define eglCreatePlatformWindowSurfaceEXT \
_glfw.egl.CreatePlatformWindowSurfaceEXT
#define OSMESA_RGBA 0x1908 #define OSMESA_RGBA 0x1908
#define OSMESA_FORMAT 0x22 #define OSMESA_FORMAT 0x22
@ -252,12 +259,18 @@ typedef EGLSurface (EGLAPIENTRY * PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLD
typedef void *OSMesaContext; typedef void *OSMesaContext;
typedef void (*OSMESAproc)(void); typedef void (*OSMESAproc)(void);
typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextExt)(GLenum,GLint,GLint,GLint,OSMesaContext); typedef OSMesaContext(GLAPIENTRY *PFN_OSMesaCreateContextExt)(GLenum, GLint,
typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextAttribs)(const int*,OSMesaContext); GLint, GLint,
OSMesaContext);
typedef OSMesaContext(GLAPIENTRY *PFN_OSMesaCreateContextAttribs)(
const int *, OSMesaContext);
typedef void(GLAPIENTRY *PFN_OSMesaDestroyContext)(OSMesaContext); typedef void(GLAPIENTRY *PFN_OSMesaDestroyContext)(OSMesaContext);
typedef int (GLAPIENTRY * PFN_OSMesaMakeCurrent)(OSMesaContext,void*,int,int,int); typedef int(GLAPIENTRY *PFN_OSMesaMakeCurrent)(OSMesaContext, void *, int, int,
typedef int (GLAPIENTRY * PFN_OSMesaGetColorBuffer)(OSMesaContext,int*,int*,int*,void**); int);
typedef int (GLAPIENTRY * PFN_OSMesaGetDepthBuffer)(OSMesaContext,int*,int*,int*,void**); 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 GLFWglproc(GLAPIENTRY *PFN_OSMesaGetProcAddress)(const char *);
#define OSMesaCreateContextExt _glfw.osmesa.CreateContextExt #define OSMesaCreateContextExt _glfw.osmesa.CreateContextExt
#define OSMesaCreateContextAttribs _glfw.osmesa.CreateContextAttribs #define OSMesaCreateContextAttribs _glfw.osmesa.CreateContextAttribs
@ -275,8 +288,7 @@ typedef uint64_t VkSurfaceKHR;
typedef uint32_t VkFlags; typedef uint32_t VkFlags;
typedef uint32_t VkBool32; typedef uint32_t VkBool32;
typedef enum VkStructureType typedef enum VkStructureType {
{
VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000, VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000,
VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000, VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000,
VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000, VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000,
@ -286,8 +298,7 @@ typedef enum VkStructureType
VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
} VkStructureType; } VkStructureType;
typedef enum VkResult typedef enum VkResult {
{
VK_SUCCESS = 0, VK_SUCCESS = 0,
VK_NOT_READY = 1, VK_NOT_READY = 1,
VK_TIMEOUT = 2, VK_TIMEOUT = 2,
@ -316,30 +327,29 @@ typedef enum VkResult
typedef struct VkAllocationCallbacks VkAllocationCallbacks; typedef struct VkAllocationCallbacks VkAllocationCallbacks;
typedef struct VkExtensionProperties typedef struct VkExtensionProperties {
{
char extensionName[256]; char extensionName[256];
uint32_t specVersion; uint32_t specVersion;
} VkExtensionProperties; } VkExtensionProperties;
typedef void(APIENTRY *PFN_vkVoidFunction)(void); typedef void(APIENTRY *PFN_vkVoidFunction)(void);
typedef PFN_vkVoidFunction (APIENTRY * PFN_vkGetInstanceProcAddr)(VkInstance,const char*); typedef PFN_vkVoidFunction(APIENTRY *PFN_vkGetInstanceProcAddr)(VkInstance,
typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const char*,uint32_t*,VkExtensionProperties*); const char *);
typedef VkResult(APIENTRY *PFN_vkEnumerateInstanceExtensionProperties)(
const char *, uint32_t *, VkExtensionProperties *);
#define vkGetInstanceProcAddr _glfw.vk.GetInstanceProcAddr #define vkGetInstanceProcAddr _glfw.vk.GetInstanceProcAddr
#include "platform.h" #include "platform.h"
// Checks for whether the library has been initialized // Checks for whether the library has been initialized
#define _GLFW_REQUIRE_INIT() \ #define _GLFW_REQUIRE_INIT() \
if (!_glfw.initialized) \ if (!_glfw.initialized) { \
{ \
_glfwInputError(GLFW_NOT_INITIALIZED, NULL); \ _glfwInputError(GLFW_NOT_INITIALIZED, NULL); \
return; \ return; \
} }
#define _GLFW_REQUIRE_INIT_OR_RETURN(x) \ #define _GLFW_REQUIRE_INIT_OR_RETURN(x) \
if (!_glfw.initialized) \ if (!_glfw.initialized) { \
{ \
_glfwInputError(GLFW_NOT_INITIALIZED, NULL); \ _glfwInputError(GLFW_NOT_INITIALIZED, NULL); \
return x; \ return x; \
} }
@ -355,8 +365,7 @@ typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const c
// Per-thread error structure // Per-thread error structure
// //
struct _GLFWerror struct _GLFWerror {
{
_GLFWerror *next; _GLFWerror *next;
int code; int code;
char description[_GLFW_MESSAGE_SIZE]; char description[_GLFW_MESSAGE_SIZE];
@ -366,8 +375,7 @@ struct _GLFWerror
// //
// Parameters relating to the initialization of the library // Parameters relating to the initialization of the library
// //
struct _GLFWinitconfig struct _GLFWinitconfig {
{
GLFWbool hatButtons; GLFWbool hatButtons;
int angleType; int angleType;
int platformID; int platformID;
@ -390,8 +398,7 @@ struct _GLFWinitconfig
// to the framebuffer. This is used to pass window creation parameters from // to the framebuffer. This is used to pass window creation parameters from
// shared code to the platform API. // shared code to the platform API.
// //
struct _GLFWwndconfig struct _GLFWwndconfig {
{
int xpos; int xpos;
int ypos; int ypos;
int width; int width;
@ -400,6 +407,7 @@ struct _GLFWwndconfig
GLFWbool resizable; GLFWbool resizable;
GLFWbool visible; GLFWbool visible;
GLFWbool decorated; GLFWbool decorated;
GLFWbool titlebar;
GLFWbool focused; GLFWbool focused;
GLFWbool autoIconify; GLFWbool autoIconify;
GLFWbool floating; GLFWbool floating;
@ -430,8 +438,7 @@ struct _GLFWwndconfig
// to the framebuffer. This is used to pass context creation parameters from // to the framebuffer. This is used to pass context creation parameters from
// shared code to the platform API. // shared code to the platform API.
// //
struct _GLFWctxconfig struct _GLFWctxconfig {
{
int client; int client;
int source; int source;
int major; int major;
@ -456,8 +463,7 @@ struct _GLFWctxconfig
// It is used to pass framebuffer parameters from shared code to the platform // It is used to pass framebuffer parameters from shared code to the platform
// API and also to enumerate and select available framebuffer configs. // API and also to enumerate and select available framebuffer configs.
// //
struct _GLFWfbconfig struct _GLFWfbconfig {
{
int redBits; int redBits;
int greenBits; int greenBits;
int blueBits; int blueBits;
@ -479,8 +485,7 @@ struct _GLFWfbconfig
// Context structure // Context structure
// //
struct _GLFWcontext struct _GLFWcontext {
{
int client; int client;
int source; int source;
int major, minor, revision; int major, minor, revision;
@ -520,8 +525,7 @@ struct _GLFWcontext
// Window and context structure // Window and context structure
// //
struct _GLFWwindow struct _GLFWwindow {
{
struct _GLFWwindow *next; struct _GLFWwindow *next;
// Window settings and state // Window settings and state
@ -556,6 +560,7 @@ struct _GLFWwindow
struct { struct {
GLFWwindowposfun pos; GLFWwindowposfun pos;
GLFWtitlebarhittestfun tbhittest;
GLFWwindowsizefun size; GLFWwindowsizefun size;
GLFWwindowclosefun close; GLFWwindowclosefun close;
GLFWwindowrefreshfun refresh; GLFWwindowrefreshfun refresh;
@ -580,8 +585,7 @@ struct _GLFWwindow
// Monitor structure // Monitor structure
// //
struct _GLFWmonitor struct _GLFWmonitor {
{
char name[128]; char name[128];
void *userPointer; void *userPointer;
@ -604,8 +608,7 @@ struct _GLFWmonitor
// Cursor structure // Cursor structure
// //
struct _GLFWcursor struct _GLFWcursor {
{
_GLFWcursor *next; _GLFWcursor *next;
// This is defined in platform.h // This is defined in platform.h
GLFW_PLATFORM_CURSOR_STATE GLFW_PLATFORM_CURSOR_STATE
@ -613,8 +616,7 @@ struct _GLFWcursor
// Gamepad mapping element structure // Gamepad mapping element structure
// //
struct _GLFWmapelement struct _GLFWmapelement {
{
uint8_t type; uint8_t type;
uint8_t index; uint8_t index;
int8_t axisScale; int8_t axisScale;
@ -623,8 +625,7 @@ struct _GLFWmapelement
// Gamepad mapping structure // Gamepad mapping structure
// //
struct _GLFWmapping struct _GLFWmapping {
{
char name[128]; char name[128];
char guid[33]; char guid[33];
_GLFWmapelement buttons[15]; _GLFWmapelement buttons[15];
@ -633,8 +634,7 @@ struct _GLFWmapping
// Joystick structure // Joystick structure
// //
struct _GLFWjoystick struct _GLFWjoystick {
{
GLFWbool allocated; GLFWbool allocated;
GLFWbool connected; GLFWbool connected;
float *axes; float *axes;
@ -654,24 +654,21 @@ struct _GLFWjoystick
// Thread local storage structure // Thread local storage structure
// //
struct _GLFWtls struct _GLFWtls {
{
// This is defined in platform.h // This is defined in platform.h
GLFW_PLATFORM_TLS_STATE GLFW_PLATFORM_TLS_STATE
}; };
// Mutex structure // Mutex structure
// //
struct _GLFWmutex struct _GLFWmutex {
{
// This is defined in platform.h // This is defined in platform.h
GLFW_PLATFORM_MUTEX_STATE GLFW_PLATFORM_MUTEX_STATE
}; };
// Platform API structure // Platform API structure
// //
struct _GLFWplatform struct _GLFWplatform {
{
int platformID; int platformID;
// init // init
GLFWbool (*init)(void); GLFWbool (*init)(void);
@ -705,7 +702,8 @@ struct _GLFWplatform
GLFWbool (*getGammaRamp)(_GLFWmonitor *, GLFWgammaramp *); GLFWbool (*getGammaRamp)(_GLFWmonitor *, GLFWgammaramp *);
void (*setGammaRamp)(_GLFWmonitor *, const GLFWgammaramp *); void (*setGammaRamp)(_GLFWmonitor *, const GLFWgammaramp *);
// window // window
GLFWbool (*createWindow)(_GLFWwindow*,const _GLFWwndconfig*,const _GLFWctxconfig*,const _GLFWfbconfig*); GLFWbool (*createWindow)(_GLFWwindow *, const _GLFWwndconfig *,
const _GLFWctxconfig *, const _GLFWfbconfig *);
void (*destroyWindow)(_GLFWwindow *); void (*destroyWindow)(_GLFWwindow *);
void (*setWindowTitle)(_GLFWwindow *, const char *); void (*setWindowTitle)(_GLFWwindow *, const char *);
void (*setWindowIcon)(_GLFWwindow *, int, const GLFWimage *); void (*setWindowIcon)(_GLFWwindow *, int, const GLFWimage *);
@ -725,7 +723,8 @@ struct _GLFWplatform
void (*hideWindow)(_GLFWwindow *); void (*hideWindow)(_GLFWwindow *);
void (*requestWindowAttention)(_GLFWwindow *); void (*requestWindowAttention)(_GLFWwindow *);
void (*focusWindow)(_GLFWwindow *); void (*focusWindow)(_GLFWwindow *);
void (*setWindowMonitor)(_GLFWwindow*,_GLFWmonitor*,int,int,int,int,int); void (*setWindowMonitor)(_GLFWwindow *, _GLFWmonitor *, int, int, int, int,
int);
GLFWbool (*windowFocused)(_GLFWwindow *); GLFWbool (*windowFocused)(_GLFWwindow *);
GLFWbool (*windowIconified)(_GLFWwindow *); GLFWbool (*windowIconified)(_GLFWwindow *);
GLFWbool (*windowVisible)(_GLFWwindow *); GLFWbool (*windowVisible)(_GLFWwindow *);
@ -735,6 +734,7 @@ struct _GLFWplatform
float (*getWindowOpacity)(_GLFWwindow *); float (*getWindowOpacity)(_GLFWwindow *);
void (*setWindowResizable)(_GLFWwindow *, GLFWbool); void (*setWindowResizable)(_GLFWwindow *, GLFWbool);
void (*setWindowDecorated)(_GLFWwindow *, GLFWbool); void (*setWindowDecorated)(_GLFWwindow *, GLFWbool);
void (*setWindowTitlebar)(_GLFWwindow *, GLFWbool);
void (*setWindowFloating)(_GLFWwindow *, GLFWbool); void (*setWindowFloating)(_GLFWwindow *, GLFWbool);
void (*setWindowOpacity)(_GLFWwindow *, float); void (*setWindowOpacity)(_GLFWwindow *, float);
void (*setWindowMousePassthrough)(_GLFWwindow *, GLFWbool); void (*setWindowMousePassthrough)(_GLFWwindow *, GLFWbool);
@ -748,14 +748,16 @@ struct _GLFWplatform
EGLNativeWindowType (*getEGLNativeWindow)(_GLFWwindow *); EGLNativeWindowType (*getEGLNativeWindow)(_GLFWwindow *);
// vulkan // vulkan
void (*getRequiredInstanceExtensions)(char **); void (*getRequiredInstanceExtensions)(char **);
GLFWbool (*getPhysicalDevicePresentationSupport)(VkInstance,VkPhysicalDevice,uint32_t); GLFWbool (*getPhysicalDevicePresentationSupport)(VkInstance, VkPhysicalDevice,
VkResult (*createWindowSurface)(VkInstance,_GLFWwindow*,const VkAllocationCallbacks*,VkSurfaceKHR*); uint32_t);
VkResult (*createWindowSurface)(VkInstance, _GLFWwindow *,
const VkAllocationCallbacks *,
VkSurfaceKHR *);
}; };
// Library global data // Library global data
// //
struct _GLFWlibrary struct _GLFWlibrary {
{
GLFWbool initialized; GLFWbool initialized;
GLFWallocator allocator; GLFWallocator allocator;
@ -878,7 +880,6 @@ struct _GLFWlibrary
// //
extern _GLFWlibrary _glfw; extern _GLFWlibrary _glfw;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////// GLFW platform API ////// ////// GLFW platform API //////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -887,6 +888,65 @@ void _glfwPlatformInitTimer(void);
uint64_t _glfwPlatformGetTimerValue(void); uint64_t _glfwPlatformGetTimerValue(void);
uint64_t _glfwPlatformGetTimerFrequency(void); uint64_t _glfwPlatformGetTimerFrequency(void);
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);
void _glfwPlatformPollEvents(void);
void _glfwPlatformWaitEvents(void);
void _glfwPlatformWaitEventsTimeout(double timeout);
void _glfwPlatformPostEmptyEvent(void);
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); GLFWbool _glfwPlatformCreateTls(_GLFWtls *tls);
void _glfwPlatformDestroyTls(_GLFWtls *tls); void _glfwPlatformDestroyTls(_GLFWtls *tls);
void *_glfwPlatformGetTls(_GLFWtls *tls); void *_glfwPlatformGetTls(_GLFWtls *tls);
@ -901,7 +961,6 @@ void* _glfwPlatformLoadModule(const char* path);
void _glfwPlatformFreeModule(void *module); void _glfwPlatformFreeModule(void *module);
GLFWproc _glfwPlatformGetModuleSymbol(void *module, const char *name); GLFWproc _glfwPlatformGetModuleSymbol(void *module, const char *name);
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////// GLFW event API ////// ////// GLFW event API //////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -909,21 +968,24 @@ GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name);
void _glfwInputWindowFocus(_GLFWwindow *window, GLFWbool focused); void _glfwInputWindowFocus(_GLFWwindow *window, GLFWbool focused);
void _glfwInputWindowPos(_GLFWwindow *window, int xpos, int ypos); void _glfwInputWindowPos(_GLFWwindow *window, int xpos, int ypos);
void _glfwInputWindowSize(_GLFWwindow *window, int width, int height); 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 _glfwInputFramebufferSize(_GLFWwindow *window, int width, int height);
void _glfwInputWindowContentScale(_GLFWwindow* window, void _glfwInputWindowContentScale(_GLFWwindow *window, float xscale,
float xscale, float yscale); float yscale);
void _glfwInputWindowIconify(_GLFWwindow *window, GLFWbool iconified); void _glfwInputWindowIconify(_GLFWwindow *window, GLFWbool iconified);
void _glfwInputWindowMaximize(_GLFWwindow *window, GLFWbool maximized); void _glfwInputWindowMaximize(_GLFWwindow *window, GLFWbool maximized);
void _glfwInputWindowDamage(_GLFWwindow *window); void _glfwInputWindowDamage(_GLFWwindow *window);
void _glfwInputWindowCloseRequest(_GLFWwindow *window); void _glfwInputWindowCloseRequest(_GLFWwindow *window);
void _glfwInputWindowMonitor(_GLFWwindow *window, _GLFWmonitor *monitor); void _glfwInputWindowMonitor(_GLFWwindow *window, _GLFWmonitor *monitor);
void _glfwInputKey(_GLFWwindow* window, void _glfwInputKey(_GLFWwindow *window, int key, int scancode, int action,
int key, int scancode, int action, int mods); int mods);
void _glfwInputChar(_GLFWwindow* window, void _glfwInputChar(_GLFWwindow *window, uint32_t codepoint, int mods,
uint32_t codepoint, int mods, GLFWbool plain); GLFWbool plain);
void _glfwInputScroll(_GLFWwindow *window, double xoffset, double yoffset); void _glfwInputScroll(_GLFWwindow *window, double xoffset, double yoffset);
void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods); void _glfwInputMouseClick(_GLFWwindow *window, int button, int action,
int mods);
void _glfwInputCursorPos(_GLFWwindow *window, double xpos, double ypos); void _glfwInputCursorPos(_GLFWwindow *window, double xpos, double ypos);
void _glfwInputCursorEnter(_GLFWwindow *window, GLFWbool entered); void _glfwInputCursorEnter(_GLFWwindow *window, GLFWbool entered);
void _glfwInputDrop(_GLFWwindow *window, int count, const char **names); void _glfwInputDrop(_GLFWwindow *window, int count, const char **names);
@ -942,14 +1004,14 @@ void _glfwInputError(int code, const char* format, ...)
void _glfwInputError(int code, const char *format, ...); void _glfwInputError(int code, const char *format, ...);
#endif #endif
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////// GLFW internal API ////// ////// GLFW internal API //////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
GLFWbool _glfwSelectPlatform(int platformID, _GLFWplatform *platform); GLFWbool _glfwSelectPlatform(int platformID, _GLFWplatform *platform);
GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions); GLFWbool _glfwStringInExtensionString(const char *string,
const char *extensions);
const _GLFWfbconfig *_glfwChooseFBConfig(const _GLFWfbconfig *desired, const _GLFWfbconfig *_glfwChooseFBConfig(const _GLFWfbconfig *desired,
const _GLFWfbconfig *alternatives, const _GLFWfbconfig *alternatives,
unsigned int count); unsigned int count);
@ -967,11 +1029,8 @@ void _glfwFreeGammaArrays(GLFWgammaramp* ramp);
void _glfwSplitBPP(int bpp, int *red, int *green, int *blue); void _glfwSplitBPP(int bpp, int *red, int *green, int *blue);
void _glfwInitGamepadMappings(void); void _glfwInitGamepadMappings(void);
_GLFWjoystick* _glfwAllocJoystick(const char* name, _GLFWjoystick *_glfwAllocJoystick(const char *name, const char *guid,
const char* guid, int axisCount, int buttonCount, int hatCount);
int axisCount,
int buttonCount,
int hatCount);
void _glfwFreeJoystick(_GLFWjoystick *js); void _glfwFreeJoystick(_GLFWjoystick *js);
void _glfwCenterCursorInContentArea(_GLFWwindow *window); void _glfwCenterCursorInContentArea(_GLFWwindow *window);
@ -983,8 +1042,8 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
#if defined(_GLFW_X11) #if defined(_GLFW_X11)
GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig *wndconfig, GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig *wndconfig,
const _GLFWctxconfig *ctxconfig, const _GLFWctxconfig *ctxconfig,
const _GLFWfbconfig* fbconfig, const _GLFWfbconfig *fbconfig, Visual **visual,
Visual** visual, int* depth); int *depth);
#endif /*_GLFW_X11*/ #endif /*_GLFW_X11*/
GLFWbool _glfwInitOSMesa(void); GLFWbool _glfwInitOSMesa(void);
@ -1009,4 +1068,3 @@ float _glfw_fmaxf(float a, float b);
void *_glfw_calloc(size_t count, size_t size); void *_glfw_calloc(size_t count, size_t size);
void *_glfw_realloc(void *pointer, size_t size); void *_glfw_realloc(void *pointer, size_t size);
void _glfw_free(void *pointer); void _glfw_free(void *pointer);

View File

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