Add glfw3impl.h, a single header implementation of GLFW

- assigned _glfw-qualified private names to all static symbols to avoid naming conflicts when including glfw3impl.h

- added casts as needed to compile glfw3impl.h as C++

- replaced sprintf with snprintf to avoid warnings from clang -Wall, (except on win32, where this provokes an appveyor failure `'snprintf' undefined`)

- Added a brief remark on `glfw3impl.h` to the `Compiling GLFW` section in `README.md`

- Added `Garett Bass` to `CONTRIBUTORS.md`
This commit is contained in:
Garett Bass 2024-01-06 15:25:22 -08:00 • committed by M374LX
parent 92dcf4ce74
commit 3ef1f2525d
36 changed files with 1365 additions and 1185 deletions

View file

@ -16,6 +16,7 @@ video tutorials.
- Luca Bacci
- Keith Bauer
- John Bartholomew
- Garett Bass
- Coşku Baş
- Bayemite
- Niklas Behrens

View file

@ -38,7 +38,41 @@ features, reviewing or testing code, debugging, proofreading docs, suggesting
features or fixing bugs.
## System requirements
## Compiling GLFW
GLFW itself requires only the headers and libraries for your OS and window
system. It does not need the headers for any context creation API (WGL, GLX,
EGL, NSGL, OSMesa) or rendering API (OpenGL, OpenGL ES, Vulkan) to enable
support for them.
GLFW supports compilation on Windows with Visual C++ 2010 and later, MinGW and
MinGW-w64, on macOS with Clang and on Linux and other Unix-like systems with GCC
and Clang. It will likely compile in other environments as well, but this is
not regularly tested.
There are [pre-compiled Windows binaries](https://www.glfw.org/download.html)
available for all supported compilers.
See the [compilation guide](https://www.glfw.org/docs/latest/compile.html) for
more information about how to compile GLFW yourself.
Alternatively, you can `#include <GLFW/glfw3impl.h>` in exactly one compilation
unit of a C or C++ project to compile the entire implementation directly into
your application, avoiding the need to separately compile and link with GLFW.
## Using GLFW
See the [documentation](https://www.glfw.org/docs/latest/) for tutorials, guides
and the API reference.
## Contributing to GLFW
See the [contribution
guide](https://github.com/glfw/glfw/blob/master/docs/CONTRIBUTING.md) for
more information.
GLFW supports Windows 7 and later and macOS 10.11 and later. On GNOME Wayland,
window decorations will be very basic unless the

105
include/GLFW/glfw3impl.h Normal file
View file

@ -0,0 +1,105 @@
/*************************************************************************
* GLFW 3.4 - www.glfw.org
* A library for OpenGL, window and input
*------------------------------------------------------------------------
* Copyright (c) 2002-2006 Marcus Geelnard
* Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
*************************************************************************/
#ifndef _glfw3impl_h_
#define _glfw3impl_h_
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_WIN32)
#define _GLFW_WIN32
// -D_CRT_SECURE_NO_WARNINGS
// -lgdi32
// -lshell32
// -luser32
#elif defined(__APPLE__)
#define _GLFW_COCOA
// -framework Cocoa
// -framework IOKit
// -framework QuartzCore
// -x objective-c
// or
// -x objective-c++
#endif
#if !defined(_GNU_SOURCE)
#define _GNU_SOURCE
#endif
#include "../../src/cocoa_init.m"
#include "../../src/cocoa_joystick.m"
#include "../../src/cocoa_monitor.m"
#include "../../src/cocoa_window.m"
#include "../../src/context.c"
#include "../../src/egl_context.c"
#include "../../src/glx_context.c"
#include "../../src/init.c"
#include "../../src/input.c"
#include "../../src/linux_joystick.c"
#include "../../src/macos_time.c"
#include "../../src/monitor.c"
#include "../../src/nsgl_context.m"
#include "../../src/null_init.c"
#include "../../src/null_joystick.c"
#include "../../src/null_monitor.c"
#include "../../src/null_window.c"
#include "../../src/osmesa_context.c"
#include "../../src/platform.c"
#include "../../src/posix_module.c"
#include "../../src/posix_poll.c"
#include "../../src/posix_thread.c"
#include "../../src/posix_time.c"
#include "../../src/vulkan.c"
#include "../../src/wgl_context.c"
#include "../../src/win32_init.c"
#include "../../src/win32_joystick.c"
#include "../../src/win32_module.c"
#include "../../src/win32_monitor.c"
#include "../../src/win32_thread.c"
#include "../../src/win32_time.c"
#include "../../src/win32_window.c"
#include "../../src/window.c"
#include "../../src/wl_init.c"
#include "../../src/wl_monitor.c"
#include "../../src/wl_window.c"
#include "../../src/x11_init.c"
#include "../../src/x11_monitor.c"
#include "../../src/x11_window.c"
#include "../../src/xkb_unicode.c"
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* _glfw3impl_h_ */

View file

@ -35,7 +35,7 @@
// Change to our application bundle's resources directory, if present
//
static void changeToResourcesDirectory(void)
static void _glfwChangeToResourcesDirectoryCocoa(void)
{
char resourcesPath[MAXPATHLEN];
@ -74,7 +74,7 @@ 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)
static void _glfwCreateMenuBarCocoa(void)
{
NSString* appName = nil;
NSDictionary* bundleInfo = [[NSBundle mainBundle] infoDictionary];
@ -175,7 +175,7 @@ static void createMenuBar(void)
// Create key code translation tables
//
static void createKeyTables(void)
static void _glfwCreateKeyTablesCocoa(void)
{
memset(_glfw.ns.keycodes, -1, sizeof(_glfw.ns.keycodes));
memset(_glfw.ns.scancodes, -1, sizeof(_glfw.ns.scancodes));
@ -305,7 +305,7 @@ static void createKeyTables(void)
// Retrieve Unicode data for the current keyboard layout
//
static GLFWbool updateUnicodeData(void)
static GLFWbool _glfwUpdateUnicodeDataCocoa(void)
{
if (_glfw.ns.inputSource)
{
@ -323,7 +323,8 @@ static GLFWbool updateUnicodeData(void)
}
_glfw.ns.unicodeData =
TISGetInputSourceProperty(_glfw.ns.inputSource,
(id)
TISGetInputSourceProperty((TISInputSourceRef) _glfw.ns.inputSource,
kTISPropertyUnicodeKeyLayoutData);
if (!_glfw.ns.unicodeData)
{
@ -337,7 +338,7 @@ static GLFWbool updateUnicodeData(void)
// Load HIToolbox.framework and the TIS symbols we need from it
//
static GLFWbool initializeTIS(void)
static GLFWbool _glfwInitializeTISCocoa(void)
{
// This works only because Cocoa has already loaded it properly
_glfw.ns.tis.bundle =
@ -350,15 +351,19 @@ static GLFWbool initializeTIS(void)
}
CFStringRef* kPropertyUnicodeKeyLayoutData =
(CFStringRef*)
CFBundleGetDataPointerForName(_glfw.ns.tis.bundle,
CFSTR("kTISPropertyUnicodeKeyLayoutData"));
_glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource =
(PFN_TISCopyCurrentKeyboardLayoutInputSource)
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
CFSTR("TISCopyCurrentKeyboardLayoutInputSource"));
_glfw.ns.tis.GetInputSourceProperty =
(PFN_TISGetInputSourceProperty)
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
CFSTR("TISGetInputSourceProperty"));
_glfw.ns.tis.GetKbdType =
(PFN_LMGetKbdType)
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
CFSTR("LMGetKbdType"));
@ -375,7 +380,7 @@ static GLFWbool initializeTIS(void)
_glfw.ns.tis.kPropertyUnicodeKeyLayoutData =
*kPropertyUnicodeKeyLayoutData;
return updateUnicodeData();
return _glfwUpdateUnicodeDataCocoa();
}
@interface GLFWHelper : NSObject
@ -385,7 +390,7 @@ static GLFWbool initializeTIS(void)
- (void)selectedKeyboardInputSourceChanged:(NSObject* )object
{
updateUnicodeData();
_glfwUpdateUnicodeDataCocoa();
}
- (void)doNothing:(id)object
@ -432,7 +437,7 @@ static GLFWbool initializeTIS(void)
topLevelObjects:&_glfw.ns.nibObjects];
}
else
createMenuBar();
_glfwCreateMenuBarCocoa();
}
}
@ -571,7 +576,7 @@ int _glfwInitCocoa(void)
handler:block];
if (_glfw.hints.init.ns.chdir)
changeToResourcesDirectory();
_glfwChangeToResourcesDirectoryCocoa();
// Press and Hold prevents some keys from emitting repeated characters
NSDictionary* defaults = @{@"ApplePressAndHoldEnabled":@NO};
@ -583,7 +588,7 @@ int _glfwInitCocoa(void)
name:NSTextInputContextKeyboardSelectionDidChangeNotification
object:nil];
createKeyTables();
_glfwCreateKeyTablesCocoa();
_glfw.ns.eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
if (!_glfw.ns.eventSource)
@ -591,7 +596,7 @@ int _glfwInitCocoa(void)
CGEventSourceSetLocalEventsSuppressionInterval(_glfw.ns.eventSource, 0.0);
if (!initializeTIS())
if (!_glfwInitializeTISCocoa())
return GLFW_FALSE;
_glfwPollMonitorsCocoa();

View file

@ -55,7 +55,7 @@ typedef struct _GLFWjoyelementNS
// Returns the value of the specified element of the specified joystick
//
static long getElementValue(_GLFWjoystick* js, _GLFWjoyelementNS* element)
static long _glfwGetElementValueCocoa(_GLFWjoystick* js, _GLFWjoyelementNS* element)
{
IOHIDValueRef valueRef;
long value = 0;
@ -75,12 +75,12 @@ static long getElementValue(_GLFWjoystick* js, _GLFWjoyelementNS* element)
// Comparison function for matching the SDL element order
//
static CFComparisonResult compareElements(const void* fp,
const void* sp,
void* user)
static CFComparisonResult _glfwCompareElementsCocoa(const void* fp,
const void* sp,
void* user)
{
const _GLFWjoyelementNS* fe = fp;
const _GLFWjoyelementNS* se = sp;
const _GLFWjoyelementNS* fe = (const _GLFWjoyelementNS*) fp;
const _GLFWjoyelementNS* se = (const _GLFWjoyelementNS*) sp;
if (fe->usage < se->usage)
return kCFCompareLessThan;
if (fe->usage > se->usage)
@ -94,7 +94,7 @@ static CFComparisonResult compareElements(const void* fp,
// Removes the specified joystick
//
static void closeJoystick(_GLFWjoystick* js)
static void _glfwCloseJoystickCocoa(_GLFWjoystick* js)
{
_glfwInputJoystick(js, GLFW_DISCONNECTED);
@ -115,10 +115,10 @@ static void closeJoystick(_GLFWjoystick* js)
// Callback for user-initiated joystick addition
//
static void matchCallback(void* context,
IOReturn result,
void* sender,
IOHIDDeviceRef device)
static void _glfwMatchCallbackCocoa(void* context,
IOReturn result,
void* sender,
IOHIDDeviceRef device)
{
int jid;
char name[256];
@ -149,7 +149,7 @@ static void matchCallback(void* context,
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey));
if (property)
{
CFStringGetCString(property,
CFStringGetCString((CFStringRef) property,
name,
sizeof(name),
kCFStringEncodingUTF8);
@ -159,27 +159,27 @@ static void matchCallback(void* context,
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey));
if (property)
CFNumberGetValue(property, kCFNumberSInt32Type, &vendor);
CFNumberGetValue((CFNumberRef) property, kCFNumberSInt32Type, &vendor);
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductIDKey));
if (property)
CFNumberGetValue(property, kCFNumberSInt32Type, &product);
CFNumberGetValue((CFNumberRef) property, kCFNumberSInt32Type, &product);
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVersionNumberKey));
if (property)
CFNumberGetValue(property, kCFNumberSInt32Type, &version);
CFNumberGetValue((CFNumberRef) property, kCFNumberSInt32Type, &version);
// Generate a joystick GUID that matches the SDL 2.0.5+ one
if (vendor && product)
{
sprintf(guid, "03000000%02x%02x0000%02x%02x0000%02x%02x0000",
snprintf(guid, sizeof(guid), "03000000%02x%02x0000%02x%02x0000%02x%02x0000",
(uint8_t) vendor, (uint8_t) (vendor >> 8),
(uint8_t) product, (uint8_t) (product >> 8),
(uint8_t) version, (uint8_t) (version >> 8));
}
else
{
sprintf(guid, "05000000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00",
snprintf(guid, sizeof(guid), "05000000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00",
name[0], name[1], name[2], name[3],
name[4], name[5], name[6], name[7],
name[8], name[9], name[10]);
@ -251,7 +251,7 @@ static void matchCallback(void* context,
if (target)
{
_GLFWjoyelementNS* element = _glfw_calloc(1, sizeof(_GLFWjoyelementNS));
_GLFWjoyelementNS* element = (_GLFWjoyelementNS*) _glfw_calloc(1, sizeof(_GLFWjoyelementNS));
element->native = native;
element->usage = usage;
element->index = (int) CFArrayGetCount(target);
@ -264,11 +264,11 @@ static void matchCallback(void* context,
CFRelease(elements);
CFArraySortValues(axes, CFRangeMake(0, CFArrayGetCount(axes)),
compareElements, NULL);
_glfwCompareElementsCocoa, NULL);
CFArraySortValues(buttons, CFRangeMake(0, CFArrayGetCount(buttons)),
compareElements, NULL);
_glfwCompareElementsCocoa, NULL);
CFArraySortValues(hats, CFRangeMake(0, CFArrayGetCount(hats)),
compareElements, NULL);
_glfwCompareElementsCocoa, NULL);
js = _glfwAllocJoystick(name, guid,
(int) CFArrayGetCount(axes),
@ -285,16 +285,16 @@ static void matchCallback(void* context,
// Callback for user-initiated joystick removal
//
static void removeCallback(void* context,
IOReturn result,
void* sender,
IOHIDDeviceRef device)
static void _glfwRemoveCallbackCocoa(void* context,
IOReturn result,
void* sender,
IOHIDDeviceRef device)
{
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
{
if (_glfw.joysticks[jid].connected && _glfw.joysticks[jid].ns.device == device)
{
closeJoystick(&_glfw.joysticks[jid]);
_glfwCloseJoystickCocoa(&_glfw.joysticks[jid]);
break;
}
}
@ -368,9 +368,9 @@ GLFWbool _glfwInitJoysticksCocoa(void)
CFRelease(matching);
IOHIDManagerRegisterDeviceMatchingCallback(_glfw.ns.hidManager,
&matchCallback, NULL);
&_glfwMatchCallbackCocoa, NULL);
IOHIDManagerRegisterDeviceRemovalCallback(_glfw.ns.hidManager,
&removeCallback, NULL);
&_glfwRemoveCallbackCocoa, NULL);
IOHIDManagerScheduleWithRunLoop(_glfw.ns.hidManager,
CFRunLoopGetMain(),
kCFRunLoopDefaultMode);
@ -387,7 +387,7 @@ void _glfwTerminateJoysticksCocoa(void)
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
{
if (_glfw.joysticks[jid].connected)
closeJoystick(&_glfw.joysticks[jid]);
_glfwCloseJoystickCocoa(&_glfw.joysticks[jid]);
}
if (_glfw.ns.hidManager)
@ -407,7 +407,7 @@ GLFWbool _glfwPollJoystickCocoa(_GLFWjoystick* js, int mode)
_GLFWjoyelementNS* axis = (_GLFWjoyelementNS*)
CFArrayGetValueAtIndex(js->ns.axes, i);
const long raw = getElementValue(js, axis);
const long raw = _glfwGetElementValueCocoa(js, axis);
// Perform auto calibration
if (raw < axis->minimum)
axis->minimum = raw;
@ -431,7 +431,7 @@ GLFWbool _glfwPollJoystickCocoa(_GLFWjoystick* js, int mode)
{
_GLFWjoyelementNS* button = (_GLFWjoyelementNS*)
CFArrayGetValueAtIndex(js->ns.buttons, i);
const char value = getElementValue(js, button) - button->minimum;
const char value = _glfwGetElementValueCocoa(js, button) - button->minimum;
const int state = (value > 0) ? GLFW_PRESS : GLFW_RELEASE;
_glfwInputJoystickButton(js, (int) i, state);
}
@ -453,7 +453,7 @@ GLFWbool _glfwPollJoystickCocoa(_GLFWjoystick* js, int mode)
_GLFWjoyelementNS* hat = (_GLFWjoyelementNS*)
CFArrayGetValueAtIndex(js->ns.hats, i);
long state = getElementValue(js, hat) - hat->minimum;
long state = _glfwGetElementValueCocoa(js, hat) - hat->minimum;
if (state < 0 || state > 8)
state = 8;
@ -476,7 +476,7 @@ void _glfwUpdateGamepadGUIDCocoa(char* guid)
{
char original[33];
strncpy(original, guid, sizeof(original) - 1);
sprintf(guid, "03000000%.4s0000%.4s000000000000",
snprintf(guid, sizeof(guid), "03000000%.4s0000%.4s000000000000",
original, original + 16);
}
}

View file

@ -40,7 +40,7 @@
// Get the name of the specified display, or NULL
//
static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
static char* _glfwGetMonitorNameCocoa(CGDirectDisplayID displayID, NSScreen* screen)
{
// IOKit doesn't work on Apple Silicon anymore
// Luckily, 10.15 introduced -[NSScreen localizedName].
@ -73,8 +73,10 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
kIODisplayOnlyPreferredName);
CFNumberRef vendorIDRef =
(CFNumberRef)
CFDictionaryGetValue(info, CFSTR(kDisplayVendorID));
CFNumberRef productIDRef =
(CFNumberRef)
CFDictionaryGetValue(info, CFSTR(kDisplayProductID));
if (!vendorIDRef || !productIDRef)
{
@ -102,6 +104,7 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
return _glfw_strdup("Display");
CFDictionaryRef names =
(CFDictionaryRef)
CFDictionaryGetValue(info, CFSTR(kDisplayProductName));
CFStringRef nameRef;
@ -117,7 +120,7 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
const CFIndex size =
CFStringGetMaximumSizeForEncoding(CFStringGetLength(nameRef),
kCFStringEncodingUTF8);
char* name = _glfw_calloc(size + 1, 1);
char* name = (char*) _glfw_calloc(size + 1, 1);
CFStringGetCString(nameRef, name, size, kCFStringEncodingUTF8);
CFRelease(info);
@ -126,7 +129,7 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
// Check whether the display mode should be included in enumeration
//
static GLFWbool modeIsGood(CGDisplayModeRef mode)
static GLFWbool _glfwModeIsGoodCocoa(CGDisplayModeRef mode)
{
uint32_t flags = CGDisplayModeGetIOFlags(mode);
@ -153,7 +156,7 @@ static GLFWbool modeIsGood(CGDisplayModeRef mode)
// Convert Core Graphics display mode to GLFW video mode
//
static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode,
static GLFWvidmode _glfwVidmodeFromCGDisplayModeCocoa(CGDisplayModeRef mode,
double fallbackRefreshRate)
{
GLFWvidmode result;
@ -188,7 +191,7 @@ static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode,
// Starts reservation for display fading
//
static CGDisplayFadeReservationToken beginFadeReservation(void)
static CGDisplayFadeReservationToken _glfwBeginFadeReservationCocoa(void)
{
CGDisplayFadeReservationToken token = kCGDisplayFadeReservationInvalidToken;
@ -206,7 +209,7 @@ static CGDisplayFadeReservationToken beginFadeReservation(void)
// Ends reservation for display fading
//
static void endFadeReservation(CGDisplayFadeReservationToken token)
static void _glfwEndFadeReservationCocoa(CGDisplayFadeReservationToken token)
{
if (token != kCGDisplayFadeReservationInvalidToken)
{
@ -221,7 +224,7 @@ static void endFadeReservation(CGDisplayFadeReservationToken token)
// Returns the display refresh rate queried from the I/O registry
//
static double getFallbackRefreshRate(CGDirectDisplayID displayID)
static double _glfwGetFallbackRefreshRateCocoa(CGDirectDisplayID displayID)
{
double refreshRate = 60.0;
@ -238,6 +241,7 @@ static double getFallbackRefreshRate(CGDirectDisplayID displayID)
while ((service = IOIteratorNext(it)) != 0)
{
const CFNumberRef indexRef =
(CFNumberRef)
IORegistryEntryCreateCFProperty(service,
CFSTR("IOFramebufferOpenGLIndex"),
kCFAllocatorDefault,
@ -253,11 +257,13 @@ static double getFallbackRefreshRate(CGDirectDisplayID displayID)
continue;
const CFNumberRef clockRef =
(CFNumberRef)
IORegistryEntryCreateCFProperty(service,
CFSTR("IOFBCurrentPixelClock"),
kCFAllocatorDefault,
kNilOptions);
const CFNumberRef countRef =
(CFNumberRef)
IORegistryEntryCreateCFProperty(service,
CFSTR("IOFBCurrentPixelCount"),
kCFAllocatorDefault,
@ -298,7 +304,7 @@ void _glfwPollMonitorsCocoa(void)
{
uint32_t displayCount;
CGGetOnlineDisplayList(0, NULL, &displayCount);
CGDirectDisplayID* displays = _glfw_calloc(displayCount, sizeof(CGDirectDisplayID));
CGDirectDisplayID* displays = (CGDirectDisplayID*) _glfw_calloc(displayCount, sizeof(CGDirectDisplayID));
CGGetOnlineDisplayList(displayCount, displays, &displayCount);
for (int i = 0; i < _glfw.monitorCount; i++)
@ -308,7 +314,7 @@ void _glfwPollMonitorsCocoa(void)
uint32_t disconnectedCount = _glfw.monitorCount;
if (disconnectedCount)
{
disconnected = _glfw_calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
disconnected = (_GLFWmonitor**) _glfw_calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
memcpy(disconnected,
_glfw.monitors,
_glfw.monitorCount * sizeof(_GLFWmonitor*));
@ -351,7 +357,7 @@ void _glfwPollMonitorsCocoa(void)
continue;
const CGSize size = CGDisplayScreenSize(displays[i]);
char* name = getMonitorName(displays[i], screen);
char* name = _glfwGetMonitorNameCocoa(displays[i], screen);
if (!name)
continue;
@ -364,7 +370,7 @@ void _glfwPollMonitorsCocoa(void)
CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displays[i]);
if (CGDisplayModeGetRefreshRate(mode) == 0.0)
monitor->ns.fallbackRefreshRate = getFallbackRefreshRate(displays[i]);
monitor->ns.fallbackRefreshRate = _glfwGetFallbackRefreshRateCocoa(displays[i]);
CGDisplayModeRelease(mode);
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
@ -398,11 +404,11 @@ void _glfwSetVideoModeCocoa(_GLFWmonitor* monitor, const GLFWvidmode* desired)
for (CFIndex i = 0; i < count; i++)
{
CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
if (!modeIsGood(dm))
if (!_glfwModeIsGoodCocoa(dm))
continue;
const GLFWvidmode mode =
vidmodeFromCGDisplayMode(dm, monitor->ns.fallbackRefreshRate);
_glfwVidmodeFromCGDisplayModeCocoa(dm, monitor->ns.fallbackRefreshRate);
if (_glfwCompareVideoModes(best, &mode) == 0)
{
native = dm;
@ -415,9 +421,9 @@ void _glfwSetVideoModeCocoa(_GLFWmonitor* monitor, const GLFWvidmode* desired)
if (monitor->ns.previousMode == NULL)
monitor->ns.previousMode = CGDisplayCopyDisplayMode(monitor->ns.displayID);
CGDisplayFadeReservationToken token = beginFadeReservation();
CGDisplayFadeReservationToken token = _glfwBeginFadeReservationCocoa();
CGDisplaySetDisplayMode(monitor->ns.displayID, native, NULL);
endFadeReservation(token);
_glfwEndFadeReservationCocoa(token);
}
CFRelease(modes);
@ -429,10 +435,10 @@ void _glfwRestoreVideoModeCocoa(_GLFWmonitor* monitor)
{
if (monitor->ns.previousMode)
{
CGDisplayFadeReservationToken token = beginFadeReservation();
CGDisplayFadeReservationToken token = _glfwBeginFadeReservationCocoa();
CGDisplaySetDisplayMode(monitor->ns.displayID,
monitor->ns.previousMode, NULL);
endFadeReservation(token);
_glfwEndFadeReservationCocoa(token);
CGDisplayModeRelease(monitor->ns.previousMode);
monitor->ns.previousMode = NULL;
@ -518,16 +524,16 @@ GLFWvidmode* _glfwGetVideoModesCocoa(_GLFWmonitor* monitor, int* count)
CFArrayRef modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
const CFIndex found = CFArrayGetCount(modes);
GLFWvidmode* result = _glfw_calloc(found, sizeof(GLFWvidmode));
GLFWvidmode* result = (GLFWvidmode*) _glfw_calloc(found, sizeof(GLFWvidmode));
for (CFIndex i = 0; i < found; i++)
{
CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
if (!modeIsGood(dm))
if (!_glfwModeIsGoodCocoa(dm))
continue;
const GLFWvidmode mode =
vidmodeFromCGDisplayMode(dm, monitor->ns.fallbackRefreshRate);
_glfwVidmodeFromCGDisplayModeCocoa(dm, monitor->ns.fallbackRefreshRate);
CFIndex j;
for (j = 0; j < *count; j++)
@ -561,7 +567,7 @@ GLFWbool _glfwGetVideoModeCocoa(_GLFWmonitor* monitor, GLFWvidmode *mode)
return GLFW_FALSE;
}
*mode = vidmodeFromCGDisplayMode(native, monitor->ns.fallbackRefreshRate);
*mode = _glfwVidmodeFromCGDisplayModeCocoa(native, monitor->ns.fallbackRefreshRate);
CGDisplayModeRelease(native);
return GLFW_TRUE;
@ -573,7 +579,7 @@ GLFWbool _glfwGetGammaRampCocoa(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
@autoreleasepool {
uint32_t size = CGDisplayGammaTableCapacity(monitor->ns.displayID);
CGGammaValue* values = _glfw_calloc(size * 3, sizeof(CGGammaValue));
CGGammaValue* values = (CGGammaValue*) _glfw_calloc(size * 3, sizeof(CGGammaValue));
CGGetDisplayTransferByTable(monitor->ns.displayID,
size,
@ -601,7 +607,7 @@ void _glfwSetGammaRampCocoa(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
{
@autoreleasepool {
CGGammaValue* values = _glfw_calloc(ramp->size * 3, sizeof(CGGammaValue));
CGGammaValue* values = (CGGammaValue*) _glfw_calloc(ramp->size * 3, sizeof(CGGammaValue));
for (unsigned int i = 0; i < ramp->size; i++)
{

View file

@ -296,5 +296,4 @@ void _glfwTerminateNSGL(void);
GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig);
void _glfwDestroyContextNSGL(_GLFWwindow* window);

View file

@ -40,7 +40,7 @@
// Returns whether the cursor is in the content area of the specified window
//
static GLFWbool cursorInContentArea(_GLFWwindow* window)
static GLFWbool _glfwCursorInContentAreaCocoa(_GLFWwindow* window)
{
const NSPoint pos = [window->ns.object mouseLocationOutsideOfEventStream];
return [window->ns.view mouse:pos inRect:[window->ns.view frame]];
@ -48,7 +48,7 @@ static GLFWbool cursorInContentArea(_GLFWwindow* window)
// Hides the cursor if not already hidden
//
static void hideCursor(_GLFWwindow* window)
static void _glfwHideCursorCocoa(_GLFWwindow* window)
{
if (!_glfw.ns.cursorHidden)
{
@ -59,7 +59,7 @@ static void hideCursor(_GLFWwindow* window)
// Shows the cursor if not already shown
//
static void showCursor(_GLFWwindow* window)
static void _glfwShowCursorCocoa(_GLFWwindow* window)
{
if (_glfw.ns.cursorHidden)
{
@ -70,11 +70,11 @@ static void showCursor(_GLFWwindow* window)
// Updates the cursor image according to its cursor mode
//
static void updateCursorImage(_GLFWwindow* window)
static void _glfwUpdateCursorImageCocoa(_GLFWwindow* window)
{
if (window->cursorMode == GLFW_CURSOR_NORMAL)
{
showCursor(window);
_glfwShowCursorCocoa(window);
if (window->cursor)
[(NSCursor*) window->cursor->ns.object set];
@ -82,12 +82,12 @@ static void updateCursorImage(_GLFWwindow* window)
[[NSCursor arrowCursor] set];
}
else
hideCursor(window);
_glfwHideCursorCocoa(window);
}
// Apply chosen cursor mode to a focused window
//
static void updateCursorMode(_GLFWwindow* window)
static void _glfwUpdateCursorModeCocoa(_GLFWwindow* window)
{
if (window->cursorMode == GLFW_CURSOR_DISABLED)
{
@ -108,13 +108,13 @@ static void updateCursorMode(_GLFWwindow* window)
// made in _glfwSetCursorPosCocoa as part of a workaround
}
if (cursorInContentArea(window))
updateCursorImage(window);
if (_glfwCursorInContentAreaCocoa(window))
_glfwUpdateCursorImageCocoa(window);
}
// Make the specified window and its video mode active on its monitor
//
static void acquireMonitor(_GLFWwindow* window)
static void _glfwAcquireMonitorCocoa(_GLFWwindow* window)
{
_glfwSetVideoModeCocoa(window->monitor, &window->videoMode);
const CGRect bounds = CGDisplayBounds(window->monitor->ns.displayID);
@ -130,7 +130,7 @@ static void acquireMonitor(_GLFWwindow* window)
// Remove the window and restore the original video mode
//
static void releaseMonitor(_GLFWwindow* window)
static void _glfwReleaseMonitorCocoa(_GLFWwindow* window)
{
if (window->monitor->window != window)
return;
@ -141,7 +141,7 @@ static void releaseMonitor(_GLFWwindow* window)
// Translates macOS key modifiers into GLFW ones
//
static int translateFlags(NSUInteger flags)
static int _glfwTranslateFlagsCocoa(NSUInteger flags)
{
int mods = 0;
@ -161,7 +161,7 @@ static int translateFlags(NSUInteger flags)
// Translates a macOS keycode to a GLFW keycode
//
static int translateKey(unsigned int key)
static int _glfwTranslateKeyCocoa(unsigned int key)
{
if (key >= sizeof(_glfw.ns.keycodes) / sizeof(_glfw.ns.keycodes[0]))
return GLFW_KEY_UNKNOWN;
@ -171,7 +171,7 @@ static int translateKey(unsigned int key)
// Translate a GLFW keycode to a Cocoa modifier flag
//
static NSUInteger translateKeyToModifierFlag(int key)
static NSUInteger _glfwTranslateKeyToModifierFlagCocoa(int key)
{
switch (key)
{
@ -196,7 +196,7 @@ static NSUInteger translateKeyToModifierFlag(int key)
// Defines a constant for empty ranges in NSTextInputClient
//
static const NSRange kEmptyRange = { NSNotFound, 0 };
static const NSRange _glfwKEmptyRangeCocoa = { NSNotFound, 0 };
//------------------------------------------------------------------------
@ -280,7 +280,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)windowDidMiniaturize:(NSNotification *)notification
{
if (window->monitor)
releaseMonitor(window);
_glfwReleaseMonitorCocoa(window);
_glfwInputWindowIconify(window, GLFW_TRUE);
}
@ -288,7 +288,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)windowDidDeminiaturize:(NSNotification *)notification
{
if (window->monitor)
acquireMonitor(window);
_glfwAcquireMonitorCocoa(window);
_glfwInputWindowIconify(window, GLFW_FALSE);
}
@ -299,7 +299,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
_glfwCenterCursorInContentArea(window);
_glfwInputWindowFocus(window, GLFW_TRUE);
updateCursorMode(window);
_glfwUpdateCursorModeCocoa(window);
}
- (void)windowDidResignKey:(NSNotification *)notification
@ -394,7 +394,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)cursorUpdate:(NSEvent *)event
{
updateCursorImage(window);
_glfwUpdateCursorImageCocoa(window);
}
- (BOOL)acceptsFirstMouse:(NSEvent *)event
@ -407,7 +407,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
_glfwInputMouseClick(window,
GLFW_MOUSE_BUTTON_LEFT,
GLFW_PRESS,
translateFlags([event modifierFlags]));
_glfwTranslateFlagsCocoa([event modifierFlags]));
}
- (void)mouseDragged:(NSEvent *)event
@ -420,7 +420,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
_glfwInputMouseClick(window,
GLFW_MOUSE_BUTTON_LEFT,
GLFW_RELEASE,
translateFlags([event modifierFlags]));
_glfwTranslateFlagsCocoa([event modifierFlags]));
}
- (void)mouseMoved:(NSEvent *)event
@ -452,7 +452,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
_glfwInputMouseClick(window,
GLFW_MOUSE_BUTTON_RIGHT,
GLFW_PRESS,
translateFlags([event modifierFlags]));
_glfwTranslateFlagsCocoa([event modifierFlags]));
}
- (void)rightMouseDragged:(NSEvent *)event
@ -465,7 +465,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
_glfwInputMouseClick(window,
GLFW_MOUSE_BUTTON_RIGHT,
GLFW_RELEASE,
translateFlags([event modifierFlags]));
_glfwTranslateFlagsCocoa([event modifierFlags]));
}
- (void)otherMouseDown:(NSEvent *)event
@ -473,7 +473,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
_glfwInputMouseClick(window,
(int) [event buttonNumber],
GLFW_PRESS,
translateFlags([event modifierFlags]));
_glfwTranslateFlagsCocoa([event modifierFlags]));
}
- (void)otherMouseDragged:(NSEvent *)event
@ -486,13 +486,13 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
_glfwInputMouseClick(window,
(int) [event buttonNumber],
GLFW_RELEASE,
translateFlags([event modifierFlags]));
_glfwTranslateFlagsCocoa([event modifierFlags]));
}
- (void)mouseExited:(NSEvent *)event
{
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
showCursor(window);
_glfwShowCursorCocoa(window);
_glfwInputCursorEnter(window, GLFW_FALSE);
}
@ -500,7 +500,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)mouseEntered:(NSEvent *)event
{
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
hideCursor(window);
_glfwHideCursorCocoa(window);
_glfwInputCursorEnter(window, GLFW_TRUE);
}
@ -562,8 +562,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)keyDown:(NSEvent *)event
{
const int key = translateKey([event keyCode]);
const int mods = translateFlags([event modifierFlags]);
const int key = _glfwTranslateKeyCocoa([event keyCode]);
const int mods = _glfwTranslateFlagsCocoa([event modifierFlags]);
_glfwInputKey(window, key, [event keyCode], GLFW_PRESS, mods);
@ -575,9 +575,9 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
int action;
const unsigned int modifierFlags =
[event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask;
const int key = translateKey([event keyCode]);
const int mods = translateFlags(modifierFlags);
const NSUInteger keyFlag = translateKeyToModifierFlag(key);
const int key = _glfwTranslateKeyCocoa([event keyCode]);
const int mods = _glfwTranslateFlagsCocoa(modifierFlags);
const NSUInteger keyFlag = _glfwTranslateKeyToModifierFlagCocoa(key);
if (keyFlag & modifierFlags)
{
@ -594,8 +594,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)keyUp:(NSEvent *)event
{
const int key = translateKey([event keyCode]);
const int mods = translateFlags([event modifierFlags]);
const int key = _glfwTranslateKeyCocoa([event keyCode]);
const int mods = _glfwTranslateFlagsCocoa([event modifierFlags]);
_glfwInputKey(window, key, [event keyCode], GLFW_RELEASE, mods);
}
@ -663,7 +663,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
const NSUInteger count = [urls count];
if (count)
{
char** paths = _glfw_calloc(count, sizeof(char*));
char** paths = (char**) _glfw_calloc(count, sizeof(char*));
for (NSUInteger i = 0; i < count; i++)
paths[i] = _glfw_strdup([urls[i] fileSystemRepresentation]);
@ -688,12 +688,12 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
if ([markedText length] > 0)
return NSMakeRange(0, [markedText length] - 1);
else
return kEmptyRange;
return _glfwKEmptyRangeCocoa;
}
- (NSRange)selectedRange
{
return kEmptyRange;
return _glfwKEmptyRangeCocoa;
}
- (void)setMarkedText:(id)string
@ -739,7 +739,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
{
NSString* characters;
NSEvent* event = [NSApp currentEvent];
const int mods = translateFlags([event modifierFlags]);
const int mods = _glfwTranslateFlagsCocoa([event modifierFlags]);
const int plain = !(mods & GLFW_MOD_SUPER);
if ([string isKindOfClass:[NSAttributedString class]])
@ -800,9 +800,9 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
// Create the Cocoa window
//
static GLFWbool createNativeWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWfbconfig* fbconfig)
static GLFWbool _glfwCreateNativeWindowCocoa(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWfbconfig* fbconfig)
{
window->ns.delegate = [[GLFWWindowDelegate alloc] initWithGlfwWindow:window];
if (window->ns.delegate == nil)
@ -952,7 +952,7 @@ GLFWbool _glfwCreateWindowCocoa(_GLFWwindow* window,
{
@autoreleasepool {
if (!createNativeWindow(window, wndconfig, fbconfig))
if (!_glfwCreateNativeWindowCocoa(window, wndconfig, fbconfig))
return GLFW_FALSE;
if (ctxconfig->client != GLFW_NO_API)
@ -995,7 +995,7 @@ GLFWbool _glfwCreateWindowCocoa(_GLFWwindow* window,
{
_glfwShowWindowCocoa(window);
_glfwFocusWindowCocoa(window);
acquireMonitor(window);
_glfwAcquireMonitorCocoa(window);
if (wndconfig->centerCursor)
_glfwCenterCursorInContentArea(window);
@ -1025,7 +1025,7 @@ void _glfwDestroyWindowCocoa(_GLFWwindow* window)
[window->ns.object orderOut:nil];
if (window->monitor)
releaseMonitor(window);
_glfwReleaseMonitorCocoa(window);
if (window->context.destroy)
window->context.destroy(window);
@ -1112,7 +1112,7 @@ void _glfwSetWindowSizeCocoa(_GLFWwindow* window, int width, int height)
if (window->monitor)
{
if (window->monitor->window == window)
acquireMonitor(window);
_glfwAcquireMonitorCocoa(window);
}
else
{
@ -1281,7 +1281,7 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window,
if (monitor)
{
if (monitor->window == window)
acquireMonitor(window);
_glfwAcquireMonitorCocoa(window);
}
else
{
@ -1299,7 +1299,7 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window,
}
if (window->monitor)
releaseMonitor(window);
_glfwReleaseMonitorCocoa(window);
_glfwInputWindowMonitor(window, monitor);
@ -1337,7 +1337,7 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window,
[window->ns.object setLevel:NSMainMenuWindowLevel + 1];
[window->ns.object setHasShadow:NO];
acquireMonitor(window);
_glfwAcquireMonitorCocoa(window);
}
else
{
@ -1634,7 +1634,7 @@ void _glfwSetCursorPosCocoa(_GLFWwindow* window, double x, double y)
{
@autoreleasepool {
updateCursorImage(window);
_glfwUpdateCursorImageCocoa(window);
const NSRect contentRect = [window->ns.view frame];
// NOTE: The returned location uses base 0,1 not 0,0
@ -1677,7 +1677,7 @@ void _glfwSetCursorModeCocoa(_GLFWwindow* window, int mode)
}
if (_glfwWindowFocusedCocoa(window))
updateCursorMode(window);
_glfwUpdateCursorModeCocoa(window);
} // autoreleasepool
}
@ -1700,7 +1700,8 @@ const char* _glfwGetScancodeNameCocoa(int scancode)
UniChar characters[4];
UniCharCount characterCount = 0;
if (UCKeyTranslate([(NSData*) _glfw.ns.unicodeData bytes],
if (UCKeyTranslate((const UCKeyboardLayout *)
[(NSData*) _glfw.ns.unicodeData bytes],
scancode,
kUCKeyActionDisplay,
0,
@ -1866,8 +1867,8 @@ void _glfwDestroyCursorCocoa(_GLFWcursor* cursor)
void _glfwSetCursorCocoa(_GLFWwindow* window, _GLFWcursor* cursor)
{
@autoreleasepool {
if (cursorInContentArea(window))
updateCursorImage(window);
if (_glfwCursorInContentAreaCocoa(window))
_glfwUpdateCursorImageCocoa(window);
} // autoreleasepool
}
@ -1929,7 +1930,7 @@ EGLenum _glfwGetEGLPlatformCocoa(EGLint** attribs)
if (type)
{
*attribs = _glfw_calloc(3, sizeof(EGLint));
*attribs = (EGLint*) _glfw_calloc(3, sizeof(EGLint));
(*attribs)[0] = EGL_PLATFORM_ANGLE_TYPE_ANGLE;
(*attribs)[1] = type;
(*attribs)[2] = EGL_NONE;
@ -1954,13 +1955,13 @@ void _glfwGetRequiredInstanceExtensionsCocoa(char** extensions)
{
if (_glfw.vk.KHR_surface && _glfw.vk.EXT_metal_surface)
{
extensions[0] = "VK_KHR_surface";
extensions[1] = "VK_EXT_metal_surface";
extensions[0] = (char*) "VK_KHR_surface";
extensions[1] = (char*) "VK_EXT_metal_surface";
}
else if (_glfw.vk.KHR_surface && _glfw.vk.MVK_macos_surface)
{
extensions[0] = "VK_KHR_surface";
extensions[1] = "VK_MVK_macos_surface";
extensions[0] = (char*) "VK_KHR_surface";
extensions[1] = (char*) "VK_MVK_macos_surface";
}
}

View file

@ -359,7 +359,7 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
window->context.source = ctxconfig->source;
window->context.client = GLFW_OPENGL_API;
previous = _glfwPlatformGetTls(&_glfw.contextSlot);
previous = (_GLFWwindow*) _glfwPlatformGetTls(&_glfw.contextSlot);
glfwMakeContextCurrent((GLFWwindow*) window);
if (_glfwPlatformGetTls(&_glfw.contextSlot) != window)
return GLFW_FALSE;
@ -625,7 +625,7 @@ GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle)
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFWwindow* previous;
previous = _glfwPlatformGetTls(&_glfw.contextSlot);
previous = (_GLFWwindow*) _glfwPlatformGetTls(&_glfw.contextSlot);
if (window && window->context.client == GLFW_NO_API)
{
@ -647,7 +647,7 @@ GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle)
GLFWAPI GLFWwindow* glfwGetCurrentContext(void)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return _glfwPlatformGetTls(&_glfw.contextSlot);
return (GLFWwindow*) _glfwPlatformGetTls(&_glfw.contextSlot);
}
GLFWAPI void glfwSwapBuffers(GLFWwindow* handle)
@ -673,7 +673,7 @@ GLFWAPI void glfwSwapInterval(int interval)
_GLFW_REQUIRE_INIT();
window = _glfwPlatformGetTls(&_glfw.contextSlot);
window = (_GLFWwindow*) _glfwPlatformGetTls(&_glfw.contextSlot);
if (!window)
{
_glfwInputError(GLFW_NO_CURRENT_CONTEXT,
@ -691,7 +691,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
window = _glfwPlatformGetTls(&_glfw.contextSlot);
window = (_GLFWwindow*) _glfwPlatformGetTls(&_glfw.contextSlot);
if (!window)
{
_glfwInputError(GLFW_NO_CURRENT_CONTEXT,
@ -757,7 +757,7 @@ GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname)
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
window = _glfwPlatformGetTls(&_glfw.contextSlot);
window = (_GLFWwindow*) _glfwPlatformGetTls(&_glfw.contextSlot);
if (!window)
{
_glfwInputError(GLFW_NO_CURRENT_CONTEXT,

View file

@ -35,7 +35,7 @@
// Return a description of the specified EGL error
//
static const char* getEGLErrorString(EGLint error)
static const char* _glfwGetErrorStringEGL(EGLint error)
{
switch (error)
{
@ -76,7 +76,7 @@ static const char* getEGLErrorString(EGLint error)
// Returns the specified attribute of the specified EGLConfig
//
static int getEGLConfigAttrib(EGLConfig config, int attrib)
static int _glfwGetConfigAttribEGL(EGLConfig config, int attrib)
{
int value;
eglGetConfigAttrib(_glfw.egl.display, config, attrib, &value);
@ -85,7 +85,7 @@ static int getEGLConfigAttrib(EGLConfig config, int attrib)
// Return the EGLConfig most closely matching the specified hints
//
static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
static GLFWbool _glfwChooseConfigEGL(const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig,
EGLConfig* result)
{
@ -123,10 +123,10 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
return GLFW_FALSE;
}
nativeConfigs = _glfw_calloc(nativeCount, sizeof(EGLConfig));
nativeConfigs = (EGLConfig*) _glfw_calloc(nativeCount, sizeof(EGLConfig));
eglGetConfigs(_glfw.egl.display, nativeConfigs, nativeCount, &nativeCount);
usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
usableConfigs = (_GLFWfbconfig*) _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
usableCount = 0;
for (i = 0; i < nativeCount; i++)
@ -135,10 +135,10 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
_GLFWfbconfig* u = usableConfigs + usableCount;
// Only consider RGB(A) EGLConfigs
if (getEGLConfigAttrib(n, EGL_COLOR_BUFFER_TYPE) != EGL_RGB_BUFFER)
if (_glfwGetConfigAttribEGL(n, EGL_COLOR_BUFFER_TYPE) != EGL_RGB_BUFFER)
continue;
if (!(getEGLConfigAttrib(n, EGL_SURFACE_TYPE) & surfaceTypeBit))
if (!(_glfwGetConfigAttribEGL(n, EGL_SURFACE_TYPE) & surfaceTypeBit))
continue;
#if defined(_GLFW_X11)
@ -147,7 +147,7 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
XVisualInfo vi = {0};
// Only consider EGLConfigs with associated Visuals
vi.visualid = getEGLConfigAttrib(n, EGL_NATIVE_VISUAL_ID);
vi.visualid = _glfwGetConfigAttribEGL(n, EGL_NATIVE_VISUAL_ID);
if (!vi.visualid)
continue;
@ -165,19 +165,19 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
}
#endif // _GLFW_X11
if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & apiBit))
if (!(_glfwGetConfigAttribEGL(n, EGL_RENDERABLE_TYPE) & apiBit))
{
wrongApiAvailable = GLFW_TRUE;
continue;
}
u->redBits = getEGLConfigAttrib(n, EGL_RED_SIZE);
u->greenBits = getEGLConfigAttrib(n, EGL_GREEN_SIZE);
u->blueBits = getEGLConfigAttrib(n, EGL_BLUE_SIZE);
u->redBits = _glfwGetConfigAttribEGL(n, EGL_RED_SIZE);
u->greenBits = _glfwGetConfigAttribEGL(n, EGL_GREEN_SIZE);
u->blueBits = _glfwGetConfigAttribEGL(n, EGL_BLUE_SIZE);
u->alphaBits = getEGLConfigAttrib(n, EGL_ALPHA_SIZE);
u->depthBits = getEGLConfigAttrib(n, EGL_DEPTH_SIZE);
u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE);
u->alphaBits = _glfwGetConfigAttribEGL(n, EGL_ALPHA_SIZE);
u->depthBits = _glfwGetConfigAttribEGL(n, EGL_DEPTH_SIZE);
u->stencilBits = _glfwGetConfigAttribEGL(n, EGL_STENCIL_SIZE);
#if defined(_GLFW_WAYLAND)
if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
@ -194,7 +194,7 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
}
#endif // _GLFW_WAYLAND
u->samples = getEGLConfigAttrib(n, EGL_SAMPLES);
u->samples = _glfwGetConfigAttribEGL(n, EGL_SAMPLES);
u->doublebuffer = fbconfig->doublebuffer;
u->handle = (uintptr_t) n;
@ -240,7 +240,7 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
return closest != NULL;
}
static void makeContextCurrentEGL(_GLFWwindow* window)
static void _glfwMakeContextCurrentEGL(_GLFWwindow* window)
{
if (window)
{
@ -251,7 +251,7 @@ static void makeContextCurrentEGL(_GLFWwindow* window)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: Failed to make context current: %s",
getEGLErrorString(eglGetError()));
_glfwGetErrorStringEGL(eglGetError()));
return;
}
@ -270,7 +270,7 @@ static void makeContextCurrentEGL(_GLFWwindow* window)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: Failed to clear current context: %s",
getEGLErrorString(eglGetError()));
_glfwGetErrorStringEGL(eglGetError()));
return;
}
}
@ -278,7 +278,7 @@ static void makeContextCurrentEGL(_GLFWwindow* window)
_glfwPlatformSetTls(&_glfw.contextSlot, window);
}
static void swapBuffersEGL(_GLFWwindow* window)
static void _glfwSwapBuffersEGL(_GLFWwindow* window)
{
if (window != _glfwPlatformGetTls(&_glfw.contextSlot))
{
@ -308,7 +308,7 @@ static void swapBuffersEGL(_GLFWwindow* window)
eglSwapBuffers(_glfw.egl.display, window->context.egl.surface);
}
static void swapIntervalEGL(int interval)
static void _glfwSwapIntervalEGL(int interval)
{
#if defined(_GLFW_WAYLAND)
if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
@ -323,7 +323,7 @@ static void swapIntervalEGL(int interval)
eglSwapInterval(_glfw.egl.display, interval);
}
static int extensionSupportedEGL(const char* extension)
static int _glfwExtensionSupportedEGL(const char* extension)
{
const char* extensions = eglQueryString(_glfw.egl.display, EGL_EXTENSIONS);
if (extensions)
@ -335,7 +335,7 @@ static int extensionSupportedEGL(const char* extension)
return GLFW_FALSE;
}
static GLFWglproc getProcAddressEGL(const char* procname)
static GLFWglproc _glfwGetProcAddressEGL(const char* procname)
{
const GLFWglproc proc = (GLFWglproc) eglGetProcAddress(procname);
if (proc)
@ -352,7 +352,7 @@ static GLFWglproc getProcAddressEGL(const char* procname)
return NULL;
}
static void destroyContextEGL(_GLFWwindow* window)
static void _glfwDestroyContextEGL(_GLFWwindow* window)
{
// NOTE: Do not unload libGL.so.1 while the X11 display is still open,
// as it will make XCloseDisplay segfault
@ -534,7 +534,7 @@ GLFWbool _glfwInitEGL(void)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to get EGL display: %s",
getEGLErrorString(eglGetError()));
_glfwGetErrorStringEGL(eglGetError()));
_glfwTerminateEGL();
return GLFW_FALSE;
@ -544,24 +544,24 @@ GLFWbool _glfwInitEGL(void)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to initialize EGL: %s",
getEGLErrorString(eglGetError()));
_glfwGetErrorStringEGL(eglGetError()));
_glfwTerminateEGL();
return GLFW_FALSE;
}
_glfw.egl.KHR_create_context =
extensionSupportedEGL("EGL_KHR_create_context");
_glfwExtensionSupportedEGL("EGL_KHR_create_context");
_glfw.egl.KHR_create_context_no_error =
extensionSupportedEGL("EGL_KHR_create_context_no_error");
_glfwExtensionSupportedEGL("EGL_KHR_create_context_no_error");
_glfw.egl.KHR_gl_colorspace =
extensionSupportedEGL("EGL_KHR_gl_colorspace");
_glfwExtensionSupportedEGL("EGL_KHR_gl_colorspace");
_glfw.egl.KHR_get_all_proc_addresses =
extensionSupportedEGL("EGL_KHR_get_all_proc_addresses");
_glfwExtensionSupportedEGL("EGL_KHR_get_all_proc_addresses");
_glfw.egl.KHR_context_flush_control =
extensionSupportedEGL("EGL_KHR_context_flush_control");
_glfwExtensionSupportedEGL("EGL_KHR_context_flush_control");
_glfw.egl.EXT_present_opaque =
extensionSupportedEGL("EGL_EXT_present_opaque");
_glfwExtensionSupportedEGL("EGL_EXT_present_opaque");
return GLFW_TRUE;
}
@ -608,7 +608,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
if (ctxconfig->share)
share = ctxconfig->share->context.egl.handle;
if (!chooseEGLConfig(ctxconfig, fbconfig, &config))
if (!_glfwChooseConfigEGL(ctxconfig, fbconfig, &config))
return GLFW_FALSE;
if (ctxconfig->client == GLFW_OPENGL_ES_API)
@ -617,7 +617,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to bind OpenGL ES: %s",
getEGLErrorString(eglGetError()));
_glfwGetErrorStringEGL(eglGetError()));
return GLFW_FALSE;
}
}
@ -627,7 +627,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to bind OpenGL: %s",
getEGLErrorString(eglGetError()));
_glfwGetErrorStringEGL(eglGetError()));
return GLFW_FALSE;
}
}
@ -713,7 +713,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"EGL: Failed to create context: %s",
getEGLErrorString(eglGetError()));
_glfwGetErrorStringEGL(eglGetError()));
return GLFW_FALSE;
}
@ -771,7 +771,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: Failed to create window surface: %s",
getEGLErrorString(eglGetError()));
_glfwGetErrorStringEGL(eglGetError()));
return GLFW_FALSE;
}
@ -862,12 +862,12 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
}
}
window->context.makeCurrent = makeContextCurrentEGL;
window->context.swapBuffers = swapBuffersEGL;
window->context.swapInterval = swapIntervalEGL;
window->context.extensionSupported = extensionSupportedEGL;
window->context.getProcAddress = getProcAddressEGL;
window->context.destroy = destroyContextEGL;
window->context.makeCurrent = _glfwMakeContextCurrentEGL;
window->context.swapBuffers = _glfwSwapBuffersEGL;
window->context.swapInterval = _glfwSwapIntervalEGL;
window->context.extensionSupported = _glfwExtensionSupportedEGL;
window->context.getProcAddress = _glfwGetProcAddressEGL;
window->context.destroy = _glfwDestroyContextEGL;
return GLFW_TRUE;
}
@ -888,7 +888,7 @@ GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig,
EGLint visualID = 0, count = 0;
const long vimask = VisualScreenMask | VisualIDMask;
if (!chooseEGLConfig(ctxconfig, fbconfig, &native))
if (!_glfwChooseConfigEGL(ctxconfig, fbconfig, &native))
return GLFW_FALSE;
eglGetConfigAttrib(_glfw.egl.display, native,

View file

@ -40,7 +40,7 @@
// Returns the specified attribute of the specified GLXFBConfig
//
static int getGLXFBConfigAttrib(GLXFBConfig fbconfig, int attrib)
static int _glfwGetConfigAttribGLX(GLXFBConfig fbconfig, int attrib)
{
int value;
glXGetFBConfigAttrib(_glfw.x11.display, fbconfig, attrib, &value);
@ -49,7 +49,7 @@ static int getGLXFBConfigAttrib(GLXFBConfig fbconfig, int attrib)
// Return the GLXFBConfig most closely matching the specified hints
//
static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
static GLFWbool _glfwChooseConfigGLX(const _GLFWfbconfig* desired,
GLXFBConfig* result)
{
GLXFBConfig* nativeConfigs;
@ -82,17 +82,17 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
_GLFWfbconfig* u = usableConfigs + usableCount;
// Only consider RGBA GLXFBConfigs
if (!(getGLXFBConfigAttrib(n, GLX_RENDER_TYPE) & GLX_RGBA_BIT))
if (!(_glfwGetConfigAttribGLX(n, GLX_RENDER_TYPE) & GLX_RGBA_BIT))
continue;
// Only consider window GLXFBConfigs
if (!(getGLXFBConfigAttrib(n, GLX_DRAWABLE_TYPE) & GLX_WINDOW_BIT))
if (!(_glfwGetConfigAttribGLX(n, GLX_DRAWABLE_TYPE) & GLX_WINDOW_BIT))
{
if (trustWindowBit)
continue;
}
if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER) != desired->doublebuffer)
if (_glfwGetConfigAttribGLX(n, GLX_DOUBLEBUFFER) != desired->doublebuffer)
continue;
if (desired->transparent)
@ -105,27 +105,27 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
}
}
u->redBits = getGLXFBConfigAttrib(n, GLX_RED_SIZE);
u->greenBits = getGLXFBConfigAttrib(n, GLX_GREEN_SIZE);
u->blueBits = getGLXFBConfigAttrib(n, GLX_BLUE_SIZE);
u->redBits = _glfwGetConfigAttribGLX(n, GLX_RED_SIZE);
u->greenBits = _glfwGetConfigAttribGLX(n, GLX_GREEN_SIZE);
u->blueBits = _glfwGetConfigAttribGLX(n, GLX_BLUE_SIZE);
u->alphaBits = getGLXFBConfigAttrib(n, GLX_ALPHA_SIZE);
u->depthBits = getGLXFBConfigAttrib(n, GLX_DEPTH_SIZE);
u->stencilBits = getGLXFBConfigAttrib(n, GLX_STENCIL_SIZE);
u->alphaBits = _glfwGetConfigAttribGLX(n, GLX_ALPHA_SIZE);
u->depthBits = _glfwGetConfigAttribGLX(n, GLX_DEPTH_SIZE);
u->stencilBits = _glfwGetConfigAttribGLX(n, GLX_STENCIL_SIZE);
u->accumRedBits = getGLXFBConfigAttrib(n, GLX_ACCUM_RED_SIZE);
u->accumGreenBits = getGLXFBConfigAttrib(n, GLX_ACCUM_GREEN_SIZE);
u->accumBlueBits = getGLXFBConfigAttrib(n, GLX_ACCUM_BLUE_SIZE);
u->accumAlphaBits = getGLXFBConfigAttrib(n, GLX_ACCUM_ALPHA_SIZE);
u->accumRedBits = _glfwGetConfigAttribGLX(n, GLX_ACCUM_RED_SIZE);
u->accumGreenBits = _glfwGetConfigAttribGLX(n, GLX_ACCUM_GREEN_SIZE);
u->accumBlueBits = _glfwGetConfigAttribGLX(n, GLX_ACCUM_BLUE_SIZE);
u->accumAlphaBits = _glfwGetConfigAttribGLX(n, GLX_ACCUM_ALPHA_SIZE);
u->auxBuffers = getGLXFBConfigAttrib(n, GLX_AUX_BUFFERS);
u->stereo = getGLXFBConfigAttrib(n, GLX_STEREO);
u->auxBuffers = _glfwGetConfigAttribGLX(n, GLX_AUX_BUFFERS);
u->stereo = _glfwGetConfigAttribGLX(n, GLX_STEREO);
if (_glfw.glx.ARB_multisample)
u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES);
u->samples = _glfwGetConfigAttribGLX(n, GLX_SAMPLES);
if (_glfw.glx.ARB_framebuffer_sRGB || _glfw.glx.EXT_framebuffer_sRGB)
u->sRGB = getGLXFBConfigAttrib(n, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB);
u->sRGB = _glfwGetConfigAttribGLX(n, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB);
u->handle = (uintptr_t) n;
usableCount++;
@ -143,7 +143,7 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
// Create the OpenGL context using legacy API
//
static GLXContext createLegacyContextGLX(_GLFWwindow* window,
static GLXContext _glfwCreateLegacyContextGLX(_GLFWwindow* window,
GLXFBConfig fbconfig,
GLXContext share)
{
@ -154,7 +154,7 @@ static GLXContext createLegacyContextGLX(_GLFWwindow* window,
True);
}
static void makeContextCurrentGLX(_GLFWwindow* window)
static void _glfwMakeContextCurrentGLX(_GLFWwindow* window)
{
if (window)
{
@ -180,12 +180,12 @@ static void makeContextCurrentGLX(_GLFWwindow* window)
_glfwPlatformSetTls(&_glfw.contextSlot, window);
}
static void swapBuffersGLX(_GLFWwindow* window)
static void _glfwSwapBuffersGLX(_GLFWwindow* window)
{
glXSwapBuffers(_glfw.x11.display, window->context.glx.window);
}
static void swapIntervalGLX(int interval)
static void _glfwSwapIntervalGLX(int interval)
{
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
assert(window != NULL);
@ -205,7 +205,7 @@ static void swapIntervalGLX(int interval)
}
}
static int extensionSupportedGLX(const char* extension)
static int _glfwExtensionSupportedGLX(const char* extension)
{
const char* extensions =
glXQueryExtensionsString(_glfw.x11.display, _glfw.x11.screen);
@ -218,7 +218,7 @@ static int extensionSupportedGLX(const char* extension)
return GLFW_FALSE;
}
static GLFWglproc getProcAddressGLX(const char* procname)
static GLFWglproc _glfwGetProcAddressGLX(const char* procname)
{
if (_glfw.glx.GetProcAddress)
return _glfw.glx.GetProcAddress((const GLubyte*) procname);
@ -231,7 +231,7 @@ static GLFWglproc getProcAddressGLX(const char* procname)
}
}
static void destroyContextGLX(_GLFWwindow* window)
static void _glfwDestroyContextGLX(_GLFWwindow* window)
{
if (window->context.glx.window)
{
@ -359,64 +359,64 @@ GLFWbool _glfwInitGLX(void)
return GLFW_FALSE;
}
if (extensionSupportedGLX("GLX_EXT_swap_control"))
if (_glfwExtensionSupportedGLX("GLX_EXT_swap_control"))
{
_glfw.glx.SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)
getProcAddressGLX("glXSwapIntervalEXT");
_glfwGetProcAddressGLX("glXSwapIntervalEXT");
if (_glfw.glx.SwapIntervalEXT)
_glfw.glx.EXT_swap_control = true;
}
if (extensionSupportedGLX("GLX_SGI_swap_control"))
if (_glfwExtensionSupportedGLX("GLX_SGI_swap_control"))
{
_glfw.glx.SwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)
getProcAddressGLX("glXSwapIntervalSGI");
_glfwGetProcAddressGLX("glXSwapIntervalSGI");
if (_glfw.glx.SwapIntervalSGI)
_glfw.glx.SGI_swap_control = true;
}
if (extensionSupportedGLX("GLX_MESA_swap_control"))
if (_glfwExtensionSupportedGLX("GLX_MESA_swap_control"))
{
_glfw.glx.SwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)
getProcAddressGLX("glXSwapIntervalMESA");
_glfwGetProcAddressGLX("glXSwapIntervalMESA");
if (_glfw.glx.SwapIntervalMESA)
_glfw.glx.MESA_swap_control = true;
}
if (extensionSupportedGLX("GLX_ARB_multisample"))
if (_glfwExtensionSupportedGLX("GLX_ARB_multisample"))
_glfw.glx.ARB_multisample = true;
if (extensionSupportedGLX("GLX_ARB_framebuffer_sRGB"))
if (_glfwExtensionSupportedGLX("GLX_ARB_framebuffer_sRGB"))
_glfw.glx.ARB_framebuffer_sRGB = true;
if (extensionSupportedGLX("GLX_EXT_framebuffer_sRGB"))
if (_glfwExtensionSupportedGLX("GLX_EXT_framebuffer_sRGB"))
_glfw.glx.EXT_framebuffer_sRGB = true;
if (extensionSupportedGLX("GLX_ARB_create_context"))
if (_glfwExtensionSupportedGLX("GLX_ARB_create_context"))
{
_glfw.glx.CreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
getProcAddressGLX("glXCreateContextAttribsARB");
_glfwGetProcAddressGLX("glXCreateContextAttribsARB");
if (_glfw.glx.CreateContextAttribsARB)
_glfw.glx.ARB_create_context = true;
}
if (extensionSupportedGLX("GLX_ARB_create_context_robustness"))
if (_glfwExtensionSupportedGLX("GLX_ARB_create_context_robustness"))
_glfw.glx.ARB_create_context_robustness = true;
if (extensionSupportedGLX("GLX_ARB_create_context_profile"))
if (_glfwExtensionSupportedGLX("GLX_ARB_create_context_profile"))
_glfw.glx.ARB_create_context_profile = true;
if (extensionSupportedGLX("GLX_EXT_create_context_es2_profile"))
if (_glfwExtensionSupportedGLX("GLX_EXT_create_context_es2_profile"))
_glfw.glx.EXT_create_context_es2_profile = true;
if (extensionSupportedGLX("GLX_ARB_create_context_no_error"))
if (_glfwExtensionSupportedGLX("GLX_ARB_create_context_no_error"))
_glfw.glx.ARB_create_context_no_error = true;
if (extensionSupportedGLX("GLX_ARB_context_flush_control"))
if (_glfwExtensionSupportedGLX("GLX_ARB_context_flush_control"))
_glfw.glx.ARB_context_flush_control = true;
return GLFW_TRUE;
@ -449,7 +449,7 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
if (ctxconfig->share)
share = ctxconfig->share->context.glx.handle;
if (!chooseGLXFBConfig(fbconfig, &native))
if (!_glfwChooseConfigGLX(fbconfig, &native))
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"GLX: Failed to find a suitable GLXFBConfig");
@ -589,14 +589,14 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
ctxconfig->forward == GLFW_FALSE)
{
window->context.glx.handle =
createLegacyContextGLX(window, native, share);
_glfwCreateLegacyContextGLX(window, native, share);
}
}
}
else
{
window->context.glx.handle =
createLegacyContextGLX(window, native, share);
_glfwCreateLegacyContextGLX(window, native, share);
}
_glfwReleaseErrorHandlerX11();
@ -617,12 +617,12 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
window->context.glx.fbconfig = native;
window->context.makeCurrent = makeContextCurrentGLX;
window->context.swapBuffers = swapBuffersGLX;
window->context.swapInterval = swapIntervalGLX;
window->context.extensionSupported = extensionSupportedGLX;
window->context.getProcAddress = getProcAddressGLX;
window->context.destroy = destroyContextGLX;
window->context.makeCurrent = _glfwMakeContextCurrentGLX;
window->context.swapBuffers = _glfwSwapBuffersGLX;
window->context.swapInterval = _glfwSwapIntervalGLX;
window->context.extensionSupported = _glfwExtensionSupportedGLX;
window->context.getProcAddress = _glfwGetProcAddressGLX;
window->context.destroy = _glfwDestroyContextGLX;
return GLFW_TRUE;
}
@ -639,7 +639,7 @@ GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig,
GLXFBConfig native;
XVisualInfo* result;
if (!chooseGLXFBConfig(fbconfig, &native))
if (!_glfwChooseConfigGLX(fbconfig, &native))
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"GLX: Failed to find a suitable GLXFBConfig");

View file

@ -70,28 +70,28 @@ static _GLFWinitconfig _glfwInitHints =
// The allocation function used when no custom allocator is set
//
static void* defaultAllocate(size_t size, void* user)
static void* _glfwDefaultAllocate(size_t size, void* user)
{
return malloc(size);
}
// The deallocation function used when no custom allocator is set
//
static void defaultDeallocate(void* block, void* user)
static void _glfwDefaultDeallocate(void* block, void* user)
{
free(block);
}
// The reallocation function used when no custom allocator is set
//
static void* defaultReallocate(void* block, size_t size, void* user)
static void* _glfwDefaultReallocate(void* block, size_t size, void* user)
{
return realloc(block, size);
}
// Terminate the library
//
static void terminate(void)
static void _glfwTerminate(void)
{
int i;
@ -205,8 +205,8 @@ char** _glfwParseUriList(char* text, int* count)
(*count)++;
path = _glfw_calloc(strlen(line) + 1, 1);
paths = _glfw_realloc(paths, *count * sizeof(char*));
path = (char*) _glfw_calloc(strlen(line) + 1, 1);
paths = (char**) _glfw_realloc(paths, *count * sizeof(char*));
paths[*count - 1] = path;
while (*line)
@ -231,7 +231,7 @@ char** _glfwParseUriList(char* text, int* count)
char* _glfw_strdup(const char* source)
{
const size_t length = strlen(source);
char* result = _glfw_calloc(length + 1, 1);
char* result = (char*) _glfw_calloc(length + 1, 1);
strcpy(result, source);
return result;
}
@ -357,10 +357,10 @@ void _glfwInputError(int code, const char* format, ...)
if (_glfw.initialized)
{
error = _glfwPlatformGetTls(&_glfw.errorSlot);
error = (_GLFWerror*) _glfwPlatformGetTls(&_glfw.errorSlot);
if (!error)
{
error = _glfw_calloc(1, sizeof(_GLFWerror));
error = (_GLFWerror*) _glfw_calloc(1, sizeof(_GLFWerror));
_glfwPlatformSetTls(&_glfw.errorSlot, error);
_glfwPlatformLockMutex(&_glfw.errorLock);
error->next = _glfw.errorListHead;
@ -394,9 +394,9 @@ GLFWAPI int glfwInit(void)
_glfw.allocator = _glfwInitAllocator;
if (!_glfw.allocator.allocate)
{
_glfw.allocator.allocate = defaultAllocate;
_glfw.allocator.reallocate = defaultReallocate;
_glfw.allocator.deallocate = defaultDeallocate;
_glfw.allocator.allocate = _glfwDefaultAllocate;
_glfw.allocator.reallocate = _glfwDefaultReallocate;
_glfw.allocator.deallocate = _glfwDefaultDeallocate;
}
if (!_glfwSelectPlatform(_glfw.hints.init.platformID, &_glfw.platform))
@ -404,7 +404,7 @@ GLFWAPI int glfwInit(void)
if (!_glfw.platform.init())
{
terminate();
_glfwTerminate();
return GLFW_FALSE;
}
@ -412,7 +412,7 @@ GLFWAPI int glfwInit(void)
!_glfwPlatformCreateTls(&_glfw.errorSlot) ||
!_glfwPlatformCreateTls(&_glfw.contextSlot))
{
terminate();
_glfwTerminate();
return GLFW_FALSE;
}
@ -434,7 +434,7 @@ GLFWAPI void glfwTerminate(void)
if (!_glfw.initialized)
return;
terminate();
_glfwTerminate();
}
GLFWAPI void glfwInitHint(int hint, int value)
@ -505,7 +505,7 @@ GLFWAPI int glfwGetError(const char** description)
*description = NULL;
if (_glfw.initialized)
error = _glfwPlatformGetTls(&_glfw.errorSlot);
error = (_GLFWerror*) _glfwPlatformGetTls(&_glfw.errorSlot);
else
error = &_glfwMainThreadError;

View file

@ -51,7 +51,7 @@
// Initializes the platform joystick API if it has not been already
//
static GLFWbool initJoysticks(void)
static GLFWbool _glfwInitJoysticks(void)
{
if (!_glfw.joysticksInitialized)
{
@ -67,7 +67,7 @@ static GLFWbool initJoysticks(void)
// Finds a mapping based on joystick GUID
//
static _GLFWmapping* findMapping(const char* guid)
static _GLFWmapping* _glfwFindMapping(const char* guid)
{
int i;
@ -82,8 +82,8 @@ static _GLFWmapping* findMapping(const char* guid)
// Checks whether a gamepad mapping element is present in the hardware
//
static GLFWbool isValidElementForJoystick(const _GLFWmapelement* e,
const _GLFWjoystick* js)
static GLFWbool _glfwIsValidElementForJoystick(const _GLFWmapelement* e,
const _GLFWjoystick* js)
{
if (e->type == _GLFW_JOYSTICK_HATBIT && (e->index >> 4) >= js->hatCount)
return GLFW_FALSE;
@ -97,22 +97,22 @@ static GLFWbool isValidElementForJoystick(const _GLFWmapelement* e,
// Finds a mapping based on joystick GUID and verifies element indices
//
static _GLFWmapping* findValidMapping(const _GLFWjoystick* js)
static _GLFWmapping* _glfwFindValidMapping(const _GLFWjoystick* js)
{
_GLFWmapping* mapping = findMapping(js->guid);
_GLFWmapping* mapping = _glfwFindMapping(js->guid);
if (mapping)
{
int i;
for (i = 0; i <= GLFW_GAMEPAD_BUTTON_LAST; i++)
{
if (!isValidElementForJoystick(mapping->buttons + i, js))
if (!_glfwIsValidElementForJoystick(mapping->buttons + i, js))
return NULL;
}
for (i = 0; i <= GLFW_GAMEPAD_AXIS_LAST; i++)
{
if (!isValidElementForJoystick(mapping->axes + i, js))
if (!_glfwIsValidElementForJoystick(mapping->axes + i, js))
return NULL;
}
}
@ -122,7 +122,7 @@ static _GLFWmapping* findValidMapping(const _GLFWjoystick* js)
// Parses an SDL_GameControllerDB line and adds it to the mapping list
//
static GLFWbool parseMapping(_GLFWmapping* mapping, const char* string)
static GLFWbool _glfwParseMapping(_GLFWmapping* mapping, const char* string)
{
const char* c = string;
size_t i, length;
@ -486,11 +486,11 @@ void _glfwInitGamepadMappings(void)
{
size_t i;
const size_t count = sizeof(_glfwDefaultMappings) / sizeof(char*);
_glfw.mappings = _glfw_calloc(count, sizeof(_GLFWmapping));
_glfw.mappings = (_GLFWmapping*) _glfw_calloc(count, sizeof(_GLFWmapping));
for (i = 0; i < count; i++)
{
if (parseMapping(&_glfw.mappings[_glfw.mappingCount], _glfwDefaultMappings[i]))
if (_glfwParseMapping(&_glfw.mappings[_glfw.mappingCount], _glfwDefaultMappings[i]))
_glfw.mappingCount++;
}
}
@ -517,16 +517,16 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
js = _glfw.joysticks + jid;
js->allocated = GLFW_TRUE;
js->axes = _glfw_calloc(axisCount, sizeof(float));
js->buttons = _glfw_calloc(buttonCount + (size_t) hatCount * 4, 1);
js->hats = _glfw_calloc(hatCount, 1);
js->axes = (float*) _glfw_calloc(axisCount, sizeof(float));
js->buttons = (unsigned char*) _glfw_calloc(buttonCount + (size_t) hatCount * 4, 1);
js->hats = (unsigned char*) _glfw_calloc(hatCount, 1);
js->axisCount = axisCount;
js->buttonCount = buttonCount;
js->hatCount = hatCount;
strncpy(js->name, name, sizeof(js->name) - 1);
strncpy(js->guid, guid, sizeof(js->guid) - 1);
js->mapping = findValidMapping(js);
js->mapping = _glfwFindValidMapping(js);
return js;
}
@ -854,7 +854,7 @@ GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot)
return NULL;
}
cursor = _glfw_calloc(1, sizeof(_GLFWcursor));
cursor = (_GLFWcursor*) _glfw_calloc(1, sizeof(_GLFWcursor));
cursor->next = _glfw.cursorListHead;
_glfw.cursorListHead = cursor;
@ -888,7 +888,7 @@ GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape)
return NULL;
}
cursor = _glfw_calloc(1, sizeof(_GLFWcursor));
cursor = (_GLFWcursor*) _glfw_calloc(1, sizeof(_GLFWcursor));
cursor->next = _glfw.cursorListHead;
_glfw.cursorListHead = cursor;
@ -1056,7 +1056,7 @@ GLFWAPI int glfwJoystickPresent(int jid)
return GLFW_FALSE;
}
if (!initJoysticks())
if (!_glfwInitJoysticks())
return GLFW_FALSE;
js = _glfw.joysticks + jid;
@ -1084,7 +1084,7 @@ GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count)
return NULL;
}
if (!initJoysticks())
if (!_glfwInitJoysticks())
return NULL;
js = _glfw.joysticks + jid;
@ -1116,7 +1116,7 @@ GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count)
return NULL;
}
if (!initJoysticks())
if (!_glfwInitJoysticks())
return NULL;
js = _glfw.joysticks + jid;
@ -1152,7 +1152,7 @@ GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count)
return NULL;
}
if (!initJoysticks())
if (!_glfwInitJoysticks())
return NULL;
js = _glfw.joysticks + jid;
@ -1181,7 +1181,7 @@ GLFWAPI const char* glfwGetJoystickName(int jid)
return NULL;
}
if (!initJoysticks())
if (!_glfwInitJoysticks())
return NULL;
js = _glfw.joysticks + jid;
@ -1209,7 +1209,7 @@ GLFWAPI const char* glfwGetJoystickGUID(int jid)
return NULL;
}
if (!initJoysticks())
if (!_glfwInitJoysticks())
return NULL;
js = _glfw.joysticks + jid;
@ -1258,7 +1258,7 @@ GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (!initJoysticks())
if (!_glfwInitJoysticks())
return NULL;
_GLFW_SWAP(GLFWjoystickfun, _glfw.callbacks.joystick, cbfun);
@ -1290,15 +1290,16 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string)
memcpy(line, c, length);
line[length] = '\0';
if (parseMapping(&mapping, line))
if (_glfwParseMapping(&mapping, line))
{
_GLFWmapping* previous = findMapping(mapping.guid);
_GLFWmapping* previous = _glfwFindMapping(mapping.guid);
if (previous)
*previous = mapping;
else
{
_glfw.mappingCount++;
_glfw.mappings =
(_GLFWmapping*)
_glfw_realloc(_glfw.mappings,
sizeof(_GLFWmapping) * _glfw.mappingCount);
_glfw.mappings[_glfw.mappingCount - 1] = mapping;
@ -1319,7 +1320,7 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string)
{
_GLFWjoystick* js = _glfw.joysticks + jid;
if (js->connected)
js->mapping = findValidMapping(js);
js->mapping = _glfwFindValidMapping(js);
}
return GLFW_TRUE;
@ -1340,7 +1341,7 @@ GLFWAPI int glfwJoystickIsGamepad(int jid)
return GLFW_FALSE;
}
if (!initJoysticks())
if (!_glfwInitJoysticks())
return GLFW_FALSE;
js = _glfw.joysticks + jid;
@ -1368,7 +1369,7 @@ GLFWAPI const char* glfwGetGamepadName(int jid)
return NULL;
}
if (!initJoysticks())
if (!_glfwInitJoysticks())
return NULL;
js = _glfw.joysticks + jid;
@ -1403,7 +1404,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
return GLFW_FALSE;
}
if (!initJoysticks())
if (!_glfwInitJoysticks())
return GLFW_FALSE;
js = _glfw.joysticks + jid;

View file

@ -48,7 +48,7 @@
// Apply an EV_KEY event to the specified joystick
//
static void handleKeyEvent(_GLFWjoystick* js, int code, int value)
static void _glfwHandleKeyEventLinux(_GLFWjoystick* js, int code, int value)
{
_glfwInputJoystickButton(js,
js->linjs.keyMap[code - BTN_MISC],
@ -57,7 +57,7 @@ static void handleKeyEvent(_GLFWjoystick* js, int code, int value)
// Apply an EV_ABS event to the specified joystick
//
static void handleAbsEvent(_GLFWjoystick* js, int code, int value)
static void _glfwHandleAbsEventLinux(_GLFWjoystick* js, int code, int value)
{
const int index = js->linjs.absMap[code];
@ -105,7 +105,7 @@ static void handleAbsEvent(_GLFWjoystick* js, int code, int value)
// Poll state of absolute axes
//
static void pollAbsState(_GLFWjoystick* js)
static void _glfwPollAbsStateLinux(_GLFWjoystick* js)
{
for (int code = 0; code < ABS_CNT; code++)
{
@ -117,15 +117,15 @@ static void pollAbsState(_GLFWjoystick* js)
if (ioctl(js->linjs.fd, EVIOCGABS(code), info) < 0)
continue;
handleAbsEvent(js, code, info->value);
_glfwHandleAbsEventLinux(js, code, info->value);
}
}
#define isBitSet(bit, arr) (arr[(bit) / 8] & (1 << ((bit) % 8)))
#define _glfwIsBitSet(bit, arr) (arr[(bit) / 8] & (1 << ((bit) % 8)))
// Attempt to open the specified joystick device
//
static GLFWbool openJoystickDevice(const char* path)
static GLFWbool _glfwOpenJoystickDeviceLinux(const char* path)
{
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
{
@ -158,7 +158,7 @@ static GLFWbool openJoystickDevice(const char* path)
}
// Ensure this device supports the events expected of a joystick
if (!isBitSet(EV_ABS, evBits))
if (!_glfwIsBitSet(EV_ABS, evBits))
{
close(linjs.fd);
return GLFW_FALSE;
@ -174,7 +174,7 @@ static GLFWbool openJoystickDevice(const char* path)
// Generate a joystick GUID that matches the SDL 2.0.5+ one
if (id.vendor && id.product && id.version)
{
sprintf(guid, "%02x%02x0000%02x%02x0000%02x%02x0000%02x%02x0000",
snprintf(guid, sizeof(guid), "%02x%02x0000%02x%02x0000%02x%02x0000%02x%02x0000",
id.bustype & 0xff, id.bustype >> 8,
id.vendor & 0xff, id.vendor >> 8,
id.product & 0xff, id.product >> 8,
@ -182,7 +182,7 @@ static GLFWbool openJoystickDevice(const char* path)
}
else
{
sprintf(guid, "%02x%02x0000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00",
snprintf(guid, sizeof(guid), "%02x%02x0000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00",
id.bustype & 0xff, id.bustype >> 8,
name[0], name[1], name[2], name[3],
name[4], name[5], name[6], name[7],
@ -193,7 +193,7 @@ static GLFWbool openJoystickDevice(const char* path)
for (int code = BTN_MISC; code < KEY_CNT; code++)
{
if (!isBitSet(code, keyBits))
if (!_glfwIsBitSet(code, keyBits))
continue;
linjs.keyMap[code - BTN_MISC] = buttonCount;
@ -203,7 +203,7 @@ static GLFWbool openJoystickDevice(const char* path)
for (int code = 0; code < ABS_CNT; code++)
{
linjs.absMap[code] = -1;
if (!isBitSet(code, absBits))
if (!_glfwIsBitSet(code, absBits))
continue;
if (code >= ABS_HAT0X && code <= ABS_HAT3Y)
@ -234,17 +234,17 @@ static GLFWbool openJoystickDevice(const char* path)
strncpy(linjs.path, path, sizeof(linjs.path) - 1);
memcpy(&js->linjs, &linjs, sizeof(linjs));
pollAbsState(js);
_glfwPollAbsStateLinux(js);
_glfwInputJoystick(js, GLFW_CONNECTED);
return GLFW_TRUE;
}
#undef isBitSet
#undef _glfwIsBitSet
// Frees all resources associated with the specified joystick
//
static void closeJoystick(_GLFWjoystick* js)
static void _glfwCloseJoystickLinux(_GLFWjoystick* js)
{
_glfwInputJoystick(js, GLFW_DISCONNECTED);
close(js->linjs.fd);
@ -253,7 +253,7 @@ static void closeJoystick(_GLFWjoystick* js)
// Lexically compare joysticks by name; used by qsort
//
static int compareJoysticks(const void* fp, const void* sp)
static int _glfwCompareJoysticksLinux(const void* fp, const void* sp)
{
const _GLFWjoystick* fj = fp;
const _GLFWjoystick* sj = sp;
@ -288,14 +288,14 @@ void _glfwDetectJoystickConnectionLinux(void)
snprintf(path, sizeof(path), "/dev/input/%s", e->name);
if (e->mask & (IN_CREATE | IN_ATTRIB))
openJoystickDevice(path);
_glfwOpenJoystickDeviceLinux(path);
else if (e->mask & IN_DELETE)
{
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
{
if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0)
{
closeJoystick(_glfw.joysticks + jid);
_glfwCloseJoystickLinux(_glfw.joysticks + jid);
break;
}
}
@ -350,7 +350,7 @@ GLFWbool _glfwInitJoysticksLinux(void)
snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
if (openJoystickDevice(path))
if (_glfwOpenJoystickDeviceLinux(path))
count++;
}
@ -359,7 +359,7 @@ GLFWbool _glfwInitJoysticksLinux(void)
// Continue with no joysticks if enumeration fails
qsort(_glfw.joysticks, count, sizeof(_GLFWjoystick), compareJoysticks);
qsort(_glfw.joysticks, count, sizeof(_GLFWjoystick), _glfwCompareJoysticksLinux);
return GLFW_TRUE;
}
@ -369,7 +369,7 @@ void _glfwTerminateJoysticksLinux(void)
{
_GLFWjoystick* js = _glfw.joysticks + jid;
if (js->connected)
closeJoystick(js);
_glfwCloseJoystickLinux(js);
}
if (_glfw.linjs.inotify > 0)
@ -396,7 +396,7 @@ GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode)
{
// Reset the joystick slot if the device was disconnected
if (errno == ENODEV)
closeJoystick(js);
_glfwCloseJoystickLinux(js);
break;
}
@ -408,7 +408,7 @@ GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode)
else if (e.code == SYN_REPORT)
{
_glfw.linjs.dropped = GLFW_FALSE;
pollAbsState(js);
_glfwPollAbsStateLinux(js);
}
}
@ -416,9 +416,9 @@ GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode)
continue;
if (e.type == EV_KEY)
handleKeyEvent(js, e.code, e.value);
_glfwHandleKeyEventLinux(js, e.code, e.value);
else if (e.type == EV_ABS)
handleAbsEvent(js, e.code, e.value);
_glfwHandleAbsEventLinux(js, e.code, e.value);
}
return js->connected;

View file

@ -37,10 +37,10 @@
// Lexically compare video modes, used by qsort
//
static int compareVideoModes(const void* fp, const void* sp)
static int _glfwQsortCompareVideoModes(const void* fp, const void* sp)
{
const GLFWvidmode* fm = fp;
const GLFWvidmode* sm = sp;
const GLFWvidmode* fm = (const GLFWvidmode*) fp;
const GLFWvidmode* sm = (const GLFWvidmode*) sp;
const int fbpp = fm->redBits + fm->greenBits + fm->blueBits;
const int sbpp = sm->redBits + sm->greenBits + sm->blueBits;
const int farea = fm->width * fm->height;
@ -64,7 +64,7 @@ static int compareVideoModes(const void* fp, const void* sp)
// Retrieves the available modes for the specified monitor
//
static GLFWbool refreshVideoModes(_GLFWmonitor* monitor)
static GLFWbool _glfwRefreshVideoModes(_GLFWmonitor* monitor)
{
int modeCount;
GLFWvidmode* modes;
@ -76,7 +76,7 @@ static GLFWbool refreshVideoModes(_GLFWmonitor* monitor)
if (!modes)
return GLFW_FALSE;
qsort(modes, modeCount, sizeof(GLFWvidmode), compareVideoModes);
qsort(modes, modeCount, sizeof(GLFWvidmode), _glfwQsortCompareVideoModes);
_glfw_free(monitor->modes);
monitor->modes = modes;
@ -102,6 +102,7 @@ void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement)
{
_glfw.monitorCount++;
_glfw.monitors =
(_GLFWmonitor**)
_glfw_realloc(_glfw.monitors,
sizeof(_GLFWmonitor*) * _glfw.monitorCount);
@ -170,7 +171,7 @@ void _glfwInputMonitorWindow(_GLFWmonitor* monitor, _GLFWwindow* window)
//
_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
{
_GLFWmonitor* monitor = _glfw_calloc(1, sizeof(_GLFWmonitor));
_GLFWmonitor* monitor = (_GLFWmonitor*) _glfw_calloc(1, sizeof(_GLFWmonitor));
monitor->widthMM = widthMM;
monitor->heightMM = heightMM;
@ -199,9 +200,9 @@ void _glfwFreeMonitor(_GLFWmonitor* monitor)
//
void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size)
{
ramp->red = _glfw_calloc(size, sizeof(unsigned short));
ramp->green = _glfw_calloc(size, sizeof(unsigned short));
ramp->blue = _glfw_calloc(size, sizeof(unsigned short));
ramp->red = (unsigned short*) _glfw_calloc(size, sizeof(unsigned short));
ramp->green = (unsigned short*) _glfw_calloc(size, sizeof(unsigned short));
ramp->blue = (unsigned short*) _glfw_calloc(size, sizeof(unsigned short));
ramp->size = size;
}
@ -228,7 +229,7 @@ const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor,
const GLFWvidmode* current;
const GLFWvidmode* closest = NULL;
if (!refreshVideoModes(monitor))
if (!_glfwRefreshVideoModes(monitor))
return NULL;
for (i = 0; i < monitor->modeCount; i++)
@ -272,7 +273,7 @@ const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor,
//
int _glfwCompareVideoModes(const GLFWvidmode* fm, const GLFWvidmode* sm)
{
return compareVideoModes(fm, sm);
return _glfwQsortCompareVideoModes(fm, sm);
}
// Splits a color depth into red, green and blue bit depths
@ -441,7 +442,7 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
assert(monitor != NULL);
if (!refreshVideoModes(monitor))
if (!_glfwRefreshVideoModes(monitor))
return NULL;
*count = monitor->modeCount;
@ -485,7 +486,7 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
if (!original)
return;
values = _glfw_calloc(original->size, sizeof(unsigned short));
values = (unsigned short*) _glfw_calloc(original->size, sizeof(unsigned short));
for (i = 0; i < original->size; i++)
{

View file

@ -32,7 +32,7 @@
#include <math.h>
#include <assert.h>
static void makeContextCurrentNSGL(_GLFWwindow* window)
static void _glfwMakeContextCurrentNSGL(_GLFWwindow* window)
{
@autoreleasepool {
@ -46,7 +46,7 @@ static void makeContextCurrentNSGL(_GLFWwindow* window)
} // autoreleasepool
}
static void swapBuffersNSGL(_GLFWwindow* window)
static void _glfwSwapBuffersNSGL(_GLFWwindow* window)
{
@autoreleasepool {
@ -77,11 +77,11 @@ static void swapBuffersNSGL(_GLFWwindow* window)
} // autoreleasepool
}
static void swapIntervalNSGL(int interval)
static void _glfwSwapIntervalNSGL(int interval)
{
@autoreleasepool {
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
_GLFWwindow* window = (_GLFWwindow*) _glfwPlatformGetTls(&_glfw.contextSlot);
assert(window != NULL);
[window->context.nsgl.object setValues:&interval
@ -90,19 +90,19 @@ static void swapIntervalNSGL(int interval)
} // autoreleasepool
}
static int extensionSupportedNSGL(const char* extension)
static int _glfwExtensionSupportedNSGL(const char* extension)
{
// There are no NSGL extensions
return GLFW_FALSE;
}
static GLFWglproc getProcAddressNSGL(const char* procname)
static GLFWglproc _glfwGetProcAddressNSGL(const char* procname)
{
CFStringRef symbolName = CFStringCreateWithCString(kCFAllocatorDefault,
procname,
kCFStringEncodingASCII);
GLFWglproc symbol = CFBundleGetFunctionPointerForName(_glfw.nsgl.framework,
GLFWglproc symbol = (GLFWglproc) CFBundleGetFunctionPointerForName(_glfw.nsgl.framework,
symbolName);
CFRelease(symbolName);
@ -110,7 +110,7 @@ static GLFWglproc getProcAddressNSGL(const char* procname)
return symbol;
}
static void destroyContextNSGL(_GLFWwindow* window)
static void _glfwDestroyContextNSGL(_GLFWwindow* window)
{
@autoreleasepool {
@ -336,12 +336,12 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
[window->context.nsgl.object setView:window->ns.view];
window->context.makeCurrent = makeContextCurrentNSGL;
window->context.swapBuffers = swapBuffersNSGL;
window->context.swapInterval = swapIntervalNSGL;
window->context.extensionSupported = extensionSupportedNSGL;
window->context.getProcAddress = getProcAddressNSGL;
window->context.destroy = destroyContextNSGL;
window->context.makeCurrent = _glfwMakeContextCurrentNSGL;
window->context.swapBuffers = _glfwSwapBuffersNSGL;
window->context.swapInterval = _glfwSwapIntervalNSGL;
window->context.extensionSupported = _glfwExtensionSupportedNSGL;
window->context.getProcAddress = _glfwGetProcAddressNSGL;
window->context.destroy = _glfwDestroyContextNSGL;
return GLFW_TRUE;
}

View file

@ -33,7 +33,7 @@
// The the sole (fake) video mode of our (sole) fake monitor
//
static GLFWvidmode getVideoMode(void)
static GLFWvidmode _glfwGetDefaultVideoModeNull(void)
{
GLFWvidmode mode;
mode.width = 1920;
@ -52,7 +52,7 @@ static GLFWvidmode getVideoMode(void)
void _glfwPollMonitorsNull(void)
{
const float dpi = 141.f;
const GLFWvidmode mode = getVideoMode();
const GLFWvidmode mode = _glfwGetDefaultVideoModeNull();
_GLFWmonitor* monitor = _glfwAllocMonitor("Null SuperNoop 0",
(int) (mode.width * 25.4f / dpi),
(int) (mode.height * 25.4f / dpi));
@ -89,7 +89,7 @@ void _glfwGetMonitorWorkareaNull(_GLFWmonitor* monitor,
int* xpos, int* ypos,
int* width, int* height)
{
const GLFWvidmode mode = getVideoMode();
const GLFWvidmode mode = _glfwGetDefaultVideoModeNull();
if (xpos)
*xpos = 0;
@ -103,15 +103,15 @@ void _glfwGetMonitorWorkareaNull(_GLFWmonitor* monitor,
GLFWvidmode* _glfwGetVideoModesNull(_GLFWmonitor* monitor, int* found)
{
GLFWvidmode* mode = _glfw_calloc(1, sizeof(GLFWvidmode));
*mode = getVideoMode();
GLFWvidmode* mode = (GLFWvidmode*) _glfw_calloc(1, sizeof(GLFWvidmode));
*mode = _glfwGetDefaultVideoModeNull();
*found = 1;
return mode;
}
GLFWbool _glfwGetVideoModeNull(_GLFWmonitor* monitor, GLFWvidmode* mode)
{
*mode = getVideoMode();
*mode = _glfwGetDefaultVideoModeNull();
return GLFW_TRUE;
}

View file

@ -30,7 +30,7 @@
#include <stdlib.h>
#include <string.h>
static void applySizeLimits(_GLFWwindow* window, int* width, int* height)
static void _glfwApplySizeLimitsNull(_GLFWwindow* window, int* width, int* height)
{
if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE)
{
@ -49,7 +49,7 @@ static void applySizeLimits(_GLFWwindow* window, int* width, int* height)
*height = _glfw_max(*height, window->maxheight);
}
static void fitToMonitor(_GLFWwindow* window)
static void _glfwFitToMonitorNull(_GLFWwindow* window)
{
GLFWvidmode mode;
_glfwGetVideoModeNull(window->monitor, &mode);
@ -60,12 +60,12 @@ static void fitToMonitor(_GLFWwindow* window)
window->null.height = mode.height;
}
static void acquireMonitor(_GLFWwindow* window)
static void _glfwAcquireMonitorNull(_GLFWwindow* window)
{
_glfwInputMonitorWindow(window->monitor, window);
}
static void releaseMonitor(_GLFWwindow* window)
static void _glfwReleaseMonitorNull(_GLFWwindow* window)
{
if (window->monitor->window != window)
return;
@ -73,12 +73,12 @@ static void releaseMonitor(_GLFWwindow* window)
_glfwInputMonitorWindow(window->monitor, NULL);
}
static int createNativeWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWfbconfig* fbconfig)
static int _glfwCreateNativeWindowNull(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWfbconfig* fbconfig)
{
if (window->monitor)
fitToMonitor(window);
_glfwFitToMonitorNull(window);
else
{
if (wndconfig->xpos == GLFW_ANY_POSITION && wndconfig->ypos == GLFW_ANY_POSITION)
@ -116,7 +116,7 @@ GLFWbool _glfwCreateWindowNull(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
if (!createNativeWindow(window, wndconfig, fbconfig))
if (!_glfwCreateNativeWindowNull(window, wndconfig, fbconfig))
return GLFW_FALSE;
if (ctxconfig->client != GLFW_NO_API)
@ -148,7 +148,7 @@ GLFWbool _glfwCreateWindowNull(_GLFWwindow* window,
{
_glfwShowWindowNull(window);
_glfwFocusWindowNull(window);
acquireMonitor(window);
_glfwAcquireMonitorNull(window);
if (wndconfig->centerCursor)
_glfwCenterCursorInContentArea(window);
@ -169,7 +169,7 @@ GLFWbool _glfwCreateWindowNull(_GLFWwindow* window,
void _glfwDestroyWindowNull(_GLFWwindow* window)
{
if (window->monitor)
releaseMonitor(window);
_glfwReleaseMonitorNull(window);
if (_glfw.null.focusedWindow == window)
_glfw.null.focusedWindow = NULL;
@ -204,15 +204,15 @@ void _glfwSetWindowMonitorNull(_GLFWwindow* window,
}
if (window->monitor)
releaseMonitor(window);
_glfwReleaseMonitorNull(window);
_glfwInputWindowMonitor(window, monitor);
if (window->monitor)
{
window->null.visible = GLFW_TRUE;
acquireMonitor(window);
fitToMonitor(window);
_glfwAcquireMonitorNull(window);
_glfwFitToMonitorNull(window);
}
else
{
@ -271,7 +271,7 @@ void _glfwSetWindowSizeLimitsNull(_GLFWwindow* window,
{
int width = window->null.width;
int height = window->null.height;
applySizeLimits(window, &width, &height);
_glfwApplySizeLimitsNull(window, &width, &height);
_glfwSetWindowSizeNull(window, width, height);
}
@ -279,7 +279,7 @@ void _glfwSetWindowAspectRatioNull(_GLFWwindow* window, int n, int d)
{
int width = window->null.width;
int height = window->null.height;
applySizeLimits(window, &width, &height);
_glfwApplySizeLimitsNull(window, &width, &height);
_glfwSetWindowSizeNull(window, width, height);
}
@ -341,7 +341,7 @@ void _glfwIconifyWindowNull(_GLFWwindow* window)
_glfwInputWindowIconify(window, GLFW_TRUE);
if (window->monitor)
releaseMonitor(window);
_glfwReleaseMonitorNull(window);
}
}
@ -353,7 +353,7 @@ void _glfwRestoreWindowNull(_GLFWwindow* window)
_glfwInputWindowIconify(window, GLFW_FALSE);
if (window->monitor)
acquireMonitor(window);
_glfwAcquireMonitorNull(window);
}
else if (window->null.maximized)
{

View file

@ -31,7 +31,7 @@
#include <string.h>
#include <assert.h>
static void makeContextCurrentOSMesa(_GLFWwindow* window)
static void _glfwMakeContextCurrentOSMesa(_GLFWwindow* window)
{
if (window)
{
@ -65,12 +65,12 @@ static void makeContextCurrentOSMesa(_GLFWwindow* window)
_glfwPlatformSetTls(&_glfw.contextSlot, window);
}
static GLFWglproc getProcAddressOSMesa(const char* procname)
static GLFWglproc _glfwGetProcAddressOSMesa(const char* procname)
{
return (GLFWglproc) OSMesaGetProcAddress(procname);
}
static void destroyContextOSMesa(_GLFWwindow* window)
static void _glfwDestroyContextOSMesa(_GLFWwindow* window)
{
if (window->context.osmesa.handle)
{
@ -86,17 +86,17 @@ static void destroyContextOSMesa(_GLFWwindow* window)
}
}
static void swapBuffersOSMesa(_GLFWwindow* window)
static void _glfwSwapBuffersOSMesa(_GLFWwindow* window)
{
// No double buffering on OSMesa
}
static void swapIntervalOSMesa(int interval)
static void _glfwSwapIntervalOSMesa(int interval)
{
// No swap interval on OSMesa
}
static int extensionSupportedOSMesa(const char* extension)
static int _glfwExtensionSupportedOSMesa(const char* extension)
{
// OSMesa does not have extensions
return GLFW_FALSE;
@ -271,12 +271,12 @@ GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window,
return GLFW_FALSE;
}
window->context.makeCurrent = makeContextCurrentOSMesa;
window->context.swapBuffers = swapBuffersOSMesa;
window->context.swapInterval = swapIntervalOSMesa;
window->context.extensionSupported = extensionSupportedOSMesa;
window->context.getProcAddress = getProcAddressOSMesa;
window->context.destroy = destroyContextOSMesa;
window->context.makeCurrent = _glfwMakeContextCurrentOSMesa;
window->context.swapBuffers = _glfwSwapBuffersOSMesa;
window->context.swapInterval = _glfwSwapIntervalOSMesa;
window->context.extensionSupported = _glfwExtensionSupportedOSMesa;
window->context.getProcAddress = _glfwGetProcAddressOSMesa;
window->context.destroy = _glfwDestroyContextOSMesa;
return GLFW_TRUE;
}

View file

@ -47,7 +47,7 @@ void _glfwPlatformFreeModule(void* module)
GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name)
{
return dlsym(module, name);
return (GLFWproc) dlsym(module, name);
}
#endif // GLFW_BUILD_POSIX_MODULE

View file

@ -24,7 +24,9 @@
//
//========================================================================
#define _GNU_SOURCE
#if !defined(_GNU_SOURCE)
#define _GNU_SOURCE
#endif
#include "internal.h"

View file

@ -146,7 +146,7 @@ GLFWbool _glfwInitVulkan(int mode)
return GLFW_FALSE;
}
ep = _glfw_calloc(count, sizeof(VkExtensionProperties));
ep = (VkExtensionProperties*) _glfw_calloc(count, sizeof(VkExtensionProperties));
err = vkEnumerateInstanceExtensionProperties(NULL, &count, ep);
if (err)

View file

@ -34,10 +34,10 @@
// Return the value corresponding to the specified attribute
//
static int findPixelFormatAttribValueWGL(const int* attribs,
int attribCount,
const int* values,
int attrib)
static int _glfwFindPixelFormatAttribValueWGL(const int* attribs,
int attribCount,
const int* values,
int attrib)
{
int i;
@ -52,17 +52,17 @@ static int findPixelFormatAttribValueWGL(const int* attribs,
return 0;
}
#define ADD_ATTRIB(a) \
#define _GLFW_ADD_ATTRIB(a) \
{ \
assert((size_t) attribCount < sizeof(attribs) / sizeof(attribs[0])); \
attribs[attribCount++] = a; \
}
#define FIND_ATTRIB_VALUE(a) \
findPixelFormatAttribValueWGL(attribs, attribCount, values, a)
#define _GLFW_FIND_ATTRIB_VALUE(a) \
_glfwFindPixelFormatAttribValueWGL(attribs, attribCount, values, a)
// Return a list of available and usable framebuffer configs
//
static int choosePixelFormatWGL(_GLFWwindow* window,
static int _glfwChoosePixelFormatWGL(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
@ -79,41 +79,41 @@ static int choosePixelFormatWGL(_GLFWwindow* window,
if (_glfw.wgl.ARB_pixel_format)
{
ADD_ATTRIB(WGL_SUPPORT_OPENGL_ARB);
ADD_ATTRIB(WGL_DRAW_TO_WINDOW_ARB);
ADD_ATTRIB(WGL_PIXEL_TYPE_ARB);
ADD_ATTRIB(WGL_ACCELERATION_ARB);
ADD_ATTRIB(WGL_RED_BITS_ARB);
ADD_ATTRIB(WGL_RED_SHIFT_ARB);
ADD_ATTRIB(WGL_GREEN_BITS_ARB);
ADD_ATTRIB(WGL_GREEN_SHIFT_ARB);
ADD_ATTRIB(WGL_BLUE_BITS_ARB);
ADD_ATTRIB(WGL_BLUE_SHIFT_ARB);
ADD_ATTRIB(WGL_ALPHA_BITS_ARB);
ADD_ATTRIB(WGL_ALPHA_SHIFT_ARB);
ADD_ATTRIB(WGL_DEPTH_BITS_ARB);
ADD_ATTRIB(WGL_STENCIL_BITS_ARB);
ADD_ATTRIB(WGL_ACCUM_BITS_ARB);
ADD_ATTRIB(WGL_ACCUM_RED_BITS_ARB);
ADD_ATTRIB(WGL_ACCUM_GREEN_BITS_ARB);
ADD_ATTRIB(WGL_ACCUM_BLUE_BITS_ARB);
ADD_ATTRIB(WGL_ACCUM_ALPHA_BITS_ARB);
ADD_ATTRIB(WGL_AUX_BUFFERS_ARB);
ADD_ATTRIB(WGL_STEREO_ARB);
ADD_ATTRIB(WGL_DOUBLE_BUFFER_ARB);
_GLFW_ADD_ATTRIB(WGL_SUPPORT_OPENGL_ARB);
_GLFW_ADD_ATTRIB(WGL_DRAW_TO_WINDOW_ARB);
_GLFW_ADD_ATTRIB(WGL_PIXEL_TYPE_ARB);
_GLFW_ADD_ATTRIB(WGL_ACCELERATION_ARB);
_GLFW_ADD_ATTRIB(WGL_RED_BITS_ARB);
_GLFW_ADD_ATTRIB(WGL_RED_SHIFT_ARB);
_GLFW_ADD_ATTRIB(WGL_GREEN_BITS_ARB);
_GLFW_ADD_ATTRIB(WGL_GREEN_SHIFT_ARB);
_GLFW_ADD_ATTRIB(WGL_BLUE_BITS_ARB);
_GLFW_ADD_ATTRIB(WGL_BLUE_SHIFT_ARB);
_GLFW_ADD_ATTRIB(WGL_ALPHA_BITS_ARB);
_GLFW_ADD_ATTRIB(WGL_ALPHA_SHIFT_ARB);
_GLFW_ADD_ATTRIB(WGL_DEPTH_BITS_ARB);
_GLFW_ADD_ATTRIB(WGL_STENCIL_BITS_ARB);
_GLFW_ADD_ATTRIB(WGL_ACCUM_BITS_ARB);
_GLFW_ADD_ATTRIB(WGL_ACCUM_RED_BITS_ARB);
_GLFW_ADD_ATTRIB(WGL_ACCUM_GREEN_BITS_ARB);
_GLFW_ADD_ATTRIB(WGL_ACCUM_BLUE_BITS_ARB);
_GLFW_ADD_ATTRIB(WGL_ACCUM_ALPHA_BITS_ARB);
_GLFW_ADD_ATTRIB(WGL_AUX_BUFFERS_ARB);
_GLFW_ADD_ATTRIB(WGL_STEREO_ARB);
_GLFW_ADD_ATTRIB(WGL_DOUBLE_BUFFER_ARB);
if (_glfw.wgl.ARB_multisample)
ADD_ATTRIB(WGL_SAMPLES_ARB);
_GLFW_ADD_ATTRIB(WGL_SAMPLES_ARB);
if (ctxconfig->client == GLFW_OPENGL_API)
{
if (_glfw.wgl.ARB_framebuffer_sRGB || _glfw.wgl.EXT_framebuffer_sRGB)
ADD_ATTRIB(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
_GLFW_ADD_ATTRIB(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
}
else
{
if (_glfw.wgl.EXT_colorspace)
ADD_ATTRIB(WGL_COLORSPACE_EXT);
_GLFW_ADD_ATTRIB(WGL_COLORSPACE_EXT);
}
// NOTE: In a Parallels VM WGL_ARB_pixel_format returns fewer pixel formats than
@ -134,7 +134,7 @@ static int choosePixelFormatWGL(_GLFWwindow* window,
nativeCount = _glfw_min(nativeCount, extensionCount);
}
usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
usableConfigs = (_GLFWfbconfig*) _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
for (i = 0; i < nativeCount; i++)
{
@ -157,50 +157,50 @@ static int choosePixelFormatWGL(_GLFWwindow* window,
return 0;
}
if (!FIND_ATTRIB_VALUE(WGL_SUPPORT_OPENGL_ARB) ||
!FIND_ATTRIB_VALUE(WGL_DRAW_TO_WINDOW_ARB))
if (!_GLFW_FIND_ATTRIB_VALUE(WGL_SUPPORT_OPENGL_ARB) ||
!_GLFW_FIND_ATTRIB_VALUE(WGL_DRAW_TO_WINDOW_ARB))
{
continue;
}
if (FIND_ATTRIB_VALUE(WGL_PIXEL_TYPE_ARB) != WGL_TYPE_RGBA_ARB)
if (_GLFW_FIND_ATTRIB_VALUE(WGL_PIXEL_TYPE_ARB) != WGL_TYPE_RGBA_ARB)
continue;
if (FIND_ATTRIB_VALUE(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB)
if (_GLFW_FIND_ATTRIB_VALUE(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB)
continue;
if (FIND_ATTRIB_VALUE(WGL_DOUBLE_BUFFER_ARB) != fbconfig->doublebuffer)
if (_GLFW_FIND_ATTRIB_VALUE(WGL_DOUBLE_BUFFER_ARB) != fbconfig->doublebuffer)
continue;
u->redBits = FIND_ATTRIB_VALUE(WGL_RED_BITS_ARB);
u->greenBits = FIND_ATTRIB_VALUE(WGL_GREEN_BITS_ARB);
u->blueBits = FIND_ATTRIB_VALUE(WGL_BLUE_BITS_ARB);
u->alphaBits = FIND_ATTRIB_VALUE(WGL_ALPHA_BITS_ARB);
u->redBits = _GLFW_FIND_ATTRIB_VALUE(WGL_RED_BITS_ARB);
u->greenBits = _GLFW_FIND_ATTRIB_VALUE(WGL_GREEN_BITS_ARB);
u->blueBits = _GLFW_FIND_ATTRIB_VALUE(WGL_BLUE_BITS_ARB);
u->alphaBits = _GLFW_FIND_ATTRIB_VALUE(WGL_ALPHA_BITS_ARB);
u->depthBits = FIND_ATTRIB_VALUE(WGL_DEPTH_BITS_ARB);
u->stencilBits = FIND_ATTRIB_VALUE(WGL_STENCIL_BITS_ARB);
u->depthBits = _GLFW_FIND_ATTRIB_VALUE(WGL_DEPTH_BITS_ARB);
u->stencilBits = _GLFW_FIND_ATTRIB_VALUE(WGL_STENCIL_BITS_ARB);
u->accumRedBits = FIND_ATTRIB_VALUE(WGL_ACCUM_RED_BITS_ARB);
u->accumGreenBits = FIND_ATTRIB_VALUE(WGL_ACCUM_GREEN_BITS_ARB);
u->accumBlueBits = FIND_ATTRIB_VALUE(WGL_ACCUM_BLUE_BITS_ARB);
u->accumAlphaBits = FIND_ATTRIB_VALUE(WGL_ACCUM_ALPHA_BITS_ARB);
u->accumRedBits = _GLFW_FIND_ATTRIB_VALUE(WGL_ACCUM_RED_BITS_ARB);
u->accumGreenBits = _GLFW_FIND_ATTRIB_VALUE(WGL_ACCUM_GREEN_BITS_ARB);
u->accumBlueBits = _GLFW_FIND_ATTRIB_VALUE(WGL_ACCUM_BLUE_BITS_ARB);
u->accumAlphaBits = _GLFW_FIND_ATTRIB_VALUE(WGL_ACCUM_ALPHA_BITS_ARB);
u->auxBuffers = FIND_ATTRIB_VALUE(WGL_AUX_BUFFERS_ARB);
u->stereo = FIND_ATTRIB_VALUE(WGL_STEREO_ARB);
u->auxBuffers = _GLFW_FIND_ATTRIB_VALUE(WGL_AUX_BUFFERS_ARB);
u->stereo = _GLFW_FIND_ATTRIB_VALUE(WGL_STEREO_ARB);
if (_glfw.wgl.ARB_multisample)
u->samples = FIND_ATTRIB_VALUE(WGL_SAMPLES_ARB);
u->samples = _GLFW_FIND_ATTRIB_VALUE(WGL_SAMPLES_ARB);
if (ctxconfig->client == GLFW_OPENGL_API)
{
if (_glfw.wgl.ARB_framebuffer_sRGB || _glfw.wgl.EXT_framebuffer_sRGB)
u->sRGB = FIND_ATTRIB_VALUE(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
u->sRGB = _FIND_ATTRIB_VALUE(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
}
else
{
if (_glfw.wgl.EXT_colorspace)
{
if (FIND_ATTRIB_VALUE(WGL_COLORSPACE_EXT) == WGL_COLORSPACE_SRGB_EXT)
if (_FIND_ATTRIB_VALUE(WGL_COLORSPACE_EXT) == WGL_COLORSPACE_SRGB_EXT)
u->sRGB = true;
}
}
@ -287,10 +287,10 @@ static int choosePixelFormatWGL(_GLFWwindow* window,
return pixelFormat;
}
#undef ADD_ATTRIB
#undef FIND_ATTRIB_VALUE
#undef _GLFW_ADD_ATTRIB
#undef _GLFW_FIND_ATTRIB_VALUE
static void makeContextCurrentWGL(_GLFWwindow* window)
static void _glfwMakeContextCurrentWGL(_GLFWwindow* window)
{
if (window)
{
@ -315,7 +315,7 @@ static void makeContextCurrentWGL(_GLFWwindow* window)
}
}
static void swapBuffersWGL(_GLFWwindow* window)
static void _glfwSwapBuffersWGL(_GLFWwindow* window)
{
if (!window->monitor)
{
@ -336,9 +336,9 @@ static void swapBuffersWGL(_GLFWwindow* window)
SwapBuffers(window->context.wgl.dc);
}
static void swapIntervalWGL(int interval)
static void _glfwSwapIntervalWGL(int interval)
{
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
_GLFWwindow* window = (_GLFWwindow*) _glfwPlatformGetTls(&_glfw.contextSlot);
assert(window != NULL);
window->context.wgl.interval = interval;
@ -360,7 +360,7 @@ static void swapIntervalWGL(int interval)
wglSwapIntervalEXT(interval);
}
static int extensionSupportedWGL(const char* extension)
static int _glfwExtensionSupportedWGL(const char* extension)
{
const char* extensions = NULL;
@ -375,7 +375,7 @@ static int extensionSupportedWGL(const char* extension)
return _glfwStringInExtensionString(extension, extensions);
}
static GLFWglproc getProcAddressWGL(const char* procname)
static GLFWglproc _glfwGetProcAddressWGL(const char* procname)
{
const GLFWglproc proc = (GLFWglproc) wglGetProcAddress(procname);
if (proc)
@ -384,7 +384,7 @@ static GLFWglproc getProcAddressWGL(const char* procname)
return (GLFWglproc) _glfwPlatformGetModuleSymbol(_glfw.wgl.instance, procname);
}
static void destroyContextWGL(_GLFWwindow* window)
static void _glfwDestroyContextWGL(_GLFWwindow* window)
{
if (window->context.wgl.handle)
{
@ -402,7 +402,7 @@ GLFWbool _glfwInitWGL(void)
if (_glfw.wgl.instance)
return GLFW_TRUE;
_glfw.wgl.instance = _glfwPlatformLoadModule("opengl32.dll");
_glfw.wgl.instance = (HINSTANCE) _glfwPlatformLoadModule("opengl32.dll");
if (!_glfw.wgl.instance)
{
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
@ -482,29 +482,29 @@ GLFWbool _glfwInitWGL(void)
// NOTE: WGL_ARB_extensions_string and WGL_EXT_extensions_string are not
// checked below as we are already using them
_glfw.wgl.ARB_multisample =
extensionSupportedWGL("WGL_ARB_multisample");
_glfwExtensionSupportedWGL("WGL_ARB_multisample");
_glfw.wgl.ARB_framebuffer_sRGB =
extensionSupportedWGL("WGL_ARB_framebuffer_sRGB");
_glfwExtensionSupportedWGL("WGL_ARB_framebuffer_sRGB");
_glfw.wgl.EXT_framebuffer_sRGB =
extensionSupportedWGL("WGL_EXT_framebuffer_sRGB");
_glfwExtensionSupportedWGL("WGL_EXT_framebuffer_sRGB");
_glfw.wgl.ARB_create_context =
extensionSupportedWGL("WGL_ARB_create_context");
_glfwExtensionSupportedWGL("WGL_ARB_create_context");
_glfw.wgl.ARB_create_context_profile =
extensionSupportedWGL("WGL_ARB_create_context_profile");
_glfwExtensionSupportedWGL("WGL_ARB_create_context_profile");
_glfw.wgl.EXT_create_context_es2_profile =
extensionSupportedWGL("WGL_EXT_create_context_es2_profile");
_glfwExtensionSupportedWGL("WGL_EXT_create_context_es2_profile");
_glfw.wgl.ARB_create_context_robustness =
extensionSupportedWGL("WGL_ARB_create_context_robustness");
_glfwExtensionSupportedWGL("WGL_ARB_create_context_robustness");
_glfw.wgl.ARB_create_context_no_error =
extensionSupportedWGL("WGL_ARB_create_context_no_error");
_glfwExtensionSupportedWGL("WGL_ARB_create_context_no_error");
_glfw.wgl.EXT_swap_control =
extensionSupportedWGL("WGL_EXT_swap_control");
_glfwExtensionSupportedWGL("WGL_EXT_swap_control");
_glfw.wgl.EXT_colorspace =
extensionSupportedWGL("WGL_EXT_colorspace");
_glfwExtensionSupportedWGL("WGL_EXT_colorspace");
_glfw.wgl.ARB_pixel_format =
extensionSupportedWGL("WGL_ARB_pixel_format");
_glfwExtensionSupportedWGL("WGL_ARB_pixel_format");
_glfw.wgl.ARB_context_flush_control =
extensionSupportedWGL("WGL_ARB_context_flush_control");
_glfwExtensionSupportedWGL("WGL_ARB_context_flush_control");
wglMakeCurrent(pdc, prc);
wglDeleteContext(rc);
@ -544,7 +544,7 @@ GLFWbool _glfwCreateContextWGL(_GLFWwindow* window,
return GLFW_FALSE;
}
pixelFormat = choosePixelFormatWGL(window, ctxconfig, fbconfig);
pixelFormat = _glfwChoosePixelFormatWGL(window, ctxconfig, fbconfig);
if (!pixelFormat)
return GLFW_FALSE;
@ -747,12 +747,12 @@ GLFWbool _glfwCreateContextWGL(_GLFWwindow* window,
}
}
window->context.makeCurrent = makeContextCurrentWGL;
window->context.swapBuffers = swapBuffersWGL;
window->context.swapInterval = swapIntervalWGL;
window->context.extensionSupported = extensionSupportedWGL;
window->context.getProcAddress = getProcAddressWGL;
window->context.destroy = destroyContextWGL;
window->context.makeCurrent = _glfwMakeContextCurrentWGL;
window->context.swapBuffers = _glfwSwapBuffersWGL;
window->context.swapInterval = _glfwSwapIntervalWGL;
window->context.extensionSupported = _glfwExtensionSupportedWGL;
window->context.getProcAddress = _glfwGetProcAddressWGL;
window->context.destroy = _glfwDestroyContextWGL;
return GLFW_TRUE;
}

View file

@ -34,7 +34,7 @@
static const GUID _glfw_GUID_DEVINTERFACE_HID =
{0x4d1e55b2,0xf16f,0x11cf,{0x88,0xcb,0x00,0x11,0x11,0x00,0x00,0x30}};
#define GUID_DEVINTERFACE_HID _glfw_GUID_DEVINTERFACE_HID
#define _GLFW_GUID_DEVINTERFACE_HID _glfw_GUID_DEVINTERFACE_HID
#if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG)
@ -69,7 +69,7 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
// Load necessary libraries (DLLs)
//
static GLFWbool loadLibraries(void)
static GLFWbool _glfwLoadLibrariesWin32(void)
{
if (!GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
@ -81,7 +81,7 @@ static GLFWbool loadLibraries(void)
return GLFW_FALSE;
}
_glfw.win32.user32.instance = _glfwPlatformLoadModule("user32.dll");
_glfw.win32.user32.instance = (HINSTANCE) _glfwPlatformLoadModule("user32.dll");
if (!_glfw.win32.user32.instance)
{
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
@ -100,7 +100,7 @@ static GLFWbool loadLibraries(void)
_glfw.win32.user32.GetSystemMetricsForDpi_ = (PFN_GetSystemMetricsForDpi)
_glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "GetSystemMetricsForDpi");
_glfw.win32.dinput8.instance = _glfwPlatformLoadModule("dinput8.dll");
_glfw.win32.dinput8.instance = (HINSTANCE) _glfwPlatformLoadModule("dinput8.dll");
if (_glfw.win32.dinput8.instance)
{
_glfw.win32.dinput8.Create = (PFN_DirectInput8Create)
@ -121,7 +121,7 @@ static GLFWbool loadLibraries(void)
for (i = 0; names[i]; i++)
{
_glfw.win32.xinput.instance = _glfwPlatformLoadModule(names[i]);
_glfw.win32.xinput.instance = (HINSTANCE) _glfwPlatformLoadModule(names[i]);
if (_glfw.win32.xinput.instance)
{
_glfw.win32.xinput.GetCapabilities = (PFN_XInputGetCapabilities)
@ -134,7 +134,7 @@ static GLFWbool loadLibraries(void)
}
}
_glfw.win32.dwmapi.instance = _glfwPlatformLoadModule("dwmapi.dll");
_glfw.win32.dwmapi.instance = (HINSTANCE) _glfwPlatformLoadModule("dwmapi.dll");
if (_glfw.win32.dwmapi.instance)
{
_glfw.win32.dwmapi.IsCompositionEnabled = (PFN_DwmIsCompositionEnabled)
@ -147,7 +147,7 @@ static GLFWbool loadLibraries(void)
_glfwPlatformGetModuleSymbol(_glfw.win32.dwmapi.instance, "DwmGetColorizationColor");
}
_glfw.win32.shcore.instance = _glfwPlatformLoadModule("shcore.dll");
_glfw.win32.shcore.instance = (HINSTANCE) _glfwPlatformLoadModule("shcore.dll");
if (_glfw.win32.shcore.instance)
{
_glfw.win32.shcore.SetProcessDpiAwareness_ = (PFN_SetProcessDpiAwareness)
@ -156,7 +156,7 @@ static GLFWbool loadLibraries(void)
_glfwPlatformGetModuleSymbol(_glfw.win32.shcore.instance, "GetDpiForMonitor");
}
_glfw.win32.ntdll.instance = _glfwPlatformLoadModule("ntdll.dll");
_glfw.win32.ntdll.instance = (HINSTANCE) _glfwPlatformLoadModule("ntdll.dll");
if (_glfw.win32.ntdll.instance)
{
_glfw.win32.ntdll.RtlVerifyVersionInfo_ = (PFN_RtlVerifyVersionInfo)
@ -168,7 +168,7 @@ static GLFWbool loadLibraries(void)
// Create key code translation tables
//
static void createKeyTables(void)
static void _glfwCreateKeyTablesWin32(void)
{
int scancode;
@ -306,7 +306,7 @@ static void createKeyTables(void)
// Window procedure for the hidden helper window
//
static LRESULT CALLBACK helperWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK _glfwHelperWindowProcWin32(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
@ -341,13 +341,13 @@ static LRESULT CALLBACK helperWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
// Creates a dummy window for behind-the-scenes work
//
static GLFWbool createHelperWindow(void)
static GLFWbool _glfwCreateHelperWindowWin32(void)
{
MSG msg;
WNDCLASSEXW wc = { sizeof(wc) };
wc.style = CS_OWNDC;
wc.lpfnWndProc = (WNDPROC) helperWindowProc;
wc.lpfnWndProc = (WNDPROC) _glfwHelperWindowProcWin32;
wc.hInstance = _glfw.win32.instance;
wc.lpszClassName = L"GLFW3 Helper";
@ -386,7 +386,7 @@ static GLFWbool createHelperWindow(void)
ZeroMemory(&dbi, sizeof(dbi));
dbi.dbcc_size = sizeof(dbi);
dbi.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
dbi.dbcc_classguid = GUID_DEVINTERFACE_HID;
dbi.dbcc_classguid = _GLFW_GUID_DEVINTERFACE_HID;
_glfw.win32.deviceNotificationHandle =
RegisterDeviceNotificationW(_glfw.win32.helperWindowHandle,
@ -422,7 +422,7 @@ WCHAR* _glfwCreateWideStringFromUTF8Win32(const char* source)
return NULL;
}
target = _glfw_calloc(count, sizeof(WCHAR));
target = (WCHAR*) _glfw_calloc(count, sizeof(WCHAR));
if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, count))
{
@ -450,7 +450,7 @@ char* _glfwCreateUTF8FromWideStringWin32(const WCHAR* source)
return NULL;
}
target = _glfw_calloc(size, 1);
target = (char*) _glfw_calloc(size, 1);
if (!WideCharToMultiByte(CP_UTF8, 0, source, -1, target, size, NULL, NULL))
{
@ -656,10 +656,10 @@ GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform)
int _glfwInitWin32(void)
{
if (!loadLibraries())
if (!_glfwLoadLibrariesWin32())
return GLFW_FALSE;
createKeyTables();
_glfwCreateKeyTablesWin32();
_glfwUpdateKeyNamesWin32();
if (_glfwIsWindows10Version1703OrGreaterWin32())
@ -669,7 +669,7 @@ int _glfwInitWin32(void)
else
SetProcessDPIAware();
if (!createHelperWindow())
if (!_glfwCreateHelperWindowWin32())
return GLFW_FALSE;
_glfwPollMonitorsWin32();

View file

@ -146,7 +146,7 @@ static const DIDATAFORMAT _glfwDataFormat =
// Returns a description fitting the specified XInput capabilities
//
static const char* getDeviceDescription(const XINPUT_CAPABILITIES* xic)
static const char* _glfwGetDeviceDescriptionWin32(const XINPUT_CAPABILITIES* xic)
{
switch (xic->SubType)
{
@ -176,10 +176,10 @@ static const char* getDeviceDescription(const XINPUT_CAPABILITIES* xic)
// Lexically compare device objects
//
static int compareJoystickObjects(const void* first, const void* second)
static int _glfwCompareJoystickObjectsWin32(const void* first, const void* second)
{
const _GLFWjoyobjectWin32* fo = first;
const _GLFWjoyobjectWin32* so = second;
const _GLFWjoyobjectWin32* fo = (const _GLFWjoyobjectWin32*) first;
const _GLFWjoyobjectWin32* so = (const _GLFWjoyobjectWin32*) second;
if (fo->type != so->type)
return fo->type - so->type;
@ -190,7 +190,7 @@ static int compareJoystickObjects(const void* first, const void* second)
// Checks whether the specified device supports XInput
// Technique from FDInputJoystickManager::IsXInputDeviceFast in ZDoom
//
static GLFWbool supportsXInput(const GUID* guid)
static GLFWbool _glfwSupportsXInputWin32(const GUID* guid)
{
UINT i, count = 0;
RAWINPUTDEVICELIST* ridl;
@ -199,7 +199,7 @@ static GLFWbool supportsXInput(const GUID* guid)
if (GetRawInputDeviceList(NULL, &count, sizeof(RAWINPUTDEVICELIST)) != 0)
return GLFW_FALSE;
ridl = _glfw_calloc(count, sizeof(RAWINPUTDEVICELIST));
ridl = (RAWINPUTDEVICELIST*) _glfw_calloc(count, sizeof(RAWINPUTDEVICELIST));
if (GetRawInputDeviceList(ridl, &count, sizeof(RAWINPUTDEVICELIST)) == (UINT) -1)
{
@ -254,7 +254,7 @@ static GLFWbool supportsXInput(const GUID* guid)
// Frees all resources associated with the specified joystick
//
static void closeJoystick(_GLFWjoystick* js)
static void _glfwCloseJoystickWin32(_GLFWjoystick* js)
{
_glfwInputJoystick(js, GLFW_DISCONNECTED);
@ -271,10 +271,10 @@ static void closeJoystick(_GLFWjoystick* js)
// DirectInput device object enumeration callback
// Insights gleaned from SDL
//
static BOOL CALLBACK deviceObjectCallback(const DIDEVICEOBJECTINSTANCEW* doi,
void* user)
static BOOL CALLBACK _glfwDeviceObjectCallbackWin32(const DIDEVICEOBJECTINSTANCEW* doi,
void* user)
{
_GLFWobjenumWin32* data = user;
_GLFWobjenumWin32* data = (_GLFWobjenumWin32*) user;
_GLFWjoyobjectWin32* object = data->objects + data->objectCount;
if (DIDFT_GETTYPE(doi->dwType) & DIDFT_AXIS)
@ -341,9 +341,19 @@ static BOOL CALLBACK deviceObjectCallback(const DIDEVICEOBJECTINSTANCEW* doi,
return DIENUM_CONTINUE;
}
#ifdef __cplusplus
#define _glfwRef(p) *p
#else
#define _glfwRef(p) p
#endif
// DirectInput device enumeration callback
//
static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
static BOOL CALLBACK _glfwDeviceCallbackWin32(const DIDEVICEINSTANCE* di, void* user)
{
int jid = 0;
DIDEVCAPS dc;
@ -364,11 +374,11 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
}
}
if (supportsXInput(&di->guidProduct))
if (_glfwSupportsXInputWin32(&di->guidProduct))
return DIENUM_CONTINUE;
if (FAILED(IDirectInput8_CreateDevice(_glfw.win32.dinput8.api,
&di->guidInstance,
_glfwRef(&di->guidInstance),
&device,
NULL)))
{
@ -416,11 +426,13 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
memset(&data, 0, sizeof(data));
data.device = device;
data.objects = _glfw_calloc(dc.dwAxes + (size_t) dc.dwButtons + dc.dwPOVs,
sizeof(_GLFWjoyobjectWin32));
data.objects =
(_GLFWjoyobjectWin32*)
_glfw_calloc(dc.dwAxes + (size_t) dc.dwButtons + dc.dwPOVs,
sizeof(_GLFWjoyobjectWin32));
if (FAILED(IDirectInputDevice8_EnumObjects(device,
deviceObjectCallback,
_glfwDeviceObjectCallbackWin32,
&data,
DIDFT_AXIS | DIDFT_BUTTON | DIDFT_POV)))
{
@ -434,7 +446,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
qsort(data.objects, data.objectCount,
sizeof(_GLFWjoyobjectWin32),
compareJoystickObjects);
_glfwCompareJoystickObjectsWin32);
if (!WideCharToMultiByte(CP_UTF8, 0,
di->tszInstanceName, -1,
@ -526,7 +538,7 @@ void _glfwDetectJoystickConnectionWin32(void)
sprintf(guid, "78696e707574%02x000000000000000000",
xic.SubType & 0xff);
js = _glfwAllocJoystick(getDeviceDescription(&xic), guid, 6, 10, 1);
js = _glfwAllocJoystick(_glfwGetDeviceDescriptionWin32(&xic), guid, 6, 10, 1);
if (!js)
continue;
@ -540,7 +552,7 @@ void _glfwDetectJoystickConnectionWin32(void)
{
if (FAILED(IDirectInput8_EnumDevices(_glfw.win32.dinput8.api,
DI8DEVCLASS_GAMECTRL,
deviceCallback,
_glfwDeviceCallbackWin32,
NULL,
DIEDFL_ALLDEVICES)))
{
@ -576,7 +588,7 @@ GLFWbool _glfwInitJoysticksWin32(void)
{
if (FAILED(DirectInput8Create(_glfw.win32.instance,
DIRECTINPUT_VERSION,
&IID_IDirectInput8W,
_glfwRef(&IID_IDirectInput8W),
(void**) &_glfw.win32.dinput8.api,
NULL)))
{
@ -595,7 +607,7 @@ void _glfwTerminateJoysticksWin32(void)
int jid;
for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
closeJoystick(_glfw.joysticks + jid);
_glfwCloseJoystickWin32(_glfw.joysticks + jid);
if (_glfw.win32.dinput8.api)
IDirectInput8_Release(_glfw.win32.dinput8.api);
@ -624,7 +636,7 @@ GLFWbool _glfwPollJoystickWin32(_GLFWjoystick* js, int mode)
if (FAILED(result))
{
closeJoystick(js);
_glfwCloseJoystickWin32(js);
return GLFW_FALSE;
}
@ -704,7 +716,7 @@ GLFWbool _glfwPollJoystickWin32(_GLFWjoystick* js, int mode)
if (result != ERROR_SUCCESS)
{
if (result == ERROR_DEVICE_NOT_CONNECTED)
closeJoystick(js);
_glfwCloseJoystickWin32(js);
return GLFW_FALSE;
}

View file

@ -36,12 +36,12 @@
#include <assert.h>
// Callback for EnumDisplayMonitors in createMonitor
// Callback for EnumDisplayMonitors in _glfwCreateMonitorWin32
//
static BOOL CALLBACK monitorCallback(HMONITOR handle,
HDC dc,
RECT* rect,
LPARAM data)
static BOOL CALLBACK _glfwMonitorCallbackWin32(HMONITOR handle,
HDC dc,
RECT* rect,
LPARAM data)
{
MONITORINFOEXW mi;
ZeroMemory(&mi, sizeof(mi));
@ -59,8 +59,8 @@ static BOOL CALLBACK monitorCallback(HMONITOR handle,
// Create monitor from an adapter and (optionally) a display
//
static _GLFWmonitor* createMonitor(DISPLAY_DEVICEW* adapter,
DISPLAY_DEVICEW* display)
static _GLFWmonitor* _glfwCreateMonitorWin32(DISPLAY_DEVICEW* adapter,
DISPLAY_DEVICEW* display)
{
_GLFWmonitor* monitor;
int widthMM, heightMM;
@ -123,7 +123,7 @@ static _GLFWmonitor* createMonitor(DISPLAY_DEVICEW* adapter,
rect.right = dm.dmPosition.x + dm.dmPelsWidth;
rect.bottom = dm.dmPosition.y + dm.dmPelsHeight;
EnumDisplayMonitors(NULL, &rect, monitorCallback, (LPARAM) monitor);
EnumDisplayMonitors(NULL, &rect, _glfwMonitorCallbackWin32, (LPARAM) monitor);
return monitor;
}
@ -145,7 +145,7 @@ void _glfwPollMonitorsWin32(void)
disconnectedCount = _glfw.monitorCount;
if (disconnectedCount)
{
disconnected = _glfw_calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
disconnected = (_GLFWmonitor**) _glfw_calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
memcpy(disconnected,
_glfw.monitors,
_glfw.monitorCount * sizeof(_GLFWmonitor*));
@ -186,7 +186,7 @@ void _glfwPollMonitorsWin32(void)
{
disconnected[i] = NULL;
// handle may have changed, update
EnumDisplayMonitors(NULL, NULL, monitorCallback, (LPARAM) _glfw.monitors[i]);
EnumDisplayMonitors(NULL, NULL, _glfwMonitorCallbackWin32, (LPARAM) _glfw.monitors[i]);
break;
}
}
@ -194,7 +194,7 @@ void _glfwPollMonitorsWin32(void)
if (i < disconnectedCount)
continue;
monitor = createMonitor(&adapter, &display);
monitor = _glfwCreateMonitorWin32(&adapter, &display);
if (!monitor)
{
_glfw_free(disconnected);
@ -224,7 +224,7 @@ void _glfwPollMonitorsWin32(void)
if (i < disconnectedCount)
continue;
monitor = createMonitor(&adapter, NULL);
monitor = _glfwCreateMonitorWin32(&adapter, NULL);
if (!monitor)
{
_glfw_free(disconnected);
@ -463,7 +463,7 @@ GLFWvidmode* _glfwGetVideoModesWin32(_GLFWmonitor* monitor, int* count)
if (!*count)
{
// HACK: Report the current mode if no valid modes were found
result = _glfw_calloc(1, sizeof(GLFWvidmode));
result = (GLFWvidmode*) _glfw_calloc(1, sizeof(GLFWvidmode));
_glfwGetVideoModeWin32(monitor, result);
*count = 1;
}

View file

@ -38,7 +38,7 @@
// Returns the window style for the specified window
//
static DWORD getWindowStyle(const _GLFWwindow* window)
static DWORD _glfwGetWindowStyleWin32(const _GLFWwindow* window)
{
DWORD style = WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
@ -64,7 +64,7 @@ static DWORD getWindowStyle(const _GLFWwindow* window)
// Returns the extended window style for the specified window
//
static DWORD getWindowExStyle(const _GLFWwindow* window)
static DWORD _glfwGetWindowExStyleWin32(const _GLFWwindow* window)
{
DWORD style = WS_EX_APPWINDOW;
@ -76,7 +76,7 @@ static DWORD getWindowExStyle(const _GLFWwindow* window)
// Returns the image whose area most closely matches the desired one
//
static const GLFWimage* chooseImage(int count, const GLFWimage* images,
static const GLFWimage* _glfwChooseImageWin32(int count, const GLFWimage* images,
int width, int height)
{
int i, leastDiff = INT_MAX;
@ -98,7 +98,7 @@ static const GLFWimage* chooseImage(int count, const GLFWimage* images,
// Creates an RGBA icon or cursor
//
static HICON createIcon(const GLFWimage* image, int xhot, int yhot, GLFWbool icon)
static HICON _glfwCreateIconWin32(const GLFWimage* image, int xhot, int yhot, GLFWbool icon)
{
int i;
HDC dc;
@ -187,12 +187,12 @@ static HICON createIcon(const GLFWimage* image, int xhot, int yhot, GLFWbool ico
// Enforce the content area aspect ratio based on which edge is being dragged
//
static void applyAspectRatio(_GLFWwindow* window, int edge, RECT* area)
static void _glfwApplyAspectRatioWin32(_GLFWwindow* window, int edge, RECT* area)
{
RECT frame = {0};
const float ratio = (float) window->numer / (float) window->denom;
const DWORD style = getWindowStyle(window);
const DWORD exStyle = getWindowExStyle(window);
const DWORD style = _glfwGetWindowStyleWin32(window);
const DWORD exStyle = _glfwGetWindowExStyleWin32(window);
if (_glfwIsWindows10Version1607OrGreaterWin32())
{
@ -222,7 +222,7 @@ static void applyAspectRatio(_GLFWwindow* window, int edge, RECT* area)
// Updates the cursor image according to its cursor mode
//
static void updateCursorImage(_GLFWwindow* window)
static void _glfwUpdateCursorImageWin32(_GLFWwindow* window)
{
if (window->cursorMode == GLFW_CURSOR_NORMAL ||
window->cursorMode == GLFW_CURSOR_CAPTURED)
@ -243,7 +243,7 @@ static void updateCursorImage(_GLFWwindow* window)
// Sets the cursor clip rect to the window content area
//
static void captureCursor(_GLFWwindow* window)
static void _glfwCaptureCursorWin32(_GLFWwindow* window)
{
RECT clipRect;
GetClientRect(window->win32.handle, &clipRect);
@ -255,7 +255,7 @@ static void captureCursor(_GLFWwindow* window)
// Disabled clip cursor
//
static void releaseCursor(void)
static void _glfwReleaseCursorWin32(void)
{
ClipCursor(NULL);
_glfw.win32.capturedCursorWindow = NULL;
@ -263,7 +263,7 @@ static void releaseCursor(void)
// Enables WM_INPUT messages for the mouse for the specified window
//
static void enableRawMouseMotion(_GLFWwindow* window)
static void _glfwEnableRawMouseMotionWin32(_GLFWwindow* window)
{
const RAWINPUTDEVICE rid = { 0x01, 0x02, 0, window->win32.handle };
@ -276,7 +276,7 @@ static void enableRawMouseMotion(_GLFWwindow* window)
// Disables WM_INPUT messages for the mouse
//
static void disableRawMouseMotion(_GLFWwindow* window)
static void _glfwDisableRawMouseMotionWin32(_GLFWwindow* window)
{
const RAWINPUTDEVICE rid = { 0x01, 0x02, RIDEV_REMOVE, NULL };
@ -289,38 +289,38 @@ static void disableRawMouseMotion(_GLFWwindow* window)
// Apply disabled cursor mode to a focused window
//
static void disableCursor(_GLFWwindow* window)
static void _glfwDisableCursorWin32(_GLFWwindow* window)
{
_glfw.win32.disabledCursorWindow = window;
_glfwGetCursorPosWin32(window,
&_glfw.win32.restoreCursorPosX,
&_glfw.win32.restoreCursorPosY);
updateCursorImage(window);
_glfwUpdateCursorImageWin32(window);
_glfwCenterCursorInContentArea(window);
captureCursor(window);
_glfwCaptureCursorWin32(window);
if (window->rawMouseMotion)
enableRawMouseMotion(window);
_glfwEnableRawMouseMotionWin32(window);
}
// Exit disabled cursor mode for the specified window
//
static void enableCursor(_GLFWwindow* window)
static void _glfwEnableCursorWin32(_GLFWwindow* window)
{
if (window->rawMouseMotion)
disableRawMouseMotion(window);
_glfwDisableRawMouseMotionWin32(window);
_glfw.win32.disabledCursorWindow = NULL;
releaseCursor();
_glfwReleaseCursorWin32();
_glfwSetCursorPosWin32(window,
_glfw.win32.restoreCursorPosX,
_glfw.win32.restoreCursorPosY);
updateCursorImage(window);
_glfwUpdateCursorImageWin32(window);
}
// Returns whether the cursor is in the content area of the specified window
//
static GLFWbool cursorInContentArea(_GLFWwindow* window)
static GLFWbool _glfwCursorInContentAreaWin32(_GLFWwindow* window)
{
RECT area;
POINT pos;
@ -340,23 +340,23 @@ static GLFWbool cursorInContentArea(_GLFWwindow* window)
// Update native window styles to match attributes
//
static void updateWindowStyles(const _GLFWwindow* window)
static void _glfwUpdateWindowStylesWin32(const _GLFWwindow* window)
{
RECT rect;
DWORD style = GetWindowLongW(window->win32.handle, GWL_STYLE);
style &= ~(WS_OVERLAPPEDWINDOW | WS_POPUP);
style |= getWindowStyle(window);
style |= _glfwGetWindowStyleWin32(window);
GetClientRect(window->win32.handle, &rect);
if (_glfwIsWindows10Version1607OrGreaterWin32())
{
AdjustWindowRectExForDpi(&rect, style, FALSE,
getWindowExStyle(window),
_glfwGetWindowExStyleWin32(window),
GetDpiForWindow(window->win32.handle));
}
else
AdjustWindowRectEx(&rect, style, FALSE, getWindowExStyle(window));
AdjustWindowRectEx(&rect, style, FALSE, _glfwGetWindowExStyleWin32(window));
ClientToScreen(window->win32.handle, (POINT*) &rect.left);
ClientToScreen(window->win32.handle, (POINT*) &rect.right);
@ -369,7 +369,7 @@ static void updateWindowStyles(const _GLFWwindow* window)
// Update window framebuffer transparency
//
static void updateFramebufferTransparency(const _GLFWwindow* window)
static void _glfwUpdateFramebufferTransparencyWin32(const _GLFWwindow* window)
{
BOOL composition, opaque;
DWORD color;
@ -403,7 +403,7 @@ static void updateFramebufferTransparency(const _GLFWwindow* window)
// Retrieves and translates modifier keys
//
static int getKeyMods(void)
static int _glfwGetKeyModsWin32(void)
{
int mods = 0;
@ -423,7 +423,7 @@ static int getKeyMods(void)
return mods;
}
static void fitToMonitor(_GLFWwindow* window)
static void _glfwFitToMonitorWin32(_GLFWwindow* window)
{
MONITORINFO mi = { sizeof(mi) };
GetMonitorInfoW(window->monitor->win32.handle, &mi);
@ -437,7 +437,7 @@ static void fitToMonitor(_GLFWwindow* window)
// Make the specified window and its video mode active on its monitor
//
static void acquireMonitor(_GLFWwindow* window)
static void _glfwAcquireMonitorWin32(_GLFWwindow* window)
{
if (!_glfw.win32.acquiredMonitorCount)
{
@ -458,7 +458,7 @@ static void acquireMonitor(_GLFWwindow* window)
// Remove the window and restore the original video mode
//
static void releaseMonitor(_GLFWwindow* window)
static void _glfwReleaseMonitorWin32(_GLFWwindow* window)
{
if (window->monitor->window != window)
return;
@ -468,7 +468,7 @@ static void releaseMonitor(_GLFWwindow* window)
{
SetThreadExecutionState(ES_CONTINUOUS);
// HACK: Restore mouse trail length saved in acquireMonitor
// HACK: Restore mouse trail length saved in _glfwAcquireMonitorWin32
SystemParametersInfoW(SPI_SETMOUSETRAILS, _glfw.win32.mouseTrailSize, 0, 0);
}
@ -478,7 +478,7 @@ static void releaseMonitor(_GLFWwindow* window)
// Manually maximize the window, for when SW_MAXIMIZE cannot be used
//
static void maximizeWindowManually(_GLFWwindow* window)
static void _glfwMaximizeWindowManuallyWin32(_GLFWwindow* window)
{
RECT rect;
DWORD style;
@ -528,9 +528,9 @@ static void maximizeWindowManually(_GLFWwindow* window)
// Window procedure for user-created windows
//
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK _glfwWindowProcWin32(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
_GLFWwindow* window = GetPropW(hWnd, L"GLFW");
_GLFWwindow* window = (_GLFWwindow*) GetPropW(hWnd, L"GLFW");
if (!window)
{
if (uMsg == WM_NCCREATE)
@ -538,7 +538,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
if (_glfwIsWindows10Version1607OrGreaterWin32())
{
const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam;
const _GLFWwndconfig* wndconfig = cs->lpCreateParams;
const _GLFWwndconfig* wndconfig = (const _GLFWwndconfig*) cs->lpCreateParams;
// On per-monitor DPI aware V1 systems, only enable
// non-client scaling for windows that scale the client area
@ -574,9 +574,9 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
if (lParam == 0 && window->win32.frameAction)
{
if (window->cursorMode == GLFW_CURSOR_DISABLED)
disableCursor(window);
_glfwDisableCursorWin32(window);
else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
captureCursor(window);
_glfwCaptureCursorWin32(window);
window->win32.frameAction = GLFW_FALSE;
}
@ -594,9 +594,9 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
break;
if (window->cursorMode == GLFW_CURSOR_DISABLED)
disableCursor(window);
_glfwDisableCursorWin32(window);
else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
captureCursor(window);
_glfwCaptureCursorWin32(window);
return 0;
}
@ -604,9 +604,9 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
case WM_KILLFOCUS:
{
if (window->cursorMode == GLFW_CURSOR_DISABLED)
enableCursor(window);
_glfwEnableCursorWin32(window);
else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
releaseCursor();
_glfwReleaseCursorWin32();
if (window->monitor && window->autoIconify)
_glfwIconifyWindowWin32(window);
@ -678,7 +678,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
codepoint = (WCHAR) wParam;
window->win32.highSurrogate = 0;
_glfwInputChar(window, codepoint, getKeyMods(), uMsg != WM_SYSCHAR);
_glfwInputChar(window, codepoint, _glfwGetKeyModsWin32(), uMsg != WM_SYSCHAR);
}
if (uMsg == WM_SYSCHAR && window->win32.keymenu)
@ -697,7 +697,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
return TRUE;
}
_glfwInputChar(window, (uint32_t) wParam, getKeyMods(), GLFW_TRUE);
_glfwInputChar(window, (uint32_t) wParam, _glfwGetKeyModsWin32(), GLFW_TRUE);
return 0;
}
@ -708,7 +708,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
{
int key, scancode;
const int action = (HIWORD(lParam) & KF_UP) ? GLFW_RELEASE : GLFW_PRESS;
const int mods = getKeyMods();
const int mods = _glfwGetKeyModsWin32();
scancode = (HIWORD(lParam) & (KF_EXTENDED | 0xff));
if (!(scancode & 0xff))
@ -837,7 +837,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
if (i > GLFW_MOUSE_BUTTON_LAST)
SetCapture(hWnd);
_glfwInputMouseClick(window, button, action, getKeyMods());
_glfwInputMouseClick(window, button, action, _glfwGetKeyModsWin32());
for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++)
{
@ -911,7 +911,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
if (size > (UINT) _glfw.win32.rawInputSize)
{
_glfw_free(_glfw.win32.rawInput);
_glfw.win32.rawInput = _glfw_calloc(size, 1);
_glfw.win32.rawInput = (RAWINPUT *) _glfw_calloc(size, 1);
_glfw.win32.rawInputSize = size;
}
@ -995,9 +995,9 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
// HACK: Enable the cursor while the user is moving or
// resizing the window or using the window menu
if (window->cursorMode == GLFW_CURSOR_DISABLED)
enableCursor(window);
_glfwEnableCursorWin32(window);
else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
releaseCursor();
_glfwReleaseCursorWin32();
break;
}
@ -1011,9 +1011,9 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
// HACK: Disable the cursor once the user is done moving or
// resizing the window or using the menu
if (window->cursorMode == GLFW_CURSOR_DISABLED)
disableCursor(window);
_glfwDisableCursorWin32(window);
else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
captureCursor(window);
_glfwCaptureCursorWin32(window);
break;
}
@ -1028,7 +1028,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
wParam != SIZE_RESTORED);
if (_glfw.win32.capturedCursorWindow == window)
captureCursor(window);
_glfwCaptureCursorWin32(window);
if (window->win32.iconified != iconified)
_glfwInputWindowIconify(window, iconified);
@ -1048,11 +1048,11 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
if (window->monitor && window->win32.iconified != iconified)
{
if (iconified)
releaseMonitor(window);
_glfwReleaseMonitorWin32(window);
else
{
acquireMonitor(window);
fitToMonitor(window);
_glfwAcquireMonitorWin32(window);
_glfwFitToMonitorWin32(window);
}
}
@ -1064,7 +1064,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
case WM_MOVE:
{
if (_glfw.win32.capturedCursorWindow == window)
captureCursor(window);
_glfwCaptureCursorWin32(window);
// NOTE: This cannot use LOWORD/HIWORD recommended by MSDN, as
// those macros do not handle negative window positions correctly
@ -1082,7 +1082,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
break;
}
applyAspectRatio(window, (int) wParam, (RECT*) lParam);
_glfwApplyAspectRatioWin32(window, (int) wParam, (RECT*) lParam);
return TRUE;
}
@ -1090,8 +1090,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
{
RECT frame = {0};
MINMAXINFO* mmi = (MINMAXINFO*) lParam;
const DWORD style = getWindowStyle(window);
const DWORD exStyle = getWindowExStyle(window);
const DWORD style = _glfwGetWindowStyleWin32(window);
const DWORD exStyle = _glfwGetWindowExStyleWin32(window);
if (window->monitor)
break;
@ -1163,7 +1163,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
case WM_DWMCOLORIZATIONCOLORCHANGED:
{
if (window->win32.transparent)
updateFramebufferTransparency(window);
_glfwUpdateFramebufferTransparencyWin32(window);
return 0;
}
@ -1178,11 +1178,11 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
RECT source = {0}, target = {0};
SIZE* size = (SIZE*) lParam;
AdjustWindowRectExForDpi(&source, getWindowStyle(window),
FALSE, getWindowExStyle(window),
AdjustWindowRectExForDpi(&source, _glfwGetWindowStyleWin32(window),
FALSE, _glfwGetWindowExStyleWin32(window),
GetDpiForWindow(window->win32.handle));
AdjustWindowRectExForDpi(&target, getWindowStyle(window),
FALSE, getWindowExStyle(window),
AdjustWindowRectExForDpi(&target, _glfwGetWindowStyleWin32(window),
FALSE, _glfwGetWindowExStyleWin32(window),
LOWORD(wParam));
size->cx += (target.right - target.left) -
@ -1223,7 +1223,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
{
if (LOWORD(lParam) == HTCLIENT)
{
updateCursorImage(window);
_glfwUpdateCursorImageWin32(window);
return TRUE;
}
@ -1237,7 +1237,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
int i;
const int count = DragQueryFileW(drop, 0xffffffff, NULL, 0);
char** paths = _glfw_calloc(count, sizeof(char*));
char** paths = (char**) _glfw_calloc(count, sizeof(char*));
// Move the mouse to the position of the drop
DragQueryPoint(drop, &pt);
@ -1246,7 +1246,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
for (i = 0; i < count; i++)
{
const UINT length = DragQueryFileW(drop, i, NULL, 0);
WCHAR* buffer = _glfw_calloc((size_t) length + 1, sizeof(WCHAR));
WCHAR* buffer = (WCHAR*) _glfw_calloc((size_t) length + 1, sizeof(WCHAR));
DragQueryFileW(drop, i, buffer, length + 1);
paths[i] = _glfwCreateUTF8FromWideStringWin32(buffer);
@ -1270,20 +1270,20 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
// Creates the GLFW window
//
static int createNativeWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWfbconfig* fbconfig)
static int _glfwCreateNativeWindowWin32(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWfbconfig* fbconfig)
{
int frameX, frameY, frameWidth, frameHeight;
WCHAR* wideTitle;
DWORD style = getWindowStyle(window);
DWORD exStyle = getWindowExStyle(window);
DWORD style = _glfwGetWindowStyleWin32(window);
DWORD exStyle = _glfwGetWindowExStyleWin32(window);
if (!_glfw.win32.mainWindowClass)
{
WNDCLASSEXW wc = { sizeof(wc) };
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = windowProc;
wc.lpfnWndProc = _glfwWindowProcWin32;
wc.hInstance = _glfw.win32.instance;
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
#if defined(_GLFW_WNDCLASSNAME)
@ -1292,15 +1292,15 @@ static int createNativeWindow(_GLFWwindow* window,
wc.lpszClassName = L"GLFW30";
#endif
// Load user-provided icon if available
wc.hIcon = LoadImageW(GetModuleHandleW(NULL),
L"GLFW_ICON", IMAGE_ICON,
0, 0, LR_DEFAULTSIZE | LR_SHARED);
wc.hIcon = (HICON) LoadImageW(GetModuleHandleW(NULL),
L"GLFW_ICON", IMAGE_ICON,
0, 0, LR_DEFAULTSIZE | LR_SHARED);
if (!wc.hIcon)
{
// No user-provided icon found, load default icon
wc.hIcon = LoadImageW(NULL,
IDI_APPLICATION, IMAGE_ICON,
0, 0, LR_DEFAULTSIZE | LR_SHARED);
wc.hIcon = (HICON) LoadImageW(NULL,
IDI_APPLICATION, IMAGE_ICON,
0, 0, LR_DEFAULTSIZE | LR_SHARED);
}
_glfw.win32.mainWindowClass = RegisterClassExW(&wc);
@ -1474,7 +1474,7 @@ static int createNativeWindow(_GLFWwindow* window,
if (fbconfig->transparent)
{
updateFramebufferTransparency(window);
_glfwUpdateFramebufferTransparencyWin32(window);
window->win32.transparent = GLFW_TRUE;
}
@ -1488,7 +1488,7 @@ GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
if (!createNativeWindow(window, wndconfig, fbconfig))
if (!_glfwCreateNativeWindowWin32(window, wndconfig, fbconfig))
return GLFW_FALSE;
if (ctxconfig->client != GLFW_NO_API)
@ -1526,8 +1526,8 @@ GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window,
{
_glfwShowWindowWin32(window);
_glfwFocusWindowWin32(window);
acquireMonitor(window);
fitToMonitor(window);
_glfwAcquireMonitorWin32(window);
_glfwFitToMonitorWin32(window);
if (wndconfig->centerCursor)
_glfwCenterCursorInContentArea(window);
@ -1548,16 +1548,16 @@ GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window,
void _glfwDestroyWindowWin32(_GLFWwindow* window)
{
if (window->monitor)
releaseMonitor(window);
_glfwReleaseMonitorWin32(window);
if (window->context.destroy)
window->context.destroy(window);
if (_glfw.win32.disabledCursorWindow == window)
enableCursor(window);
_glfwEnableCursorWin32(window);
if (_glfw.win32.capturedCursorWindow == window)
releaseCursor();
_glfwReleaseCursorWin32();
if (window->win32.handle)
{
@ -1589,15 +1589,15 @@ void _glfwSetWindowIconWin32(_GLFWwindow* window, int count, const GLFWimage* im
if (count)
{
const GLFWimage* bigImage = chooseImage(count, images,
const GLFWimage* bigImage = _glfwChooseImageWin32(count, images,
GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON));
const GLFWimage* smallImage = chooseImage(count, images,
const GLFWimage* smallImage = _glfwChooseImageWin32(count, images,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON));
bigIcon = createIcon(bigImage, 0, 0, GLFW_TRUE);
smallIcon = createIcon(smallImage, 0, 0, GLFW_TRUE);
bigIcon = _glfwCreateIconWin32(bigImage, 0, 0, GLFW_TRUE);
smallIcon = _glfwCreateIconWin32(smallImage, 0, 0, GLFW_TRUE);
}
else
{
@ -1638,14 +1638,14 @@ void _glfwSetWindowPosWin32(_GLFWwindow* window, int xpos, int ypos)
if (_glfwIsWindows10Version1607OrGreaterWin32())
{
AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window),
AdjustWindowRectExForDpi(&rect, _glfwGetWindowStyleWin32(window),
FALSE, _glfwGetWindowExStyleWin32(window),
GetDpiForWindow(window->win32.handle));
}
else
{
AdjustWindowRectEx(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window));
AdjustWindowRectEx(&rect, _glfwGetWindowStyleWin32(window),
FALSE, _glfwGetWindowExStyleWin32(window));
}
SetWindowPos(window->win32.handle, NULL, rect.left, rect.top, 0, 0,
@ -1669,8 +1669,8 @@ void _glfwSetWindowSizeWin32(_GLFWwindow* window, int width, int height)
{
if (window->monitor->window == window)
{
acquireMonitor(window);
fitToMonitor(window);
_glfwAcquireMonitorWin32(window);
_glfwFitToMonitorWin32(window);
}
}
else
@ -1679,14 +1679,14 @@ void _glfwSetWindowSizeWin32(_GLFWwindow* window, int width, int height)
if (_glfwIsWindows10Version1607OrGreaterWin32())
{
AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window),
AdjustWindowRectExForDpi(&rect, _glfwGetWindowStyleWin32(window),
FALSE, _glfwGetWindowExStyleWin32(window),
GetDpiForWindow(window->win32.handle));
}
else
{
AdjustWindowRectEx(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window));
AdjustWindowRectEx(&rect, _glfwGetWindowStyleWin32(window),
FALSE, _glfwGetWindowExStyleWin32(window));
}
SetWindowPos(window->win32.handle, HWND_TOP,
@ -1722,7 +1722,7 @@ void _glfwSetWindowAspectRatioWin32(_GLFWwindow* window, int numer, int denom)
return;
GetWindowRect(window->win32.handle, &area);
applyAspectRatio(window, WMSZ_BOTTOMRIGHT, &area);
_glfwApplyAspectRatioWin32(window, WMSZ_BOTTOMRIGHT, &area);
MoveWindow(window->win32.handle,
area.left, area.top,
area.right - area.left,
@ -1746,14 +1746,14 @@ void _glfwGetWindowFrameSizeWin32(_GLFWwindow* window,
if (_glfwIsWindows10Version1607OrGreaterWin32())
{
AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window),
AdjustWindowRectExForDpi(&rect, _glfwGetWindowStyleWin32(window),
FALSE, _glfwGetWindowExStyleWin32(window),
GetDpiForWindow(window->win32.handle));
}
else
{
AdjustWindowRectEx(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window));
AdjustWindowRectEx(&rect, _glfwGetWindowStyleWin32(window),
FALSE, _glfwGetWindowExStyleWin32(window));
}
if (left)
@ -1770,7 +1770,7 @@ void _glfwGetWindowContentScaleWin32(_GLFWwindow* window, float* xscale, float*
{
const HANDLE handle = MonitorFromWindow(window->win32.handle,
MONITOR_DEFAULTTONEAREST);
_glfwGetHMONITORContentScaleWin32(handle, xscale, yscale);
_glfwGetHMONITORContentScaleWin32((HMONITOR) handle, xscale, yscale);
}
void _glfwIconifyWindowWin32(_GLFWwindow* window)
@ -1788,7 +1788,7 @@ void _glfwMaximizeWindowWin32(_GLFWwindow* window)
if (IsWindowVisible(window->win32.handle))
ShowWindow(window->win32.handle, SW_MAXIMIZE);
else
maximizeWindowManually(window);
_glfwMaximizeWindowManuallyWin32(window);
}
void _glfwShowWindowWin32(_GLFWwindow* window)
@ -1841,8 +1841,8 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window,
{
if (monitor->window == window)
{
acquireMonitor(window);
fitToMonitor(window);
_glfwAcquireMonitorWin32(window);
_glfwFitToMonitorWin32(window);
}
}
else
@ -1851,14 +1851,14 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window,
if (_glfwIsWindows10Version1607OrGreaterWin32())
{
AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window),
AdjustWindowRectExForDpi(&rect, _glfwGetWindowStyleWin32(window),
FALSE, _glfwGetWindowExStyleWin32(window),
GetDpiForWindow(window->win32.handle));
}
else
{
AdjustWindowRectEx(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window));
AdjustWindowRectEx(&rect, _glfwGetWindowStyleWin32(window),
FALSE, _glfwGetWindowExStyleWin32(window));
}
SetWindowPos(window->win32.handle, HWND_TOP,
@ -1871,7 +1871,7 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window,
}
if (window->monitor)
releaseMonitor(window);
_glfwReleaseMonitorWin32(window);
_glfwInputWindowMonitor(window, monitor);
@ -1884,12 +1884,12 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window,
{
DWORD style = GetWindowLongW(window->win32.handle, GWL_STYLE);
style &= ~WS_OVERLAPPEDWINDOW;
style |= getWindowStyle(window);
style |= _glfwGetWindowStyleWin32(window);
SetWindowLongW(window->win32.handle, GWL_STYLE, style);
flags |= SWP_FRAMECHANGED;
}
acquireMonitor(window);
_glfwAcquireMonitorWin32(window);
GetMonitorInfoW(window->monitor->win32.handle, &mi);
SetWindowPos(window->win32.handle, HWND_TOPMOST,
@ -1909,7 +1909,7 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window,
if (window->decorated)
{
style &= ~WS_POPUP;
style |= getWindowStyle(window);
style |= _glfwGetWindowStyleWin32(window);
SetWindowLongW(window->win32.handle, GWL_STYLE, style);
flags |= SWP_FRAMECHANGED;
@ -1922,14 +1922,14 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window,
if (_glfwIsWindows10Version1607OrGreaterWin32())
{
AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window),
AdjustWindowRectExForDpi(&rect, _glfwGetWindowStyleWin32(window),
FALSE, _glfwGetWindowExStyleWin32(window),
GetDpiForWindow(window->win32.handle));
}
else
{
AdjustWindowRectEx(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window));
AdjustWindowRectEx(&rect, _glfwGetWindowStyleWin32(window),
FALSE, _glfwGetWindowExStyleWin32(window));
}
SetWindowPos(window->win32.handle, after,
@ -1961,7 +1961,7 @@ GLFWbool _glfwWindowMaximizedWin32(_GLFWwindow* window)
GLFWbool _glfwWindowHoveredWin32(_GLFWwindow* window)
{
return cursorInContentArea(window);
return _glfwCursorInContentAreaWin32(window);
}
GLFWbool _glfwFramebufferTransparentWin32(_GLFWwindow* window)
@ -1990,12 +1990,12 @@ GLFWbool _glfwFramebufferTransparentWin32(_GLFWwindow* window)
void _glfwSetWindowResizableWin32(_GLFWwindow* window, GLFWbool enabled)
{
updateWindowStyles(window);
_glfwUpdateWindowStylesWin32(window);
}
void _glfwSetWindowDecoratedWin32(_GLFWwindow* window, GLFWbool enabled)
{
updateWindowStyles(window);
_glfwUpdateWindowStylesWin32(window);
}
void _glfwSetWindowFloatingWin32(_GLFWwindow* window, GLFWbool enabled)
@ -2077,9 +2077,9 @@ void _glfwSetRawMouseMotionWin32(_GLFWwindow *window, GLFWbool enabled)
return;
if (enabled)
enableRawMouseMotion(window);
_glfwEnableRawMouseMotionWin32(window);
else
disableRawMouseMotion(window);
_glfwDisableRawMouseMotionWin32(window);
}
GLFWbool _glfwRawMouseMotionSupportedWin32(void)
@ -2121,11 +2121,11 @@ void _glfwPollEventsWin32(void)
// NOTE: Windows key is not reported as released by the Win+V hotkey
// Other Win hotkeys are handled implicitly by _glfwInputWindowFocus
// because they change the input focus
// NOTE: The other half of this is in the WM_*KEY* handler in windowProc
// NOTE: The other half of this is in the WM_*KEY* handler in _glfwWindowProcWin32
handle = GetActiveWindow();
if (handle)
{
window = GetPropW(handle, L"GLFW");
window = (_GLFWwindow*) GetPropW(handle, L"GLFW");
if (window)
{
int i;
@ -2148,7 +2148,7 @@ void _glfwPollEventsWin32(void)
if (window->keys[key] != GLFW_PRESS)
continue;
_glfwInputKey(window, key, scancode, GLFW_RELEASE, getKeyMods());
_glfwInputKey(window, key, scancode, GLFW_RELEASE, _glfwGetKeyModsWin32());
}
}
}
@ -2227,18 +2227,18 @@ void _glfwSetCursorModeWin32(_GLFWwindow* window, int mode)
&_glfw.win32.restoreCursorPosY);
_glfwCenterCursorInContentArea(window);
if (window->rawMouseMotion)
enableRawMouseMotion(window);
_glfwEnableRawMouseMotionWin32(window);
}
else if (_glfw.win32.disabledCursorWindow == window)
{
if (window->rawMouseMotion)
disableRawMouseMotion(window);
_glfwDisableRawMouseMotionWin32(window);
}
if (mode == GLFW_CURSOR_DISABLED || mode == GLFW_CURSOR_CAPTURED)
captureCursor(window);
_glfwCaptureCursorWin32(window);
else
releaseCursor();
_glfwReleaseCursorWin32();
if (mode == GLFW_CURSOR_DISABLED)
_glfw.win32.disabledCursorWindow = window;
@ -2251,8 +2251,8 @@ void _glfwSetCursorModeWin32(_GLFWwindow* window, int mode)
}
}
if (cursorInContentArea(window))
updateCursorImage(window);
if (_glfwCursorInContentAreaWin32(window))
_glfwUpdateCursorImageWin32(window);
}
const char* _glfwGetScancodeNameWin32(int scancode)
@ -2279,7 +2279,7 @@ GLFWbool _glfwCreateCursorWin32(_GLFWcursor* cursor,
const GLFWimage* image,
int xhot, int yhot)
{
cursor->win32.handle = (HCURSOR) createIcon(image, xhot, yhot, GLFW_FALSE);
cursor->win32.handle = (HCURSOR) _glfwCreateIconWin32(image, xhot, yhot, GLFW_FALSE);
if (!cursor->win32.handle)
return GLFW_FALSE;
@ -2327,9 +2327,9 @@ GLFWbool _glfwCreateStandardCursorWin32(_GLFWcursor* cursor, int shape)
return GLFW_FALSE;
}
cursor->win32.handle = LoadImageW(NULL,
MAKEINTRESOURCEW(id), IMAGE_CURSOR, 0, 0,
LR_DEFAULTSIZE | LR_SHARED);
cursor->win32.handle = (HCURSOR) LoadImageW(NULL,
MAKEINTRESOURCEW(id), IMAGE_CURSOR, 0, 0,
LR_DEFAULTSIZE | LR_SHARED);
if (!cursor->win32.handle)
{
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
@ -2348,8 +2348,8 @@ void _glfwDestroyCursorWin32(_GLFWcursor* cursor)
void _glfwSetCursorWin32(_GLFWwindow* window, _GLFWcursor* cursor)
{
if (cursorInContentArea(window))
updateCursorImage(window);
if (_glfwCursorInContentAreaWin32(window))
_glfwUpdateCursorImageWin32(window);
}
void _glfwSetClipboardStringWin32(const char* string)
@ -2370,7 +2370,7 @@ void _glfwSetClipboardStringWin32(const char* string)
return;
}
buffer = GlobalLock(object);
buffer = (WCHAR*) GlobalLock(object);
if (!buffer)
{
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
@ -2433,7 +2433,7 @@ const char* _glfwGetClipboardStringWin32(void)
return NULL;
}
buffer = GlobalLock(object);
buffer = (WCHAR*) GlobalLock(object);
if (!buffer)
{
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
@ -2481,7 +2481,7 @@ EGLenum _glfwGetEGLPlatformWin32(EGLint** attribs)
if (type)
{
*attribs = _glfw_calloc(3, sizeof(EGLint));
*attribs = (EGLint*) _glfw_calloc(3, sizeof(EGLint));
(*attribs)[0] = EGL_PLATFORM_ANGLE_TYPE_ANGLE;
(*attribs)[1] = type;
(*attribs)[2] = EGL_NONE;
@ -2507,8 +2507,8 @@ void _glfwGetRequiredInstanceExtensionsWin32(char** extensions)
if (!_glfw.vk.KHR_surface || !_glfw.vk.KHR_win32_surface)
return;
extensions[0] = "VK_KHR_surface";
extensions[1] = "VK_KHR_win32_surface";
extensions[0] = (char*) "VK_KHR_surface";
extensions[1] = (char*) "VK_KHR_win32_surface";
}
GLFWbool _glfwGetPhysicalDevicePresentationSupportWin32(VkInstance instance,

View file

@ -213,7 +213,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
if (!_glfwIsValidContextConfig(&ctxconfig))
return NULL;
window = _glfw_calloc(1, sizeof(_GLFWwindow));
window = (_GLFWwindow*) _glfw_calloc(1, sizeof(_GLFWwindow));
window->next = _glfw.windowListHead;
_glfw.windowListHead = window;

View file

@ -91,23 +91,23 @@
#include "idle-inhibit-unstable-v1-client-protocol-code.h"
#undef types
static void wmBaseHandlePing(void* userData,
struct xdg_wm_base* wmBase,
uint32_t serial)
static void _glfwWmBaseHandlePingWayland(void* userData,
struct xdg_wm_base* wmBase,
uint32_t serial)
{
xdg_wm_base_pong(wmBase, serial);
}
static const struct xdg_wm_base_listener wmBaseListener =
static const struct xdg_wm_base_listener _glfwWmBaseListenerWayland =
{
wmBaseHandlePing
_glfwWmBaseHandlePingWayland
};
static void registryHandleGlobal(void* userData,
struct wl_registry* registry,
uint32_t name,
const char* interface,
uint32_t version)
static void _glfwRegistryHandleGlobalWayland(void* userData,
struct wl_registry* registry,
uint32_t name,
const char* interface,
uint32_t version)
{
if (strcmp(interface, "wl_compositor") == 0)
{
@ -152,7 +152,7 @@ static void registryHandleGlobal(void* userData,
{
_glfw.wl.wmBase =
wl_registry_bind(registry, name, &xdg_wm_base_interface, 1);
xdg_wm_base_add_listener(_glfw.wl.wmBase, &wmBaseListener, NULL);
xdg_wm_base_add_listener(_glfw.wl.wmBase, &_glfwWmBaseListenerWayland, NULL);
}
else if (strcmp(interface, "zxdg_decoration_manager_v1") == 0)
{
@ -203,9 +203,9 @@ static void registryHandleGlobal(void* userData,
}
}
static void registryHandleGlobalRemove(void* userData,
struct wl_registry* registry,
uint32_t name)
static void _glfwRegistryHandleGlobalRemoveWayland(void* userData,
struct wl_registry* registry,
uint32_t name)
{
for (int i = 0; i < _glfw.monitorCount; ++i)
{
@ -219,42 +219,42 @@ static void registryHandleGlobalRemove(void* userData,
}
static const struct wl_registry_listener registryListener =
static const struct wl_registry_listener _glfwRegistryListenerWayland =
{
registryHandleGlobal,
registryHandleGlobalRemove
_glfwRegistryHandleGlobalWayland,
_glfwRegistryHandleGlobalRemoveWayland
};
void libdecorHandleError(struct libdecor* context,
enum libdecor_error error,
const char* message)
static void _glfwLibdecorHandleErrorWayland(struct libdecor* context,
enum libdecor_error error,
const char* message)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: libdecor error %u: %s",
error, message);
}
static const struct libdecor_interface libdecorInterface =
static const struct libdecor_interface _glfwLibdecorInterfaceWayland =
{
libdecorHandleError
_glfwLibdecorHandleErrorWayland
};
static void libdecorReadyCallback(void* userData,
struct wl_callback* callback,
uint32_t time)
static void _glfwLibdecorReadyCallbackWayland(void* userData,
struct wl_callback* callback,
uint32_t time)
{
_glfw.wl.libdecor.ready = GLFW_TRUE;
wl_callback_destroy(callback);
}
static const struct wl_callback_listener libdecorReadyListener =
static const struct wl_callback_listener _glfwLibdecorReadyListenerWayland =
{
libdecorReadyCallback
_glfwLibdecorReadyCallbackWayland
};
// Create key code translation tables
//
static void createKeyTables(void)
static void _glfwCreateKeyTablesWayland(void)
{
memset(_glfw.wl.keycodes, -1, sizeof(_glfw.wl.keycodes));
memset(_glfw.wl.scancodes, -1, sizeof(_glfw.wl.scancodes));
@ -385,7 +385,7 @@ static void createKeyTables(void)
}
}
static GLFWbool loadCursorTheme(void)
static GLFWbool _glfwLoadCursorThemeWayland(void)
{
int cursorSize = 16;
@ -844,9 +844,9 @@ int _glfwInitWayland(void)
}
_glfw.wl.registry = wl_display_get_registry(_glfw.wl.display);
wl_registry_add_listener(_glfw.wl.registry, &registryListener, NULL);
wl_registry_add_listener(_glfw.wl.registry, &_glfwRegistryListenerWayland, NULL);
createKeyTables();
_glfwCreateKeyTablesWayland();
_glfw.wl.keyRepeatTimerfd =
timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
@ -874,7 +874,7 @@ int _glfwInitWayland(void)
if (_glfw.wl.libdecor.handle)
{
_glfw.wl.libdecor.context = libdecor_new(_glfw.wl.display, &libdecorInterface);
_glfw.wl.libdecor.context = libdecor_new(_glfw.wl.display, &_glfwLibdecorInterfaceWayland);
if (_glfw.wl.libdecor.context)
{
// Perform an initial dispatch and flush to get the init started
@ -882,7 +882,7 @@ int _glfwInitWayland(void)
// Create sync point to "know" when libdecor is ready for use
struct wl_callback* callback = wl_display_sync(_glfw.wl.display);
wl_callback_add_listener(callback, &libdecorReadyListener, NULL);
wl_callback_add_listener(callback, &_glfwLibdecorReadyListenerWayland, NULL);
}
}
@ -900,7 +900,7 @@ int _glfwInitWayland(void)
return GLFW_FALSE;
}
if (!loadCursorTheme())
if (!_glfwLoadCursorThemeWayland())
return GLFW_FALSE;
if (_glfw.wl.seat && _glfw.wl.dataDeviceManager)

View file

@ -38,16 +38,16 @@
#include "wayland-client-protocol.h"
static void outputHandleGeometry(void* userData,
struct wl_output* output,
int32_t x,
int32_t y,
int32_t physicalWidth,
int32_t physicalHeight,
int32_t subpixel,
const char* make,
const char* model,
int32_t transform)
static void _glfwOutputHandleGeometryWayland(void* userData,
struct wl_output* output,
int32_t x,
int32_t y,
int32_t physicalWidth,
int32_t physicalHeight,
int32_t subpixel,
const char* make,
const char* model,
int32_t transform)
{
struct _GLFWmonitor* monitor = userData;
@ -60,12 +60,12 @@ static void outputHandleGeometry(void* userData,
snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model);
}
static void outputHandleMode(void* userData,
struct wl_output* output,
uint32_t flags,
int32_t width,
int32_t height,
int32_t refresh)
static void _glfwOutputHandleModeWayland(void* userData,
struct wl_output* output,
uint32_t flags,
int32_t width,
int32_t height,
int32_t refresh)
{
struct _GLFWmonitor* monitor = userData;
GLFWvidmode mode;
@ -86,7 +86,7 @@ static void outputHandleMode(void* userData,
monitor->wl.currentMode = monitor->modeCount - 1;
}
static void outputHandleDone(void* userData, struct wl_output* output)
static void _glfwOutputHandleDoneWayland(void* userData, struct wl_output* output)
{
struct _GLFWmonitor* monitor = userData;
@ -107,9 +107,9 @@ static void outputHandleDone(void* userData, struct wl_output* output)
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
}
static void outputHandleScale(void* userData,
struct wl_output* output,
int32_t factor)
static void _glfwOutputHandleScaleWayland(void* userData,
struct wl_output* output,
int32_t factor)
{
struct _GLFWmonitor* monitor = userData;
@ -129,27 +129,27 @@ static void outputHandleScale(void* userData,
}
}
void outputHandleName(void* userData, struct wl_output* wl_output, const char* name)
void _glfwOutputHandleNameWayland(void* userData, struct wl_output* wl_output, const char* name)
{
struct _GLFWmonitor* monitor = userData;
strncpy(monitor->name, name, sizeof(monitor->name) - 1);
}
void outputHandleDescription(void* userData,
struct wl_output* wl_output,
const char* description)
static void _glfwOutputHandleDescriptionWayland(void* userData,
struct wl_output* wl_output,
const char* description)
{
}
static const struct wl_output_listener outputListener =
static const struct wl_output_listener _glfwOutputListenerWayland =
{
outputHandleGeometry,
outputHandleMode,
outputHandleDone,
outputHandleScale,
outputHandleName,
outputHandleDescription,
_glfwOutputHandleGeometryWayland,
_glfwOutputHandleModeWayland,
_glfwOutputHandleDoneWayland,
_glfwOutputHandleScaleWayland,
_glfwOutputHandleNameWayland,
_glfwOutputHandleDescriptionWayland,
};
@ -182,7 +182,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
monitor->wl.name = name;
wl_proxy_set_tag((struct wl_proxy*) output, &_glfw.wl.tag);
wl_output_add_listener(output, &outputListener, monitor);
wl_output_add_listener(output, &_glfwOutputListenerWayland, monitor);
}

File diff suppressed because it is too large Load diff

View file

@ -44,7 +44,7 @@
// NOTE: This is only used as a fallback, in case the XKB method fails
// It is layout-dependent and will fail partially on most non-US layouts
//
static int translateKeySyms(const KeySym* keysyms, int width)
static int _glfwTranslateKeySymsX11(const KeySym* keysyms, int width)
{
if (width > 1)
{
@ -210,7 +210,7 @@ static int translateKeySyms(const KeySym* keysyms, int width)
// Create key code translation tables
//
static void createKeyTables(void)
static void _glfwCreateKeyTablesX11(void)
{
int scancodeMin, scancodeMax;
@ -424,7 +424,7 @@ static void createKeyTables(void)
if (_glfw.x11.keycodes[scancode] < 0)
{
const size_t base = (scancode - scancodeMin) * width;
_glfw.x11.keycodes[scancode] = translateKeySyms(&keysyms[base], width);
_glfw.x11.keycodes[scancode] = _glfwTranslateKeySymsX11(&keysyms[base], width);
}
// Store the reverse translation for faster key name lookup
@ -437,7 +437,7 @@ static void createKeyTables(void)
// Check whether the IM has a usable style
//
static GLFWbool hasUsableInputMethodStyle(void)
static GLFWbool _glfwHasUsableInputMethodStyleX11(void)
{
GLFWbool found = GLFW_FALSE;
XIMStyles* styles = NULL;
@ -458,14 +458,14 @@ static GLFWbool hasUsableInputMethodStyle(void)
return found;
}
static void inputMethodDestroyCallback(XIM im, XPointer clientData, XPointer callData)
static void _glfwInputMethodDestroyCallbackX11(XIM im, XPointer clientData, XPointer callData)
{
_glfw.x11.im = NULL;
}
static void inputMethodInstantiateCallback(Display* display,
XPointer clientData,
XPointer callData)
static void _glfwInputMethodInstantiateCallbackX11(Display* display,
XPointer clientData,
XPointer callData)
{
if (_glfw.x11.im)
return;
@ -473,7 +473,7 @@ static void inputMethodInstantiateCallback(Display* display,
_glfw.x11.im = XOpenIM(_glfw.x11.display, 0, NULL, NULL);
if (_glfw.x11.im)
{
if (!hasUsableInputMethodStyle())
if (!_glfwHasUsableInputMethodStyleX11())
{
XCloseIM(_glfw.x11.im);
_glfw.x11.im = NULL;
@ -483,7 +483,7 @@ static void inputMethodInstantiateCallback(Display* display,
if (_glfw.x11.im)
{
XIMCallback callback;
callback.callback = (XIMProc) inputMethodDestroyCallback;
callback.callback = (XIMProc) _glfwInputMethodDestroyCallbackX11;
callback.client_data = NULL;
XSetIMValues(_glfw.x11.im, XNDestroyCallback, &callback, NULL);
@ -494,7 +494,7 @@ static void inputMethodInstantiateCallback(Display* display,
// Return the atom ID only if it is listed in the specified array
//
static Atom getAtomIfSupported(Atom* supportedAtoms,
static Atom _glfwGetAtomIfSupportedX11(Atom* supportedAtoms,
unsigned long atomCount,
const char* atomName)
{
@ -511,7 +511,7 @@ static Atom getAtomIfSupported(Atom* supportedAtoms,
// Check whether the running window manager is EWMH-compliant
//
static void detectEWMH(void)
static void _glfwdetectEWMHX11(void)
{
// First we read the _NET_SUPPORTING_WM_CHECK property on the root window
@ -569,33 +569,33 @@ static void detectEWMH(void)
// See which of the atoms we support that are supported by the WM
_glfw.x11.NET_WM_STATE =
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE");
_glfwGetAtomIfSupportedX11(supportedAtoms, atomCount, "_NET_WM_STATE");
_glfw.x11.NET_WM_STATE_ABOVE =
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_ABOVE");
_glfwGetAtomIfSupportedX11(supportedAtoms, atomCount, "_NET_WM_STATE_ABOVE");
_glfw.x11.NET_WM_STATE_FULLSCREEN =
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_FULLSCREEN");
_glfwGetAtomIfSupportedX11(supportedAtoms, atomCount, "_NET_WM_STATE_FULLSCREEN");
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT =
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_VERT");
_glfwGetAtomIfSupportedX11(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_VERT");
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ =
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_HORZ");
_glfwGetAtomIfSupportedX11(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_HORZ");
_glfw.x11.NET_WM_STATE_DEMANDS_ATTENTION =
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_DEMANDS_ATTENTION");
_glfwGetAtomIfSupportedX11(supportedAtoms, atomCount, "_NET_WM_STATE_DEMANDS_ATTENTION");
_glfw.x11.NET_WM_FULLSCREEN_MONITORS =
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_FULLSCREEN_MONITORS");
_glfwGetAtomIfSupportedX11(supportedAtoms, atomCount, "_NET_WM_FULLSCREEN_MONITORS");
_glfw.x11.NET_WM_WINDOW_TYPE =
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE");
_glfwGetAtomIfSupportedX11(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE");
_glfw.x11.NET_WM_WINDOW_TYPE_NORMAL =
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE_NORMAL");
_glfwGetAtomIfSupportedX11(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE_NORMAL");
_glfw.x11.NET_WORKAREA =
getAtomIfSupported(supportedAtoms, atomCount, "_NET_WORKAREA");
_glfwGetAtomIfSupportedX11(supportedAtoms, atomCount, "_NET_WORKAREA");
_glfw.x11.NET_CURRENT_DESKTOP =
getAtomIfSupported(supportedAtoms, atomCount, "_NET_CURRENT_DESKTOP");
_glfwGetAtomIfSupportedX11(supportedAtoms, atomCount, "_NET_CURRENT_DESKTOP");
_glfw.x11.NET_ACTIVE_WINDOW =
getAtomIfSupported(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW");
_glfwGetAtomIfSupportedX11(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW");
_glfw.x11.NET_FRAME_EXTENTS =
getAtomIfSupported(supportedAtoms, atomCount, "_NET_FRAME_EXTENTS");
_glfwGetAtomIfSupportedX11(supportedAtoms, atomCount, "_NET_FRAME_EXTENTS");
_glfw.x11.NET_REQUEST_FRAME_EXTENTS =
getAtomIfSupported(supportedAtoms, atomCount, "_NET_REQUEST_FRAME_EXTENTS");
_glfwGetAtomIfSupportedX11(supportedAtoms, atomCount, "_NET_REQUEST_FRAME_EXTENTS");
if (supportedAtoms)
XFree(supportedAtoms);
@ -603,7 +603,7 @@ static void detectEWMH(void)
// Look for and initialize supported X11 extensions
//
static GLFWbool initExtensions(void)
static GLFWbool _glfwInitExtensionsX11(void)
{
#if defined(__OpenBSD__) || defined(__NetBSD__)
_glfw.x11.vidmode.handle = _glfwPlatformLoadModule("libXxf86vm.so");
@ -909,7 +909,7 @@ static GLFWbool initExtensions(void)
// Update the key code LUT
// FIXME: We should listen to XkbMapNotify events to track changes to
// the keyboard mapping.
createKeyTables();
_glfwCreateKeyTablesX11();
// String format atoms
_glfw.x11.NULL_ = XInternAtom(_glfw.x11.display, "NULL", False);
@ -947,7 +947,7 @@ static GLFWbool initExtensions(void)
// ICCCM, EWMH and Motif window property atoms
// These can be set safely even without WM support
// The EWMH atoms that require WM support are handled in detectEWMH
// The EWMH atoms that require WM support are handled in _glfwdetectEWMHX11
_glfw.x11.WM_PROTOCOLS =
XInternAtom(_glfw.x11.display, "WM_PROTOCOLS", False);
_glfw.x11.WM_STATE =
@ -983,14 +983,14 @@ static GLFWbool initExtensions(void)
}
// Detect whether an EWMH-conformant window manager is running
detectEWMH();
_glfwdetectEWMHX11();
return GLFW_TRUE;
}
// Retrieve system content scale via folklore heuristics
//
static void getSystemContentScale(float* xscale, float* yscale)
static void _glfwGetSystemContentScaleX11(float* xscale, float* yscale)
{
// Start by assuming the default X11 DPI
// NOTE: Some desktop environments (KDE) may remove the Xft.dpi field when it
@ -1025,7 +1025,7 @@ static void getSystemContentScale(float* xscale, float* yscale)
// Create a blank cursor for hidden and disabled cursor modes
//
static Cursor createHiddenCursor(void)
static Cursor _glfwCreateHiddenCursorX11(void)
{
unsigned char pixels[16 * 16 * 4] = { 0 };
GLFWimage image = { 16, 16, pixels };
@ -1034,7 +1034,7 @@ static Cursor createHiddenCursor(void)
// Create a helper window for IPC
//
static Window createHelperWindow(void)
static Window _glfwCreateHelperWindowX11(void)
{
XSetWindowAttributes wa;
wa.event_mask = PropertyChangeMask;
@ -1048,7 +1048,7 @@ static Window createHelperWindow(void)
// Create the pipe for empty events without assumuing the OS has pipe2(2)
//
static GLFWbool createEmptyEventPipe(void)
static GLFWbool _glfwCreateEmptyEventPipeX11(void)
{
if (pipe(_glfw.x11.emptyEventPipe) != 0)
{
@ -1079,7 +1079,7 @@ static GLFWbool createEmptyEventPipe(void)
// X error handler
//
static int errorHandler(Display *display, XErrorEvent* event)
static int _glfwErrorHandlerX11(Display *display, XErrorEvent* event)
{
if (_glfw.x11.display != display)
return 0;
@ -1099,7 +1099,7 @@ void _glfwGrabErrorHandlerX11(void)
{
assert(_glfw.x11.errorHandler == NULL);
_glfw.x11.errorCode = Success;
_glfw.x11.errorHandler = XSetErrorHandler(errorHandler);
_glfw.x11.errorHandler = XSetErrorHandler(_glfwErrorHandlerX11);
}
// Clears the X error handler callback
@ -1526,16 +1526,16 @@ int _glfwInitX11(void)
_glfw.x11.root = RootWindow(_glfw.x11.display, _glfw.x11.screen);
_glfw.x11.context = XUniqueContext();
getSystemContentScale(&_glfw.x11.contentScaleX, &_glfw.x11.contentScaleY);
_glfwGetSystemContentScaleX11(&_glfw.x11.contentScaleX, &_glfw.x11.contentScaleY);
if (!createEmptyEventPipe())
if (!_glfwCreateEmptyEventPipeX11())
return GLFW_FALSE;
if (!initExtensions())
if (!_glfwInitExtensionsX11())
return GLFW_FALSE;
_glfw.x11.helperWindowHandle = createHelperWindow();
_glfw.x11.hiddenCursorHandle = createHiddenCursor();
_glfw.x11.helperWindowHandle = _glfwCreateHelperWindowX11();
_glfw.x11.hiddenCursorHandle = _glfwCreateHiddenCursorX11();
if (XSupportsLocale() && _glfw.x11.xlib.utf8)
{
@ -1544,7 +1544,7 @@ int _glfwInitX11(void)
// If an IM is already present our callback will be called right away
XRegisterIMInstantiateCallback(_glfw.x11.display,
NULL, NULL, NULL,
inputMethodInstantiateCallback,
_glfwInputMethodInstantiateCallbackX11,
NULL);
}
@ -1577,7 +1577,7 @@ void _glfwTerminateX11(void)
XUnregisterIMInstantiateCallback(_glfw.x11.display,
NULL, NULL, NULL,
inputMethodInstantiateCallback,
_glfwInputMethodInstantiateCallbackX11,
NULL);
if (_glfw.x11.im)

View file

@ -38,14 +38,14 @@
// Check whether the display mode should be included in enumeration
//
static GLFWbool modeIsGood(const XRRModeInfo* mi)
static GLFWbool _glfwModeIsGoodX11(const XRRModeInfo* mi)
{
return (mi->modeFlags & RR_Interlace) == 0;
}
// Calculates the refresh rate, in Hz, from the specified RandR mode info
//
static int calculateRefreshRate(const XRRModeInfo* mi)
static int _glfwCalculateRefreshRateX11(const XRRModeInfo* mi)
{
if (mi->hTotal && mi->vTotal)
return (int) round((double) mi->dotClock / ((double) mi->hTotal * (double) mi->vTotal));
@ -55,7 +55,7 @@ static int calculateRefreshRate(const XRRModeInfo* mi)
// Returns the mode info for a RandR mode XID
//
static const XRRModeInfo* getModeInfo(const XRRScreenResources* sr, RRMode id)
static const XRRModeInfo* _glfwGetModeInfoX11(const XRRScreenResources* sr, RRMode id)
{
for (int i = 0; i < sr->nmode; i++)
{
@ -68,8 +68,8 @@ static const XRRModeInfo* getModeInfo(const XRRScreenResources* sr, RRMode id)
// Convert RandR mode info to GLFW video mode
//
static GLFWvidmode vidmodeFromModeInfo(const XRRModeInfo* mi,
const XRRCrtcInfo* ci)
static GLFWvidmode _glfwVidmodeFromModeInfoX11(const XRRModeInfo* mi,
const XRRCrtcInfo* ci)
{
GLFWvidmode mode;
@ -84,7 +84,7 @@ static GLFWvidmode vidmodeFromModeInfo(const XRRModeInfo* mi,
mode.height = mi->height;
}
mode.refreshRate = calculateRefreshRate(mi);
mode.refreshRate = _glfwCalculateRefreshRateX11(mi);
_glfwSplitBPP(DefaultDepth(_glfw.x11.display, _glfw.x11.screen),
&mode.redBits, &mode.greenBits, &mode.blueBits);
@ -250,11 +250,11 @@ void _glfwSetVideoModeX11(_GLFWmonitor* monitor, const GLFWvidmode* desired)
for (int i = 0; i < oi->nmode; i++)
{
const XRRModeInfo* mi = getModeInfo(sr, oi->modes[i]);
if (!modeIsGood(mi))
const XRRModeInfo* mi = _glfwGetModeInfoX11(sr, oi->modes[i]);
if (!_glfwModeIsGoodX11(mi))
continue;
const GLFWvidmode mode = vidmodeFromModeInfo(mi, ci);
const GLFWvidmode mode = _glfwVidmodeFromModeInfoX11(mi, ci);
if (_glfwCompareVideoModes(best, &mode) == 0)
{
native = mi->id;
@ -367,7 +367,7 @@ void _glfwGetMonitorWorkareaX11(_GLFWmonitor* monitor,
areaX = ci->x;
areaY = ci->y;
const XRRModeInfo* mi = getModeInfo(sr, ci->mode);
const XRRModeInfo* mi = _glfwGetModeInfoX11(sr, ci->mode);
if (ci->rotation == RR_Rotate_90 || ci->rotation == RR_Rotate_270)
{
@ -463,11 +463,11 @@ GLFWvidmode* _glfwGetVideoModesX11(_GLFWmonitor* monitor, int* count)
for (int i = 0; i < oi->nmode; i++)
{
const XRRModeInfo* mi = getModeInfo(sr, oi->modes[i]);
if (!modeIsGood(mi))
const XRRModeInfo* mi = _glfwGetModeInfoX11(sr, oi->modes[i]);
if (!_glfwModeIsGoodX11(mi))
continue;
const GLFWvidmode mode = vidmodeFromModeInfo(mi, ci);
const GLFWvidmode mode = _glfwVidmodeFromModeInfoX11(mi, ci);
int j;
for (j = 0; j < *count; j++)
@ -509,9 +509,9 @@ GLFWbool _glfwGetVideoModeX11(_GLFWmonitor* monitor, GLFWvidmode* mode)
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
if (ci)
{
mi = getModeInfo(sr, ci->mode);
mi = _glfwGetModeInfoX11(sr, ci->mode);
if (mi)
*mode = vidmodeFromModeInfo(mi, ci);
*mode = _glfwVidmodeFromModeInfoX11(mi, ci);
XRRFreeCrtcInfo(ci);
}

View file

@ -997,7 +997,6 @@ void _glfwTerminateGLX(void);
GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig);
void _glfwDestroyContextGLX(_GLFWwindow* window);
GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig,

View file

@ -60,7 +60,7 @@
// This avoids blocking other threads via the per-display Xlib lock that also
// covers GLX functions
//
static GLFWbool waitForX11Event(double* timeout)
static GLFWbool _glfwWaitForEventX11(double* timeout)
{
struct pollfd fd = { ConnectionNumber(_glfw.x11.display), POLLIN };
@ -77,7 +77,7 @@ static GLFWbool waitForX11Event(double* timeout)
// This avoids blocking other threads via the per-display Xlib lock that also
// covers GLX functions
//
static GLFWbool waitForAnyEvent(double* timeout)
static GLFWbool _glfwWaitForAnyEventX11(double* timeout)
{
enum { XLIB_FD, PIPE_FD, INOTIFY_FD };
struct pollfd fds[] =
@ -109,7 +109,7 @@ static GLFWbool waitForAnyEvent(double* timeout)
// Writes a byte to the empty event pipe
//
static void writeEmptyEvent(void)
static void _glfwWriteEmptyEventX11(void)
{
for (;;)
{
@ -122,7 +122,7 @@ static void writeEmptyEvent(void)
// Drains available data from the empty event pipe
//
static void drainEmptyEvents(void)
static void _glfwDrainEmptyEventsX11(void)
{
for (;;)
{
@ -136,7 +136,7 @@ static void drainEmptyEvents(void)
// Waits until a VisibilityNotify event arrives for the specified window or the
// timeout period elapses (ICCCM section 4.2.2)
//
static GLFWbool waitForVisibilityNotify(_GLFWwindow* window)
static GLFWbool _glfwWaitForVisibilityNotifyX11(_GLFWwindow* window)
{
XEvent dummy;
double timeout = 0.1;
@ -146,7 +146,7 @@ static GLFWbool waitForVisibilityNotify(_GLFWwindow* window)
VisibilityNotify,
&dummy))
{
if (!waitForX11Event(&timeout))
if (!_glfwWaitForEventX11(&timeout))
return GLFW_FALSE;
}
@ -155,7 +155,7 @@ static GLFWbool waitForVisibilityNotify(_GLFWwindow* window)
// Returns whether the window is iconified
//
static int getWindowState(_GLFWwindow* window)
static int _glfwGetWindowStateX11(_GLFWwindow* window)
{
int result = WithdrawnState;
struct {
@ -179,7 +179,7 @@ static int getWindowState(_GLFWwindow* window)
// Returns whether the event is a selection event
//
static Bool isSelectionEvent(Display* display, XEvent* event, XPointer pointer)
static Bool _glfwIsSelectionEventX11(Display* display, XEvent* event, XPointer pointer)
{
if (event->xany.window != _glfw.x11.helperWindowHandle)
return False;
@ -191,7 +191,7 @@ static Bool isSelectionEvent(Display* display, XEvent* event, XPointer pointer)
// Returns whether it is a _NET_FRAME_EXTENTS event for the specified window
//
static Bool isFrameExtentsEvent(Display* display, XEvent* event, XPointer pointer)
static Bool _glfwIsFrameExtentsEventX11(Display* display, XEvent* event, XPointer pointer)
{
_GLFWwindow* window = (_GLFWwindow*) pointer;
return event->type == PropertyNotify &&
@ -202,7 +202,7 @@ static Bool isFrameExtentsEvent(Display* display, XEvent* event, XPointer pointe
// Returns whether it is a property event for the specified selection transfer
//
static Bool isSelPropNewValueNotify(Display* display, XEvent* event, XPointer pointer)
static Bool _glfwIsSelPropNewValueNotifyX11(Display* display, XEvent* event, XPointer pointer)
{
XEvent* notification = (XEvent*) pointer;
return event->type == PropertyNotify &&
@ -213,7 +213,7 @@ static Bool isSelPropNewValueNotify(Display* display, XEvent* event, XPointer po
// Translates an X event modifier state mask
//
static int translateState(int state)
static int _glfwTranslateStateX11(int state)
{
int mods = 0;
@ -235,7 +235,7 @@ static int translateState(int state)
// Translates an X11 key code to a GLFW key token
//
static int translateKey(int scancode)
static int _glfwTranslateKeyX11(int scancode)
{
// Use the pre-filled LUT (see createKeyTables() in x11_init.c)
if (scancode < 0 || scancode > 255)
@ -246,7 +246,7 @@ static int translateKey(int scancode)
// Sends an EWMH or ICCCM event to the window manager
//
static void sendEventToWM(_GLFWwindow* window, Atom type,
static void _glfwSendEventToWMX11(_GLFWwindow* window, Atom type,
long a, long b, long c, long d, long e)
{
XEvent event = { ClientMessage };
@ -267,7 +267,7 @@ static void sendEventToWM(_GLFWwindow* window, Atom type,
// Updates the normal hints according to the window settings
//
static void updateNormalHints(_GLFWwindow* window, int width, int height)
static void _glfwUpdateNormalHintsX11(_GLFWwindow* window, int width, int height)
{
XSizeHints* hints = XAllocSizeHints();
@ -318,14 +318,14 @@ static void updateNormalHints(_GLFWwindow* window, int width, int height)
// Updates the full screen status of the window
//
static void updateWindowMode(_GLFWwindow* window)
static void _glfwUpdateWindowModeX11(_GLFWwindow* window)
{
if (window->monitor)
{
if (_glfw.x11.xinerama.available &&
_glfw.x11.NET_WM_FULLSCREEN_MONITORS)
{
sendEventToWM(window,
_glfwSendEventToWMX11(window,
_glfw.x11.NET_WM_FULLSCREEN_MONITORS,
window->monitor->x11.index,
window->monitor->x11.index,
@ -336,7 +336,7 @@ static void updateWindowMode(_GLFWwindow* window)
if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_FULLSCREEN)
{
sendEventToWM(window,
_glfwSendEventToWMX11(window,
_glfw.x11.NET_WM_STATE,
_NET_WM_STATE_ADD,
_glfw.x11.NET_WM_STATE_FULLSCREEN,
@ -383,7 +383,7 @@ static void updateWindowMode(_GLFWwindow* window)
if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_FULLSCREEN)
{
sendEventToWM(window,
_glfwSendEventToWMX11(window,
_glfw.x11.NET_WM_STATE,
_NET_WM_STATE_REMOVE,
_glfw.x11.NET_WM_STATE_FULLSCREEN,
@ -413,7 +413,7 @@ static void updateWindowMode(_GLFWwindow* window)
// Decode a Unicode code point from a UTF-8 stream
// Based on cutef8 by Jeff Bezanson (Public Domain)
//
static uint32_t decodeUTF8(const char** s)
static uint32_t _glfwDecodeUTF8X11(const char** s)
{
uint32_t codepoint = 0, count = 0;
static const uint32_t offsets[] =
@ -435,7 +435,7 @@ static uint32_t decodeUTF8(const char** s)
// Convert the specified Latin-1 string to UTF-8
//
static char* convertLatin1toUTF8(const char* source)
static char* _glfwConvertLatin1toUTF8X11(const char* source)
{
size_t size = 1;
const char* sp;
@ -454,7 +454,7 @@ static char* convertLatin1toUTF8(const char* source)
// Updates the cursor image according to its cursor mode
//
static void updateCursorImage(_GLFWwindow* window)
static void _glfwUpdateCursorImageX11(_GLFWwindow* window)
{
if (window->cursorMode == GLFW_CURSOR_NORMAL ||
window->cursorMode == GLFW_CURSOR_CAPTURED)
@ -476,7 +476,7 @@ static void updateCursorImage(_GLFWwindow* window)
// Grabs the cursor and confines it to the window
//
static void captureCursor(_GLFWwindow* window)
static void _glfwCaptureCursorX11(_GLFWwindow* window)
{
XGrabPointer(_glfw.x11.display, window->x11.handle, True,
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
@ -488,14 +488,14 @@ static void captureCursor(_GLFWwindow* window)
// Ungrabs the cursor
//
static void releaseCursor(void)
static void _glfwReleaseCursorX11(void)
{
XUngrabPointer(_glfw.x11.display, CurrentTime);
}
// Enable XI2 raw mouse motion events
//
static void enableRawMouseMotion(_GLFWwindow* window)
static void _glfwEnableRawMouseMotionX11(_GLFWwindow* window)
{
XIEventMask em;
unsigned char mask[XIMaskLen(XI_RawMotion)] = { 0 };
@ -510,7 +510,7 @@ static void enableRawMouseMotion(_GLFWwindow* window)
// Disable XI2 raw mouse motion events
//
static void disableRawMouseMotion(_GLFWwindow* window)
static void _glfwDisableRawMouseMotionX11(_GLFWwindow* window)
{
XIEventMask em;
unsigned char mask[] = { 0 };
@ -524,38 +524,38 @@ static void disableRawMouseMotion(_GLFWwindow* window)
// Apply disabled cursor mode to a focused window
//
static void disableCursor(_GLFWwindow* window)
static void _glfwDisableCursorX11(_GLFWwindow* window)
{
if (window->rawMouseMotion)
enableRawMouseMotion(window);
_glfwEnableRawMouseMotionX11(window);
_glfw.x11.disabledCursorWindow = window;
_glfwGetCursorPosX11(window,
&_glfw.x11.restoreCursorPosX,
&_glfw.x11.restoreCursorPosY);
updateCursorImage(window);
_glfwUpdateCursorImageX11(window);
_glfwCenterCursorInContentArea(window);
captureCursor(window);
_glfwCaptureCursorX11(window);
}
// Exit disabled cursor mode for the specified window
//
static void enableCursor(_GLFWwindow* window)
static void _glfwEnableCursorX11(_GLFWwindow* window)
{
if (window->rawMouseMotion)
disableRawMouseMotion(window);
_glfwDisableRawMouseMotionX11(window);
_glfw.x11.disabledCursorWindow = NULL;
releaseCursor();
_glfwReleaseCursorX11();
_glfwSetCursorPosX11(window,
_glfw.x11.restoreCursorPosX,
_glfw.x11.restoreCursorPosY);
updateCursorImage(window);
_glfwUpdateCursorImageX11(window);
}
// Clear its handle when the input context has been destroyed
//
static void inputContextDestroyCallback(XIC ic, XPointer clientData, XPointer callData)
static void _glfwInputContextDestroyCallbackX11(XIC ic, XPointer clientData, XPointer callData)
{
_GLFWwindow* window = (_GLFWwindow*) clientData;
window->x11.ic = NULL;
@ -563,9 +563,9 @@ static void inputContextDestroyCallback(XIC ic, XPointer clientData, XPointer ca
// Create the X11 window (and its colormap)
//
static GLFWbool createNativeWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
Visual* visual, int depth)
static GLFWbool _glfwCreateNativeWindowX11(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
Visual* visual, int depth)
{
int width = wndconfig->width;
int height = wndconfig->height;
@ -793,7 +793,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
// Set the specified property to the selection converted to the requested target
//
static Atom writeTargetToProperty(const XSelectionRequestEvent* request)
static Atom _glfwWriteTargetToPropertyX11(const XSelectionRequestEvent* request)
{
char* selectionString = NULL;
const Atom formats[] = { _glfw.x11.UTF8_STRING, XA_STRING };
@ -925,12 +925,12 @@ static Atom writeTargetToProperty(const XSelectionRequestEvent* request)
return None;
}
static void handleSelectionRequest(XEvent* event)
static void _glfwHandleSelectionRequestX11(XEvent* event)
{
const XSelectionRequestEvent* request = &event->xselectionrequest;
XEvent reply = { SelectionNotify };
reply.xselection.property = writeTargetToProperty(request);
reply.xselection.property = _glfwWriteTargetToPropertyX11(request);
reply.xselection.display = request->display;
reply.xselection.requestor = request->requestor;
reply.xselection.selection = request->selection;
@ -940,7 +940,7 @@ static void handleSelectionRequest(XEvent* event)
XSendEvent(_glfw.x11.display, request->requestor, False, 0, &reply);
}
static const char* getSelectionString(Atom selection)
static const char* _glfwGetSelectionStringX11(Atom selection)
{
char** selectionString = NULL;
const Atom targets[] = { _glfw.x11.UTF8_STRING, XA_STRING };
@ -982,7 +982,7 @@ static const char* getSelectionString(Atom selection)
SelectionNotify,
&notification))
{
waitForX11Event(NULL);
_glfwWaitForEventX11(NULL);
}
if (notification.xselection.property == None)
@ -990,7 +990,7 @@ static const char* getSelectionString(Atom selection)
XCheckIfEvent(_glfw.x11.display,
&dummy,
isSelPropNewValueNotify,
_glfwIsSelPropNewValueNotifyX11,
(XPointer) &notification);
XGetWindowProperty(_glfw.x11.display,
@ -1015,10 +1015,10 @@ static const char* getSelectionString(Atom selection)
{
while (!XCheckIfEvent(_glfw.x11.display,
&dummy,
isSelPropNewValueNotify,
_glfwIsSelPropNewValueNotifyX11,
(XPointer) &notification))
{
waitForX11Event(NULL);
_glfwWaitForEventX11(NULL);
}
XFree(data);
@ -1049,7 +1049,7 @@ static const char* getSelectionString(Atom selection)
{
if (targets[i] == XA_STRING)
{
*selectionString = convertLatin1toUTF8(string);
*selectionString = _glfwConvertLatin1toUTF8X11(string);
_glfw_free(string);
}
else
@ -1063,7 +1063,7 @@ static const char* getSelectionString(Atom selection)
else if (actualType == targets[i])
{
if (targets[i] == XA_STRING)
*selectionString = convertLatin1toUTF8(data);
*selectionString = _glfwConvertLatin1toUTF8X11(data);
else
*selectionString = _glfw_strdup(data);
}
@ -1085,7 +1085,7 @@ static const char* getSelectionString(Atom selection)
// Make the specified window and its video mode active on its monitor
//
static void acquireMonitor(_GLFWwindow* window)
static void _glfwAcquireMonitorX11(_GLFWwindow* window)
{
if (_glfw.x11.saver.count == 0)
{
@ -1124,7 +1124,7 @@ static void acquireMonitor(_GLFWwindow* window)
// Remove the window and restore the original video mode
//
static void releaseMonitor(_GLFWwindow* window)
static void _glfwReleaseMonitorX11(_GLFWwindow* window)
{
if (window->monitor->window != window)
return;
@ -1147,7 +1147,7 @@ static void releaseMonitor(_GLFWwindow* window)
// Process the specified X event
//
static void processEvent(XEvent *event)
static void _glfwProcessEventX11(XEvent *event)
{
int keycode = 0;
Bool filtered = False;
@ -1222,7 +1222,7 @@ static void processEvent(XEvent *event)
if (event->type == SelectionRequest)
{
handleSelectionRequest(event);
_glfwHandleSelectionRequestX11(event);
return;
}
@ -1246,8 +1246,8 @@ static void processEvent(XEvent *event)
case KeyPress:
{
const int key = translateKey(keycode);
const int mods = translateState(event->xkey.state);
const int key = _glfwTranslateKeyX11(keycode);
const int mods = _glfwTranslateStateX11(event->xkey.state);
const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT));
if (window->x11.ic)
@ -1294,7 +1294,7 @@ static void processEvent(XEvent *event)
const char* c = chars;
chars[count] = '\0';
while (c - chars < count)
_glfwInputChar(window, decodeUTF8(&c), mods, plain);
_glfwInputChar(window, _glfwDecodeUTF8X11(&c), mods, plain);
}
if (chars != buffer)
@ -1318,8 +1318,8 @@ static void processEvent(XEvent *event)
case KeyRelease:
{
const int key = translateKey(keycode);
const int mods = translateState(event->xkey.state);
const int key = _glfwTranslateKeyX11(keycode);
const int mods = _glfwTranslateStateX11(event->xkey.state);
if (!_glfw.x11.xkb.detectable)
{
@ -1359,7 +1359,7 @@ static void processEvent(XEvent *event)
case ButtonPress:
{
const int mods = translateState(event->xbutton.state);
const int mods = _glfwTranslateStateX11(event->xbutton.state);
if (event->xbutton.button == Button1)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS, mods);
@ -1393,7 +1393,7 @@ static void processEvent(XEvent *event)
case ButtonRelease:
{
const int mods = translateState(event->xbutton.state);
const int mods = _glfwTranslateStateX11(event->xbutton.state);
if (event->xbutton.button == Button1)
{
@ -1438,7 +1438,7 @@ static void processEvent(XEvent *event)
// HACK: This is a workaround for WMs (KWM, Fluxbox) that otherwise
// ignore the defined cursor for hidden cursor mode
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
updateCursorImage(window);
_glfwUpdateCursorImageX11(window);
_glfwInputCursorEnter(window, GLFW_TRUE);
_glfwInputCursorPos(window, x, y);
@ -1751,9 +1751,9 @@ static void processEvent(XEvent *event)
}
if (window->cursorMode == GLFW_CURSOR_DISABLED)
disableCursor(window);
_glfwDisableCursorX11(window);
else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
captureCursor(window);
_glfwCaptureCursorX11(window);
if (window->x11.ic)
XSetICFocus(window->x11.ic);
@ -1773,9 +1773,9 @@ static void processEvent(XEvent *event)
}
if (window->cursorMode == GLFW_CURSOR_DISABLED)
enableCursor(window);
_glfwEnableCursorX11(window);
else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
releaseCursor();
_glfwReleaseCursorX11();
if (window->x11.ic)
XUnsetICFocus(window->x11.ic);
@ -1800,7 +1800,7 @@ static void processEvent(XEvent *event)
if (event->xproperty.atom == _glfw.x11.WM_STATE)
{
const int state = getWindowState(window);
const int state = _glfwGetWindowStateX11(window);
if (state != IconicState && state != NormalState)
return;
@ -1810,9 +1810,9 @@ static void processEvent(XEvent *event)
if (window->monitor)
{
if (iconified)
releaseMonitor(window);
_glfwReleaseMonitorX11(window);
else
acquireMonitor(window);
_glfwAcquireMonitorX11(window);
}
window->x11.iconified = iconified;
@ -1894,12 +1894,12 @@ void _glfwPushSelectionToManagerX11(void)
{
XEvent event;
while (XCheckIfEvent(_glfw.x11.display, &event, isSelectionEvent, NULL))
while (XCheckIfEvent(_glfw.x11.display, &event, _glfwIsSelectionEventX11, NULL))
{
switch (event.type)
{
case SelectionRequest:
handleSelectionRequest(&event);
_glfwHandleSelectionRequestX11(&event);
break;
case SelectionNotify:
@ -1919,14 +1919,14 @@ void _glfwPushSelectionToManagerX11(void)
}
}
waitForX11Event(NULL);
_glfwWaitForEventX11(NULL);
}
}
void _glfwCreateInputContextX11(_GLFWwindow* window)
{
XIMCallback callback;
callback.callback = (XIMProc) inputContextDestroyCallback;
callback.callback = (XIMProc) _glfwInputContextDestroyCallbackX11;
callback.client_data = (XPointer) window;
window->x11.ic = XCreateIC(_glfw.x11.im,
@ -1997,7 +1997,7 @@ GLFWbool _glfwCreateWindowX11(_GLFWwindow* window,
depth = DefaultDepth(_glfw.x11.display, _glfw.x11.screen);
}
if (!createNativeWindow(window, wndconfig, visual, depth))
if (!_glfwCreateNativeWindowX11(window, wndconfig, visual, depth))
return GLFW_FALSE;
if (ctxconfig->client != GLFW_NO_API)
@ -2028,8 +2028,8 @@ GLFWbool _glfwCreateWindowX11(_GLFWwindow* window,
if (window->monitor)
{
_glfwShowWindowX11(window);
updateWindowMode(window);
acquireMonitor(window);
_glfwUpdateWindowModeX11(window);
_glfwAcquireMonitorX11(window);
if (wndconfig->centerCursor)
_glfwCenterCursorInContentArea(window);
@ -2051,10 +2051,10 @@ GLFWbool _glfwCreateWindowX11(_GLFWwindow* window,
void _glfwDestroyWindowX11(_GLFWwindow* window)
{
if (_glfw.x11.disabledCursorWindow == window)
enableCursor(window);
_glfwEnableCursorX11(window);
if (window->monitor)
releaseMonitor(window);
_glfwReleaseMonitorX11(window);
if (window->x11.ic)
{
@ -2214,12 +2214,12 @@ void _glfwSetWindowSizeX11(_GLFWwindow* window, int width, int height)
if (window->monitor)
{
if (window->monitor->window == window)
acquireMonitor(window);
_glfwAcquireMonitorX11(window);
}
else
{
if (!window->resizable)
updateNormalHints(window, width, height);
_glfwUpdateNormalHintsX11(window, width, height);
XResizeWindow(_glfw.x11.display, window->x11.handle, width, height);
}
@ -2233,7 +2233,7 @@ void _glfwSetWindowSizeLimitsX11(_GLFWwindow* window,
{
int width, height;
_glfwGetWindowSizeX11(window, &width, &height);
updateNormalHints(window, width, height);
_glfwUpdateNormalHintsX11(window, width, height);
XFlush(_glfw.x11.display);
}
@ -2241,7 +2241,7 @@ void _glfwSetWindowAspectRatioX11(_GLFWwindow* window, int numer, int denom)
{
int width, height;
_glfwGetWindowSizeX11(window, &width, &height);
updateNormalHints(window, width, height);
_glfwUpdateNormalHintsX11(window, width, height);
XFlush(_glfw.x11.display);
}
@ -2270,7 +2270,7 @@ void _glfwGetWindowFrameSizeX11(_GLFWwindow* window,
// Ensure _NET_FRAME_EXTENTS is set, allowing glfwGetWindowFrameSize to
// function before the window is mapped
sendEventToWM(window, _glfw.x11.NET_REQUEST_FRAME_EXTENTS,
_glfwSendEventToWMX11(window, _glfw.x11.NET_REQUEST_FRAME_EXTENTS,
0, 0, 0, 0, 0);
// HACK: Use a timeout because earlier versions of some window managers
@ -2280,10 +2280,10 @@ void _glfwGetWindowFrameSizeX11(_GLFWwindow* window,
// listed above, PLEASE report it to their and our issue trackers
while (!XCheckIfEvent(_glfw.x11.display,
&event,
isFrameExtentsEvent,
_glfwIsFrameExtentsEventX11,
(XPointer) window))
{
if (!waitForX11Event(&timeout))
if (!_glfwWaitForEventX11(&timeout))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: The window manager has a broken _NET_REQUEST_FRAME_EXTENTS implementation; please report this issue");
@ -2348,7 +2348,7 @@ void _glfwRestoreWindowX11(_GLFWwindow* window)
if (_glfwWindowIconifiedX11(window))
{
XMapWindow(_glfw.x11.display, window->x11.handle);
waitForVisibilityNotify(window);
_glfwWaitForVisibilityNotifyX11(window);
}
else if (_glfwWindowVisibleX11(window))
{
@ -2356,7 +2356,7 @@ void _glfwRestoreWindowX11(_GLFWwindow* window)
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT &&
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ)
{
sendEventToWM(window,
_glfwSendEventToWMX11(window,
_glfw.x11.NET_WM_STATE,
_NET_WM_STATE_REMOVE,
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT,
@ -2379,7 +2379,7 @@ void _glfwMaximizeWindowX11(_GLFWwindow* window)
if (_glfwWindowVisibleX11(window))
{
sendEventToWM(window,
_glfwSendEventToWMX11(window,
_glfw.x11.NET_WM_STATE,
_NET_WM_STATE_ADD,
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT,
@ -2471,7 +2471,7 @@ void _glfwShowWindowX11(_GLFWwindow* window)
}
XMapWindow(_glfw.x11.display, window->x11.handle);
waitForVisibilityNotify(window);
_glfwWaitForVisibilityNotifyX11(window);
}
void _glfwHideWindowX11(_GLFWwindow* window)
@ -2485,7 +2485,7 @@ void _glfwRequestWindowAttentionX11(_GLFWwindow* window)
if (!_glfw.x11.NET_WM_STATE || !_glfw.x11.NET_WM_STATE_DEMANDS_ATTENTION)
return;
sendEventToWM(window,
_glfwSendEventToWMX11(window,
_glfw.x11.NET_WM_STATE,
_NET_WM_STATE_ADD,
_glfw.x11.NET_WM_STATE_DEMANDS_ATTENTION,
@ -2495,7 +2495,7 @@ void _glfwRequestWindowAttentionX11(_GLFWwindow* window)
void _glfwFocusWindowX11(_GLFWwindow* window)
{
if (_glfw.x11.NET_ACTIVE_WINDOW)
sendEventToWM(window, _glfw.x11.NET_ACTIVE_WINDOW, 1, 0, 0, 0, 0);
_glfwSendEventToWMX11(window, _glfw.x11.NET_ACTIVE_WINDOW, 1, 0, 0, 0, 0);
else if (_glfwWindowVisibleX11(window))
{
XRaiseWindow(_glfw.x11.display, window->x11.handle);
@ -2517,12 +2517,12 @@ void _glfwSetWindowMonitorX11(_GLFWwindow* window,
if (monitor)
{
if (monitor->window == window)
acquireMonitor(window);
_glfwAcquireMonitorX11(window);
}
else
{
if (!window->resizable)
updateNormalHints(window, width, height);
_glfwUpdateNormalHintsX11(window, width, height);
XMoveResizeWindow(_glfw.x11.display, window->x11.handle,
xpos, ypos, width, height);
@ -2536,26 +2536,26 @@ void _glfwSetWindowMonitorX11(_GLFWwindow* window,
{
_glfwSetWindowDecoratedX11(window, window->decorated);
_glfwSetWindowFloatingX11(window, window->floating);
releaseMonitor(window);
_glfwReleaseMonitorX11(window);
}
_glfwInputWindowMonitor(window, monitor);
updateNormalHints(window, width, height);
_glfwUpdateNormalHintsX11(window, width, height);
if (window->monitor)
{
if (!_glfwWindowVisibleX11(window))
{
XMapRaised(_glfw.x11.display, window->x11.handle);
waitForVisibilityNotify(window);
_glfwWaitForVisibilityNotifyX11(window);
}
updateWindowMode(window);
acquireMonitor(window);
_glfwUpdateWindowModeX11(window);
_glfwAcquireMonitorX11(window);
}
else
{
updateWindowMode(window);
_glfwUpdateWindowModeX11(window);
XMoveResizeWindow(_glfw.x11.display, window->x11.handle,
xpos, ypos, width, height);
}
@ -2574,7 +2574,7 @@ GLFWbool _glfwWindowFocusedX11(_GLFWwindow* window)
GLFWbool _glfwWindowIconifiedX11(_GLFWwindow* window)
{
return getWindowState(window) == IconicState;
return _glfwGetWindowStateX11(window) == IconicState;
}
GLFWbool _glfwWindowVisibleX11(_GLFWwindow* window)
@ -2658,7 +2658,7 @@ void _glfwSetWindowResizableX11(_GLFWwindow* window, GLFWbool enabled)
{
int width, height;
_glfwGetWindowSizeX11(window, &width, &height);
updateNormalHints(window, width, height);
_glfwUpdateNormalHintsX11(window, width, height);
}
void _glfwSetWindowDecoratedX11(_GLFWwindow* window, GLFWbool enabled)
@ -2691,7 +2691,7 @@ void _glfwSetWindowFloatingX11(_GLFWwindow* window, GLFWbool enabled)
if (_glfwWindowVisibleX11(window))
{
const long action = enabled ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
sendEventToWM(window,
_glfwSendEventToWMX11(window,
_glfw.x11.NET_WM_STATE,
action,
_glfw.x11.NET_WM_STATE_ABOVE,
@ -2795,9 +2795,9 @@ void _glfwSetRawMouseMotionX11(_GLFWwindow *window, GLFWbool enabled)
return;
if (enabled)
enableRawMouseMotion(window);
_glfwEnableRawMouseMotionX11(window);
else
disableRawMouseMotion(window);
_glfwDisableRawMouseMotionX11(window);
}
GLFWbool _glfwRawMouseMotionSupportedX11(void)
@ -2807,7 +2807,7 @@ GLFWbool _glfwRawMouseMotionSupportedX11(void)
void _glfwPollEventsX11(void)
{
drainEmptyEvents();
_glfwDrainEmptyEventsX11();
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
if (_glfw.joysticksInitialized)
@ -2819,7 +2819,7 @@ void _glfwPollEventsX11(void)
{
XEvent event;
XNextEvent(_glfw.x11.display, &event);
processEvent(&event);
_glfwProcessEventX11(&event);
}
_GLFWwindow* window = _glfw.x11.disabledCursorWindow;
@ -2842,19 +2842,19 @@ void _glfwPollEventsX11(void)
void _glfwWaitEventsX11(void)
{
waitForAnyEvent(NULL);
_glfwWaitForAnyEventX11(NULL);
_glfwPollEventsX11();
}
void _glfwWaitEventsTimeoutX11(double timeout)
{
waitForAnyEvent(&timeout);
_glfwWaitForAnyEventX11(&timeout);
_glfwPollEventsX11();
}
void _glfwPostEmptyEventX11(void)
{
writeEmptyEvent();
_glfwWriteEmptyEventX11();
}
void _glfwGetCursorPosX11(_GLFWwindow* window, double* xpos, double* ypos)
@ -2896,18 +2896,18 @@ void _glfwSetCursorModeX11(_GLFWwindow* window, int mode)
&_glfw.x11.restoreCursorPosY);
_glfwCenterCursorInContentArea(window);
if (window->rawMouseMotion)
enableRawMouseMotion(window);
_glfwEnableRawMouseMotionX11(window);
}
else if (_glfw.x11.disabledCursorWindow == window)
{
if (window->rawMouseMotion)
disableRawMouseMotion(window);
_glfwDisableRawMouseMotionX11(window);
}
if (mode == GLFW_CURSOR_DISABLED || mode == GLFW_CURSOR_CAPTURED)
captureCursor(window);
_glfwCaptureCursorX11(window);
else
releaseCursor();
_glfwReleaseCursorX11();
if (mode == GLFW_CURSOR_DISABLED)
_glfw.x11.disabledCursorWindow = window;
@ -2920,7 +2920,7 @@ void _glfwSetCursorModeX11(_GLFWwindow* window, int mode)
}
}
updateCursorImage(window);
_glfwUpdateCursorImageX11(window);
XFlush(_glfw.x11.display);
}
@ -3081,7 +3081,7 @@ void _glfwSetCursorX11(_GLFWwindow* window, _GLFWcursor* cursor)
if (window->cursorMode == GLFW_CURSOR_NORMAL ||
window->cursorMode == GLFW_CURSOR_CAPTURED)
{
updateCursorImage(window);
_glfwUpdateCursorImageX11(window);
XFlush(_glfw.x11.display);
}
}
@ -3107,7 +3107,7 @@ void _glfwSetClipboardStringX11(const char* string)
const char* _glfwGetClipboardStringX11(void)
{
return getSelectionString(_glfw.x11.CLIPBOARD);
return _glfwGetSelectionStringX11(_glfw.x11.CLIPBOARD);
}
EGLenum _glfwGetEGLPlatformX11(EGLint** attribs)
@ -3170,14 +3170,14 @@ void _glfwGetRequiredInstanceExtensionsX11(char** extensions)
return;
}
extensions[0] = "VK_KHR_surface";
extensions[0] = (char*) "VK_KHR_surface";
// NOTE: VK_KHR_xcb_surface is preferred due to some early ICDs exposing but
// not correctly implementing VK_KHR_xlib_surface
if (_glfw.vk.KHR_xcb_surface && _glfw.x11.x11xcb.handle)
extensions[1] = "VK_KHR_xcb_surface";
extensions[1] = (char*) "VK_KHR_xcb_surface";
else
extensions[1] = "VK_KHR_xlib_surface";
extensions[1] = (char*) "VK_KHR_xlib_surface";
}
GLFWbool _glfwGetPhysicalDevicePresentationSupportX11(VkInstance instance,
@ -3380,7 +3380,7 @@ GLFWAPI const char* glfwGetX11SelectionString(void)
return NULL;
}
return getSelectionString(_glfw.x11.PRIMARY);
return _glfwGetSelectionStringX11(_glfw.x11.PRIMARY);
}
#endif // _GLFW_X11

View file

@ -65,7 +65,7 @@
//**** KeySym to Unicode mapping table ****
//************************************************************************
static const struct codepair {
static const struct _glfwCodepair {
unsigned short keysym;
unsigned short ucs;
} keysymtab[] = {
@ -909,7 +909,7 @@ static const struct codepair {
uint32_t _glfwKeySym2UnicodeX11(unsigned int keysym)
{
int min = 0;
int max = sizeof(keysymtab) / sizeof(struct codepair) - 1;
int max = sizeof(keysymtab) / sizeof(struct _glfwCodepair) - 1;
int mid;
// First check for Latin-1 characters (1:1 mapping)