Update C sources
This commit is contained in:
parent
efd3445362
commit
7ab77a4730
103 changed files with 25993 additions and 13806 deletions
724
raylib/external/glfw/include/GLFW/glfw3.h
vendored
724
raylib/external/glfw/include/GLFW/glfw3.h
vendored
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************
|
||||
* GLFW 3.3 - www.glfw.org
|
||||
* GLFW 3.4 - www.glfw.org
|
||||
* A library for OpenGL, window and input
|
||||
*------------------------------------------------------------------------
|
||||
* Copyright (c) 2002-2006 Marcus Geelnard
|
||||
|
@ -89,7 +89,7 @@ extern "C" {
|
|||
#undef APIENTRY
|
||||
#undef GLFW_APIENTRY_DEFINED
|
||||
#endif
|
||||
// RAY: Actually, only HWND handler needs to be defined
|
||||
// @raysan5: Actually, only HWND handler needs to be defined
|
||||
// Including windows.h could suppose symbols re-definition issues (i.e Rectangle type)
|
||||
//#include <windows.h>
|
||||
typedef void *PVOID;
|
||||
|
|
39
raylib/external/glfw/src/cocoa_init.m
vendored
39
raylib/external/glfw/src/cocoa_init.m
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 macOS - www.glfw.org
|
||||
// GLFW 3.4 macOS - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
//
|
||||
|
@ -23,6 +23,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
#include <sys/param.h> // For MAXPATHLEN
|
||||
|
@ -429,9 +431,8 @@ static GLFWbool initializeTIS(void)
|
|||
// In case we are unbundled, make us a proper UI application
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||
|
||||
// Menu bar setup must go between sharedApplication above and
|
||||
// finishLaunching below, in order to properly emulate the behavior
|
||||
// of NSApplicationMain
|
||||
// Menu bar setup must go between sharedApplication and finishLaunching
|
||||
// in order to properly emulate the behavior of NSApplicationMain
|
||||
|
||||
if ([[NSBundle mainBundle] pathForResource:@"MainMenu" ofType:@"nib"])
|
||||
{
|
||||
|
@ -446,9 +447,9 @@ static GLFWbool initializeTIS(void)
|
|||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
||||
{
|
||||
[NSApp stop:nil];
|
||||
|
||||
_glfw.ns.finishedLaunching = GLFW_TRUE;
|
||||
_glfwPlatformPostEmptyEvent();
|
||||
[NSApp stop:nil];
|
||||
}
|
||||
|
||||
- (void)applicationDidHide:(NSNotification *)notification
|
||||
|
@ -462,6 +463,32 @@ static GLFWbool initializeTIS(void)
|
|||
@end // GLFWApplicationDelegate
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW internal API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void* _glfwLoadLocalVulkanLoaderNS(void)
|
||||
{
|
||||
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||
if (!bundle)
|
||||
return NULL;
|
||||
|
||||
CFURLRef url =
|
||||
CFBundleCopyAuxiliaryExecutableURL(bundle, CFSTR("libvulkan.1.dylib"));
|
||||
if (!url)
|
||||
return NULL;
|
||||
|
||||
char path[PATH_MAX];
|
||||
void* handle = NULL;
|
||||
|
||||
if (CFURLGetFileSystemRepresentation(url, true, (UInt8*) path, sizeof(path) - 1))
|
||||
handle = _glfw_dlopen(path);
|
||||
|
||||
CFRelease(url);
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW platform API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
4
raylib/external/glfw/src/cocoa_joystick.h
vendored
4
raylib/external/glfw/src/cocoa_joystick.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Cocoa - www.glfw.org
|
||||
// GLFW 3.4 Cocoa - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
//
|
||||
|
@ -30,7 +30,7 @@
|
|||
#include <IOKit/hid/IOHIDKeys.h>
|
||||
|
||||
#define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickNS ns
|
||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE
|
||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyJoystick; }
|
||||
|
||||
#define _GLFW_PLATFORM_MAPPING_NAME "Mac OS X"
|
||||
|
||||
|
|
6
raylib/external/glfw/src/cocoa_joystick.m
vendored
6
raylib/external/glfw/src/cocoa_joystick.m
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Cocoa - www.glfw.org
|
||||
// GLFW 3.4 Cocoa - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
// Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -329,7 +331,7 @@ void _glfwInitJoysticksNS(void)
|
|||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < sizeof(usages) / sizeof(long); i++)
|
||||
for (size_t i = 0; i < sizeof(usages) / sizeof(long); i++)
|
||||
{
|
||||
const long page = kHIDPage_GenericDesktop;
|
||||
|
||||
|
|
173
raylib/external/glfw/src/cocoa_monitor.m
vendored
173
raylib/external/glfw/src/cocoa_monitor.m
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 macOS - www.glfw.org
|
||||
// GLFW 3.4 macOS - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -142,7 +144,7 @@ static GLFWbool modeIsGood(CGDisplayModeRef mode)
|
|||
// Convert Core Graphics display mode to GLFW video mode
|
||||
//
|
||||
static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode,
|
||||
CVDisplayLinkRef link)
|
||||
double fallbackRefreshRate)
|
||||
{
|
||||
GLFWvidmode result;
|
||||
result.width = (int) CGDisplayModeGetWidth(mode);
|
||||
|
@ -150,11 +152,7 @@ static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode,
|
|||
result.refreshRate = (int) round(CGDisplayModeGetRefreshRate(mode));
|
||||
|
||||
if (result.refreshRate == 0)
|
||||
{
|
||||
const CVTime time = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(link);
|
||||
if (!(time.flags & kCVTimeIsIndefinite))
|
||||
result.refreshRate = (int) (time.timeScale / (double) time.timeValue);
|
||||
}
|
||||
result.refreshRate = (int) round(fallbackRefreshRate);
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED <= 101100
|
||||
CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
|
||||
|
@ -213,7 +211,7 @@ static void endFadeReservation(CGDisplayFadeReservationToken token)
|
|||
|
||||
// Finds and caches the NSScreen corresponding to the specified monitor
|
||||
//
|
||||
GLFWbool refreshMonitorScreen(_GLFWmonitor* monitor)
|
||||
static GLFWbool refreshMonitorScreen(_GLFWmonitor* monitor)
|
||||
{
|
||||
if (monitor->ns.screen)
|
||||
return GLFW_TRUE;
|
||||
|
@ -236,6 +234,68 @@ GLFWbool refreshMonitorScreen(_GLFWmonitor* monitor)
|
|||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
// Returns the display refresh rate queried from the I/O registry
|
||||
//
|
||||
static double getFallbackRefreshRate(CGDirectDisplayID displayID)
|
||||
{
|
||||
double refreshRate = 60.0;
|
||||
|
||||
io_iterator_t it;
|
||||
io_service_t service;
|
||||
|
||||
if (IOServiceGetMatchingServices(kIOMasterPortDefault,
|
||||
IOServiceMatching("IOFramebuffer"),
|
||||
&it) != 0)
|
||||
{
|
||||
return refreshRate;
|
||||
}
|
||||
|
||||
while ((service = IOIteratorNext(it)) != 0)
|
||||
{
|
||||
const CFNumberRef indexRef =
|
||||
IORegistryEntryCreateCFProperty(service,
|
||||
CFSTR("IOFramebufferOpenGLIndex"),
|
||||
kCFAllocatorDefault,
|
||||
kNilOptions);
|
||||
if (!indexRef)
|
||||
continue;
|
||||
|
||||
uint32_t index = 0;
|
||||
CFNumberGetValue(indexRef, kCFNumberIntType, &index);
|
||||
CFRelease(indexRef);
|
||||
|
||||
if (CGOpenGLDisplayMaskToDisplayID(1 << index) != displayID)
|
||||
continue;
|
||||
|
||||
const CFNumberRef clockRef =
|
||||
IORegistryEntryCreateCFProperty(service,
|
||||
CFSTR("IOFBCurrentPixelClock"),
|
||||
kCFAllocatorDefault,
|
||||
kNilOptions);
|
||||
const CFNumberRef countRef =
|
||||
IORegistryEntryCreateCFProperty(service,
|
||||
CFSTR("IOFBCurrentPixelCount"),
|
||||
kCFAllocatorDefault,
|
||||
kNilOptions);
|
||||
if (!clockRef || !countRef)
|
||||
break;
|
||||
|
||||
uint32_t clock = 0, count = 0;
|
||||
CFNumberGetValue(clockRef, kCFNumberIntType, &clock);
|
||||
CFNumberGetValue(countRef, kCFNumberIntType, &count);
|
||||
CFRelease(clockRef);
|
||||
CFRelease(countRef);
|
||||
|
||||
if (clock > 0 && count > 0)
|
||||
refreshRate = clock / (double) count;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
IOObjectRelease(it);
|
||||
return refreshRate;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW internal API //////
|
||||
|
@ -245,18 +305,16 @@ GLFWbool refreshMonitorScreen(_GLFWmonitor* monitor)
|
|||
//
|
||||
void _glfwPollMonitorsNS(void)
|
||||
{
|
||||
uint32_t i, j, displayCount, disconnectedCount;
|
||||
CGDirectDisplayID* displays;
|
||||
_GLFWmonitor** disconnected = NULL;
|
||||
|
||||
uint32_t displayCount;
|
||||
CGGetOnlineDisplayList(0, NULL, &displayCount);
|
||||
displays = calloc(displayCount, sizeof(CGDirectDisplayID));
|
||||
CGDirectDisplayID* displays = calloc(displayCount, sizeof(CGDirectDisplayID));
|
||||
CGGetOnlineDisplayList(displayCount, displays, &displayCount);
|
||||
|
||||
for (i = 0; i < _glfw.monitorCount; i++)
|
||||
for (int i = 0; i < _glfw.monitorCount; i++)
|
||||
_glfw.monitors[i]->ns.screen = nil;
|
||||
|
||||
disconnectedCount = _glfw.monitorCount;
|
||||
_GLFWmonitor** disconnected = NULL;
|
||||
uint32_t disconnectedCount = _glfw.monitorCount;
|
||||
if (disconnectedCount)
|
||||
{
|
||||
disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
|
||||
|
@ -265,19 +323,17 @@ void _glfwPollMonitorsNS(void)
|
|||
_glfw.monitorCount * sizeof(_GLFWmonitor*));
|
||||
}
|
||||
|
||||
for (i = 0; i < displayCount; i++)
|
||||
for (uint32_t i = 0; i < displayCount; i++)
|
||||
{
|
||||
_GLFWmonitor* monitor;
|
||||
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
|
||||
|
||||
if (CGDisplayIsAsleep(displays[i]))
|
||||
continue;
|
||||
|
||||
for (j = 0; j < disconnectedCount; j++)
|
||||
// HACK: Compare unit numbers instead of display IDs to work around
|
||||
// display replacement on machines with automatic graphics
|
||||
// switching
|
||||
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
|
||||
for (uint32_t j = 0; j < disconnectedCount; j++)
|
||||
{
|
||||
// HACK: Compare unit numbers instead of display IDs to work around
|
||||
// display replacement on machines with automatic graphics
|
||||
// switching
|
||||
if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber)
|
||||
{
|
||||
disconnected[j] = NULL;
|
||||
|
@ -290,16 +346,21 @@ void _glfwPollMonitorsNS(void)
|
|||
if (!name)
|
||||
name = _glfw_strdup("Unknown");
|
||||
|
||||
monitor = _glfwAllocMonitor(name, size.width, size.height);
|
||||
_GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height);
|
||||
monitor->ns.displayID = displays[i];
|
||||
monitor->ns.unitNumber = unitNumber;
|
||||
|
||||
free(name);
|
||||
|
||||
CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displays[i]);
|
||||
if (CGDisplayModeGetRefreshRate(mode) == 0.0)
|
||||
monitor->ns.fallbackRefreshRate = getFallbackRefreshRate(displays[i]);
|
||||
CGDisplayModeRelease(mode);
|
||||
|
||||
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
|
||||
}
|
||||
|
||||
for (i = 0; i < disconnectedCount; i++)
|
||||
for (uint32_t i = 0; i < disconnectedCount; i++)
|
||||
{
|
||||
if (disconnected[i])
|
||||
_glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0);
|
||||
|
@ -313,30 +374,25 @@ void _glfwPollMonitorsNS(void)
|
|||
//
|
||||
void _glfwSetVideoModeNS(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
||||
{
|
||||
CFArrayRef modes;
|
||||
CFIndex count, i;
|
||||
CVDisplayLinkRef link;
|
||||
CGDisplayModeRef native = NULL;
|
||||
GLFWvidmode current;
|
||||
const GLFWvidmode* best;
|
||||
|
||||
best = _glfwChooseVideoMode(monitor, desired);
|
||||
_glfwPlatformGetVideoMode(monitor, ¤t);
|
||||
|
||||
const GLFWvidmode* best = _glfwChooseVideoMode(monitor, desired);
|
||||
if (_glfwCompareVideoModes(¤t, best) == 0)
|
||||
return;
|
||||
|
||||
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
|
||||
CFArrayRef modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
|
||||
const CFIndex count = CFArrayGetCount(modes);
|
||||
CGDisplayModeRef native = NULL;
|
||||
|
||||
modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
|
||||
count = CFArrayGetCount(modes);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
for (CFIndex i = 0; i < count; i++)
|
||||
{
|
||||
CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
|
||||
if (!modeIsGood(dm))
|
||||
continue;
|
||||
|
||||
const GLFWvidmode mode = vidmodeFromCGDisplayMode(dm, link);
|
||||
const GLFWvidmode mode =
|
||||
vidmodeFromCGDisplayMode(dm, monitor->ns.fallbackRefreshRate);
|
||||
if (_glfwCompareVideoModes(best, &mode) == 0)
|
||||
{
|
||||
native = dm;
|
||||
|
@ -355,7 +411,6 @@ void _glfwSetVideoModeNS(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
|||
}
|
||||
|
||||
CFRelease(modes);
|
||||
CVDisplayLinkRelease(link);
|
||||
}
|
||||
|
||||
// Restore the previously saved (original) video mode
|
||||
|
@ -443,26 +498,21 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
CFArrayRef modes;
|
||||
CFIndex found, i, j;
|
||||
GLFWvidmode* result;
|
||||
CVDisplayLinkRef link;
|
||||
|
||||
*count = 0;
|
||||
|
||||
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
|
||||
CFArrayRef modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
|
||||
const CFIndex found = CFArrayGetCount(modes);
|
||||
GLFWvidmode* result = calloc(found, sizeof(GLFWvidmode));
|
||||
|
||||
modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
|
||||
found = CFArrayGetCount(modes);
|
||||
result = calloc(found, sizeof(GLFWvidmode));
|
||||
|
||||
for (i = 0; i < found; i++)
|
||||
for (CFIndex i = 0; i < found; i++)
|
||||
{
|
||||
CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
|
||||
if (!modeIsGood(dm))
|
||||
continue;
|
||||
|
||||
const GLFWvidmode mode = vidmodeFromCGDisplayMode(dm, link);
|
||||
const GLFWvidmode mode =
|
||||
vidmodeFromCGDisplayMode(dm, monitor->ns.fallbackRefreshRate);
|
||||
CFIndex j;
|
||||
|
||||
for (j = 0; j < *count; j++)
|
||||
{
|
||||
|
@ -479,7 +529,6 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
|
|||
}
|
||||
|
||||
CFRelease(modes);
|
||||
CVDisplayLinkRelease(link);
|
||||
return result;
|
||||
|
||||
} // autoreleasepool
|
||||
|
@ -489,16 +538,9 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode *mode)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
CGDisplayModeRef displayMode;
|
||||
CVDisplayLinkRef link;
|
||||
|
||||
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
|
||||
|
||||
displayMode = CGDisplayCopyDisplayMode(monitor->ns.displayID);
|
||||
*mode = vidmodeFromCGDisplayMode(displayMode, link);
|
||||
CGDisplayModeRelease(displayMode);
|
||||
|
||||
CVDisplayLinkRelease(link);
|
||||
CGDisplayModeRef native = CGDisplayCopyDisplayMode(monitor->ns.displayID);
|
||||
*mode = vidmodeFromCGDisplayMode(native, monitor->ns.fallbackRefreshRate);
|
||||
CGDisplayModeRelease(native);
|
||||
|
||||
} // autoreleasepool
|
||||
}
|
||||
|
@ -507,7 +549,7 @@ GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
uint32_t i, size = CGDisplayGammaTableCapacity(monitor->ns.displayID);
|
||||
uint32_t size = CGDisplayGammaTableCapacity(monitor->ns.displayID);
|
||||
CGGammaValue* values = calloc(size * 3, sizeof(CGGammaValue));
|
||||
|
||||
CGGetDisplayTransferByTable(monitor->ns.displayID,
|
||||
|
@ -519,7 +561,7 @@ GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
|||
|
||||
_glfwAllocGammaArrays(ramp, size);
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
for (uint32_t i = 0; i < size; i++)
|
||||
{
|
||||
ramp->red[i] = (unsigned short) (values[i] * 65535);
|
||||
ramp->green[i] = (unsigned short) (values[i + size] * 65535);
|
||||
|
@ -536,10 +578,9 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
int i;
|
||||
CGGammaValue* values = calloc(ramp->size * 3, sizeof(CGGammaValue));
|
||||
|
||||
for (i = 0; i < ramp->size; i++)
|
||||
for (unsigned int i = 0; i < ramp->size; i++)
|
||||
{
|
||||
values[i] = ramp->red[i] / 65535.f;
|
||||
values[i + ramp->size] = ramp->green[i] / 65535.f;
|
||||
|
|
22
raylib/external/glfw/src/cocoa_platform.h
vendored
22
raylib/external/glfw/src/cocoa_platform.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 macOS - www.glfw.org
|
||||
// GLFW 3.4 macOS - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
//
|
||||
|
@ -28,8 +28,6 @@
|
|||
#include <dlfcn.h>
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <CoreVideo/CVBase.h>
|
||||
#include <CoreVideo/CVDisplayLink.h>
|
||||
|
||||
// NOTE: All of NSGL was deprecated in the 10.14 SDK
|
||||
// This disables the pointless warnings for every symbol we use
|
||||
|
@ -41,6 +39,9 @@
|
|||
typedef void* id;
|
||||
#endif
|
||||
|
||||
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
||||
// SDK versions where one is unavailable or the other deprecated
|
||||
// We use the newer names in code and these macros to handle compatibility
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
|
||||
#define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat
|
||||
#define NSEventMaskAny NSAnyEventMask
|
||||
|
@ -60,6 +61,7 @@ typedef void* id;
|
|||
#endif
|
||||
|
||||
typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
|
||||
typedef VkFlags VkMetalSurfaceCreateFlagsEXT;
|
||||
|
||||
typedef struct VkMacOSSurfaceCreateInfoMVK
|
||||
{
|
||||
|
@ -69,7 +71,16 @@ typedef struct VkMacOSSurfaceCreateInfoMVK
|
|||
const void* pView;
|
||||
} VkMacOSSurfaceCreateInfoMVK;
|
||||
|
||||
typedef struct VkMetalSurfaceCreateInfoEXT
|
||||
{
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkMetalSurfaceCreateFlagsEXT flags;
|
||||
const void* pLayer;
|
||||
} VkMetalSurfaceCreateInfoEXT;
|
||||
|
||||
typedef VkResult (APIENTRY *PFN_vkCreateMacOSSurfaceMVK)(VkInstance,const VkMacOSSurfaceCreateInfoMVK*,const VkAllocationCallbacks*,VkSurfaceKHR*);
|
||||
typedef VkResult (APIENTRY *PFN_vkCreateMetalSurfaceEXT)(VkInstance,const VkMetalSurfaceCreateInfoEXT*,const VkAllocationCallbacks*,VkSurfaceKHR*);
|
||||
|
||||
#include "posix_thread.h"
|
||||
#include "cocoa_joystick.h"
|
||||
|
@ -139,7 +150,7 @@ typedef struct _GLFWlibraryNS
|
|||
id keyUpMonitor;
|
||||
id nibObjects;
|
||||
|
||||
char keyName[64];
|
||||
char keynames[GLFW_KEY_LAST + 1][17];
|
||||
short int keycodes[256];
|
||||
short int scancodes[GLFW_KEY_LAST + 1];
|
||||
char* clipboardString;
|
||||
|
@ -167,6 +178,7 @@ typedef struct _GLFWmonitorNS
|
|||
CGDisplayModeRef previousMode;
|
||||
uint32_t unitNumber;
|
||||
id screen;
|
||||
double fallbackRefreshRate;
|
||||
|
||||
} _GLFWmonitorNS;
|
||||
|
||||
|
@ -195,3 +207,5 @@ void _glfwRestoreVideoModeNS(_GLFWmonitor* monitor);
|
|||
|
||||
float _glfwTransformYNS(float y);
|
||||
|
||||
void* _glfwLoadLocalVulkanLoaderNS(void);
|
||||
|
||||
|
|
4
raylib/external/glfw/src/cocoa_time.c
vendored
4
raylib/external/glfw/src/cocoa_time.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 macOS - www.glfw.org
|
||||
// GLFW 3.4 macOS - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2009-2016 Camilla Löwy <elmindreda@glfw.org>
|
||||
//
|
||||
|
@ -23,6 +23,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
209
raylib/external/glfw/src/cocoa_window.m
vendored
209
raylib/external/glfw/src/cocoa_window.m
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 macOS - www.glfw.org
|
||||
// GLFW 3.4 macOS - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
//
|
||||
|
@ -23,6 +23,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -33,15 +35,14 @@
|
|||
//
|
||||
static NSUInteger getStyleMask(_GLFWwindow* window)
|
||||
{
|
||||
NSUInteger styleMask = 0;
|
||||
NSUInteger styleMask = NSWindowStyleMaskMiniaturizable;
|
||||
|
||||
if (window->monitor || !window->decorated)
|
||||
styleMask |= NSWindowStyleMaskBorderless;
|
||||
else
|
||||
{
|
||||
styleMask |= NSWindowStyleMaskTitled |
|
||||
NSWindowStyleMaskClosable |
|
||||
NSWindowStyleMaskMiniaturizable;
|
||||
NSWindowStyleMaskClosable;
|
||||
|
||||
if (window->resizable)
|
||||
styleMask |= NSWindowStyleMaskResizable;
|
||||
|
@ -321,12 +322,6 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||
_glfwInputWindowFocus(window, GLFW_FALSE);
|
||||
}
|
||||
|
||||
- (void)windowDidChangeScreen:(NSNotification *)notification
|
||||
{
|
||||
if (window->context.source == GLFW_NATIVE_CONTEXT_API)
|
||||
_glfwUpdateDisplayLinkDisplayNSGL(window);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
@ -610,10 +605,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||
|
||||
- (void)scrollWheel:(NSEvent *)event
|
||||
{
|
||||
double deltaX, deltaY;
|
||||
|
||||
deltaX = [event scrollingDeltaX];
|
||||
deltaY = [event scrollingDeltaY];
|
||||
double deltaX = [event scrollingDeltaX];
|
||||
double deltaY = [event scrollingDeltaY];
|
||||
|
||||
if ([event hasPreciseScrollingDeltas])
|
||||
{
|
||||
|
@ -730,9 +723,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||
else
|
||||
characters = (NSString*) string;
|
||||
|
||||
NSUInteger i, length = [characters length];
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
const NSUInteger length = [characters length];
|
||||
for (NSUInteger i = 0; i < length; i++)
|
||||
{
|
||||
const unichar codepoint = [characters characterAtIndex:i];
|
||||
if ((codepoint & 0xff00) == 0xf700)
|
||||
|
@ -817,7 +809,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
|||
[window->ns.object setLevel:NSMainMenuWindowLevel + 1];
|
||||
else
|
||||
{
|
||||
[window->ns.object center];
|
||||
[(NSWindow*) window->ns.object center];
|
||||
_glfw.ns.cascadePoint =
|
||||
NSPointToCGPoint([window->ns.object cascadeTopLeftFromPoint:
|
||||
NSPointFromCGPoint(_glfw.ns.cascadePoint)]);
|
||||
|
@ -893,10 +885,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||
@autoreleasepool {
|
||||
|
||||
if (!_glfw.ns.finishedLaunching)
|
||||
{
|
||||
[NSApp run];
|
||||
_glfw.ns.finishedLaunching = GLFW_TRUE;
|
||||
}
|
||||
|
||||
if (!createNativeWindow(window, wndconfig, fbconfig))
|
||||
return GLFW_FALSE;
|
||||
|
@ -963,16 +952,20 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|||
[window->ns.object close];
|
||||
window->ns.object = nil;
|
||||
|
||||
// HACK: Allow Cocoa to catch up before returning
|
||||
_glfwPlatformPollEvents();
|
||||
|
||||
} // autoreleasepool
|
||||
}
|
||||
|
||||
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char *title)
|
||||
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
||||
{
|
||||
@autoreleasepool {
|
||||
[window->ns.object setTitle:@(title)];
|
||||
NSString* string = @(title);
|
||||
[window->ns.object setTitle:string];
|
||||
// HACK: Set the miniwindow title explicitly as setTitle: doesn't update it
|
||||
// if the window lacks NSWindowStyleMaskTitled
|
||||
[window->ns.object setMiniwindowTitle:@(title)];
|
||||
[window->ns.object setMiniwindowTitle:string];
|
||||
} // autoreleasepool
|
||||
}
|
||||
|
||||
|
@ -1033,7 +1026,14 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
|||
acquireMonitor(window);
|
||||
}
|
||||
else
|
||||
[window->ns.object setContentSize:NSMakeSize(width, height)];
|
||||
{
|
||||
NSRect contentRect =
|
||||
[window->ns.object contentRectForFrameRect:[window->ns.object frame]];
|
||||
contentRect.origin.y += contentRect.size.height - height;
|
||||
contentRect.size = NSMakeSize(width, height);
|
||||
[window->ns.object setFrame:[window->ns.object frameRectForContentRect:contentRect]
|
||||
display:YES];
|
||||
}
|
||||
|
||||
} // autoreleasepool
|
||||
}
|
||||
|
@ -1222,7 +1222,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||
// HACK: Changing the style mask can cause the first responder to be cleared
|
||||
[window->ns.object makeFirstResponder:window->ns.view];
|
||||
|
||||
if (monitor)
|
||||
if (window->monitor)
|
||||
{
|
||||
[window->ns.object setLevel:NSMainMenuWindowLevel + 1];
|
||||
[window->ns.object setHasShadow:NO];
|
||||
|
@ -1377,6 +1377,9 @@ void _glfwPlatformPollEvents(void)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
if (!_glfw.ns.finishedLaunching)
|
||||
[NSApp run];
|
||||
|
||||
for (;;)
|
||||
{
|
||||
NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
|
||||
|
@ -1396,6 +1399,9 @@ void _glfwPlatformWaitEvents(void)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
if (!_glfw.ns.finishedLaunching)
|
||||
[NSApp run];
|
||||
|
||||
// I wanted to pass NO to dequeue:, and rely on PollEvents to
|
||||
// dequeue and send. For reasons not at all clear to me, passing
|
||||
// NO to dequeue: causes this method never to return.
|
||||
|
@ -1414,6 +1420,9 @@ void _glfwPlatformWaitEventsTimeout(double timeout)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
if (!_glfw.ns.finishedLaunching)
|
||||
[NSApp run];
|
||||
|
||||
NSDate* date = [NSDate dateWithTimeIntervalSinceNow:timeout];
|
||||
NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
|
||||
untilDate:date
|
||||
|
@ -1431,6 +1440,9 @@ void _glfwPlatformPostEmptyEvent(void)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
if (!_glfw.ns.finishedLaunching)
|
||||
[NSApp run];
|
||||
|
||||
NSEvent* event = [NSEvent otherEventWithType:NSEventTypeApplicationDefined
|
||||
location:NSMakePoint(0, 0)
|
||||
modifierFlags:0
|
||||
|
@ -1504,8 +1516,17 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
if (scancode < 0 || scancode > 0xff ||
|
||||
_glfw.ns.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const int key = _glfw.ns.keycodes[scancode];
|
||||
|
||||
UInt32 deadKeyState = 0;
|
||||
UniChar characters[8];
|
||||
UniChar characters[4];
|
||||
UniCharCount characterCount = 0;
|
||||
|
||||
if (UCKeyTranslate([(NSData*) _glfw.ns.unicodeData bytes],
|
||||
|
@ -1530,12 +1551,12 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||
characterCount,
|
||||
kCFAllocatorNull);
|
||||
CFStringGetCString(string,
|
||||
_glfw.ns.keyName,
|
||||
sizeof(_glfw.ns.keyName),
|
||||
_glfw.ns.keynames[key],
|
||||
sizeof(_glfw.ns.keynames[key]),
|
||||
kCFStringEncodingUTF8);
|
||||
CFRelease(string);
|
||||
|
||||
return _glfw.ns.keyName;
|
||||
return _glfw.ns.keynames[key];
|
||||
|
||||
} // autoreleasepool
|
||||
}
|
||||
|
@ -1593,23 +1614,49 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
if (shape == GLFW_ARROW_CURSOR)
|
||||
cursor->ns.object = [NSCursor arrowCursor];
|
||||
else if (shape == GLFW_IBEAM_CURSOR)
|
||||
cursor->ns.object = [NSCursor IBeamCursor];
|
||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||
cursor->ns.object = [NSCursor crosshairCursor];
|
||||
else if (shape == GLFW_HAND_CURSOR)
|
||||
cursor->ns.object = [NSCursor pointingHandCursor];
|
||||
else if (shape == GLFW_HRESIZE_CURSOR)
|
||||
cursor->ns.object = [NSCursor resizeLeftRightCursor];
|
||||
else if (shape == GLFW_VRESIZE_CURSOR)
|
||||
cursor->ns.object = [NSCursor resizeUpDownCursor];
|
||||
SEL cursorSelector = NULL;
|
||||
|
||||
// HACK: Try to use a private message
|
||||
if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||
cursorSelector = NSSelectorFromString(@"_windowResizeEastWestCursor");
|
||||
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||
cursorSelector = NSSelectorFromString(@"_windowResizeNorthSouthCursor");
|
||||
else if (shape == GLFW_RESIZE_NWSE_CURSOR)
|
||||
cursorSelector = NSSelectorFromString(@"_windowResizeNorthWestSouthEastCursor");
|
||||
else if (shape == GLFW_RESIZE_NESW_CURSOR)
|
||||
cursorSelector = NSSelectorFromString(@"_windowResizeNorthEastSouthWestCursor");
|
||||
|
||||
if (cursorSelector && [NSCursor respondsToSelector:cursorSelector])
|
||||
{
|
||||
id object = [NSCursor performSelector:cursorSelector];
|
||||
if ([object isKindOfClass:[NSCursor class]])
|
||||
cursor->ns.object = object;
|
||||
}
|
||||
|
||||
if (!cursor->ns.object)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Cocoa: Failed to retrieve standard cursor");
|
||||
if (shape == GLFW_ARROW_CURSOR)
|
||||
cursor->ns.object = [NSCursor arrowCursor];
|
||||
else if (shape == GLFW_IBEAM_CURSOR)
|
||||
cursor->ns.object = [NSCursor IBeamCursor];
|
||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||
cursor->ns.object = [NSCursor crosshairCursor];
|
||||
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||
cursor->ns.object = [NSCursor pointingHandCursor];
|
||||
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||
cursor->ns.object = [NSCursor resizeLeftRightCursor];
|
||||
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||
cursor->ns.object = [NSCursor resizeUpDownCursor];
|
||||
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||
cursor->ns.object = [NSCursor closedHandCursor];
|
||||
else if (shape == GLFW_NOT_ALLOWED_CURSOR)
|
||||
cursor->ns.object = [NSCursor operationNotAllowedCursor];
|
||||
}
|
||||
|
||||
if (!cursor->ns.object)
|
||||
{
|
||||
_glfwInputError(GLFW_CURSOR_UNAVAILABLE,
|
||||
"Cocoa: Standard cursor shape unavailable");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
|
@ -1675,11 +1722,16 @@ const char* _glfwPlatformGetClipboardString(void)
|
|||
|
||||
void _glfwPlatformGetRequiredInstanceExtensions(char** extensions)
|
||||
{
|
||||
if (!_glfw.vk.KHR_surface || !_glfw.vk.MVK_macos_surface)
|
||||
return;
|
||||
|
||||
extensions[0] = "VK_KHR_surface";
|
||||
extensions[1] = "VK_MVK_macos_surface";
|
||||
if (_glfw.vk.KHR_surface && _glfw.vk.EXT_metal_surface)
|
||||
{
|
||||
extensions[0] = "VK_KHR_surface";
|
||||
extensions[1] = "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";
|
||||
}
|
||||
}
|
||||
|
||||
int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
|
||||
|
@ -1697,19 +1749,6 @@ VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
|
|||
@autoreleasepool {
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101100
|
||||
VkResult err;
|
||||
VkMacOSSurfaceCreateInfoMVK sci;
|
||||
PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK;
|
||||
|
||||
vkCreateMacOSSurfaceMVK = (PFN_vkCreateMacOSSurfaceMVK)
|
||||
vkGetInstanceProcAddr(instance, "vkCreateMacOSSurfaceMVK");
|
||||
if (!vkCreateMacOSSurfaceMVK)
|
||||
{
|
||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||
"Cocoa: Vulkan instance missing VK_MVK_macos_surface extension");
|
||||
return VK_ERROR_EXTENSION_NOT_PRESENT;
|
||||
}
|
||||
|
||||
// HACK: Dynamically load Core Animation to avoid adding an extra
|
||||
// dependency for the majority who don't use MoltenVK
|
||||
NSBundle* bundle = [NSBundle bundleWithPath:@"/System/Library/Frameworks/QuartzCore.framework"];
|
||||
|
@ -1735,11 +1774,49 @@ VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
|
|||
[window->ns.view setLayer:window->ns.layer];
|
||||
[window->ns.view setWantsLayer:YES];
|
||||
|
||||
memset(&sci, 0, sizeof(sci));
|
||||
sci.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK;
|
||||
sci.pView = window->ns.view;
|
||||
VkResult err;
|
||||
|
||||
if (_glfw.vk.EXT_metal_surface)
|
||||
{
|
||||
VkMetalSurfaceCreateInfoEXT sci;
|
||||
|
||||
PFN_vkCreateMetalSurfaceEXT vkCreateMetalSurfaceEXT;
|
||||
vkCreateMetalSurfaceEXT = (PFN_vkCreateMetalSurfaceEXT)
|
||||
vkGetInstanceProcAddr(instance, "vkCreateMetalSurfaceEXT");
|
||||
if (!vkCreateMetalSurfaceEXT)
|
||||
{
|
||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||
"Cocoa: Vulkan instance missing VK_EXT_metal_surface extension");
|
||||
return VK_ERROR_EXTENSION_NOT_PRESENT;
|
||||
}
|
||||
|
||||
memset(&sci, 0, sizeof(sci));
|
||||
sci.sType = VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT;
|
||||
sci.pLayer = window->ns.layer;
|
||||
|
||||
err = vkCreateMetalSurfaceEXT(instance, &sci, allocator, surface);
|
||||
}
|
||||
else
|
||||
{
|
||||
VkMacOSSurfaceCreateInfoMVK sci;
|
||||
|
||||
PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK;
|
||||
vkCreateMacOSSurfaceMVK = (PFN_vkCreateMacOSSurfaceMVK)
|
||||
vkGetInstanceProcAddr(instance, "vkCreateMacOSSurfaceMVK");
|
||||
if (!vkCreateMacOSSurfaceMVK)
|
||||
{
|
||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||
"Cocoa: Vulkan instance missing VK_MVK_macos_surface extension");
|
||||
return VK_ERROR_EXTENSION_NOT_PRESENT;
|
||||
}
|
||||
|
||||
memset(&sci, 0, sizeof(sci));
|
||||
sci.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK;
|
||||
sci.pView = window->ns.view;
|
||||
|
||||
err = vkCreateMacOSSurfaceMVK(instance, &sci, allocator, surface);
|
||||
}
|
||||
|
||||
err = vkCreateMacOSSurfaceMVK(instance, &sci, allocator, surface);
|
||||
if (err)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
|
|
4
raylib/external/glfw/src/context.c
vendored
4
raylib/external/glfw/src/context.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 - www.glfw.org
|
||||
// GLFW 3.4 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
35
raylib/external/glfw/src/egl_context.c
vendored
35
raylib/external/glfw/src/egl_context.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 EGL - www.glfw.org
|
||||
// GLFW 3.4 EGL - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -121,23 +123,24 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
|
|||
continue;
|
||||
|
||||
#if defined(_GLFW_X11)
|
||||
XVisualInfo vi = {0};
|
||||
|
||||
// Only consider EGLConfigs with associated Visuals
|
||||
vi.visualid = getEGLConfigAttrib(n, EGL_NATIVE_VISUAL_ID);
|
||||
if (!vi.visualid)
|
||||
continue;
|
||||
|
||||
if (desired->transparent)
|
||||
{
|
||||
int count;
|
||||
XVisualInfo* vis = XGetVisualInfo(_glfw.x11.display,
|
||||
VisualIDMask, &vi,
|
||||
&count);
|
||||
if (vis)
|
||||
XVisualInfo vi = {0};
|
||||
|
||||
// Only consider EGLConfigs with associated Visuals
|
||||
vi.visualid = getEGLConfigAttrib(n, EGL_NATIVE_VISUAL_ID);
|
||||
if (!vi.visualid)
|
||||
continue;
|
||||
|
||||
if (desired->transparent)
|
||||
{
|
||||
u->transparent = _glfwIsVisualTransparentX11(vis[0].visual);
|
||||
XFree(vis);
|
||||
int count;
|
||||
XVisualInfo* vis =
|
||||
XGetVisualInfo(_glfw.x11.display, VisualIDMask, &vi, &count);
|
||||
if (vis)
|
||||
{
|
||||
u->transparent = _glfwIsVisualTransparentX11(vis[0].visual);
|
||||
XFree(vis);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // _GLFW_X11
|
||||
|
|
18
raylib/external/glfw/src/egl_context.h
vendored
18
raylib/external/glfw/src/egl_context.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 EGL - www.glfw.org
|
||||
// GLFW 3.4 EGL - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -47,26 +47,26 @@ typedef struct wl_egl_window* EGLNativeWindowType;
|
|||
#error "No supported EGL platform selected"
|
||||
#endif
|
||||
|
||||
#define EGL_SUCCESS 0x3000
|
||||
#define EGL_NOT_INITIALIZED 0x3001
|
||||
#define EGL_SUCCESS 0x3000
|
||||
#define EGL_NOT_INITIALIZED 0x3001
|
||||
#define EGL_BAD_ACCESS 0x3002
|
||||
#define EGL_BAD_ALLOC 0x3003
|
||||
#define EGL_BAD_ATTRIBUTE 0x3004
|
||||
#define EGL_BAD_CONFIG 0x3005
|
||||
#define EGL_BAD_CONTEXT 0x3006
|
||||
#define EGL_BAD_CURRENT_SURFACE 0x3007
|
||||
#define EGL_BAD_DISPLAY 0x3008
|
||||
#define EGL_BAD_CONTEXT 0x3006
|
||||
#define EGL_BAD_CURRENT_SURFACE 0x3007
|
||||
#define EGL_BAD_DISPLAY 0x3008
|
||||
#define EGL_BAD_MATCH 0x3009
|
||||
#define EGL_BAD_NATIVE_PIXMAP 0x300a
|
||||
#define EGL_BAD_NATIVE_WINDOW 0x300b
|
||||
#define EGL_BAD_PARAMETER 0x300c
|
||||
#define EGL_BAD_SURFACE 0x300d
|
||||
#define EGL_BAD_SURFACE 0x300d
|
||||
#define EGL_CONTEXT_LOST 0x300e
|
||||
#define EGL_COLOR_BUFFER_TYPE 0x303f
|
||||
#define EGL_RGB_BUFFER 0x308e
|
||||
#define EGL_SURFACE_TYPE 0x3033
|
||||
#define EGL_WINDOW_BIT 0x0004
|
||||
#define EGL_RENDERABLE_TYPE 0x3040
|
||||
#define EGL_RENDERABLE_TYPE 0x3040
|
||||
#define EGL_OPENGL_ES_BIT 0x0001
|
||||
#define EGL_OPENGL_ES2_BIT 0x0004
|
||||
#define EGL_OPENGL_BIT 0x0008
|
||||
|
@ -76,7 +76,7 @@ typedef struct wl_egl_window* EGLNativeWindowType;
|
|||
#define EGL_RED_SIZE 0x3024
|
||||
#define EGL_DEPTH_SIZE 0x3025
|
||||
#define EGL_STENCIL_SIZE 0x3026
|
||||
#define EGL_SAMPLES 0x3031
|
||||
#define EGL_SAMPLES 0x3031
|
||||
#define EGL_OPENGL_ES_API 0x30a0
|
||||
#define EGL_OPENGL_API 0x30a2
|
||||
#define EGL_NONE 0x3038
|
||||
|
|
6
raylib/external/glfw/src/glx_context.c
vendored
6
raylib/external/glfw/src/glx_context.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 GLX - www.glfw.org
|
||||
// GLFW 3.4 GLX - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -226,8 +228,6 @@ static GLFWglproc getProcAddressGLX(const char* procname)
|
|||
return _glfw_dlsym(_glfw.glx.handle, procname);
|
||||
}
|
||||
|
||||
// Destroy the OpenGL context
|
||||
//
|
||||
static void destroyContextGLX(_GLFWwindow* window)
|
||||
{
|
||||
if (window->context.glx.window)
|
||||
|
|
8
raylib/external/glfw/src/glx_context.h
vendored
8
raylib/external/glfw/src/glx_context.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 GLX - www.glfw.org
|
||||
// GLFW 3.4 GLX - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -29,11 +29,11 @@
|
|||
#define GLX_RGBA_BIT 0x00000001
|
||||
#define GLX_WINDOW_BIT 0x00000001
|
||||
#define GLX_DRAWABLE_TYPE 0x8010
|
||||
#define GLX_RENDER_TYPE 0x8011
|
||||
#define GLX_RENDER_TYPE 0x8011
|
||||
#define GLX_RGBA_TYPE 0x8014
|
||||
#define GLX_DOUBLEBUFFER 5
|
||||
#define GLX_STEREO 6
|
||||
#define GLX_AUX_BUFFERS 7
|
||||
#define GLX_AUX_BUFFERS 7
|
||||
#define GLX_RED_SIZE 8
|
||||
#define GLX_GREEN_SIZE 9
|
||||
#define GLX_BLUE_SIZE 10
|
||||
|
@ -42,7 +42,7 @@
|
|||
#define GLX_STENCIL_SIZE 13
|
||||
#define GLX_ACCUM_RED_SIZE 14
|
||||
#define GLX_ACCUM_GREEN_SIZE 15
|
||||
#define GLX_ACCUM_BLUE_SIZE 16
|
||||
#define GLX_ACCUM_BLUE_SIZE 16
|
||||
#define GLX_ACCUM_ALPHA_SIZE 17
|
||||
#define GLX_SAMPLES 0x186a1
|
||||
#define GLX_VISUAL_ID 0x800b
|
||||
|
|
6
raylib/external/glfw/src/init.c
vendored
6
raylib/external/glfw/src/init.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 - www.glfw.org
|
||||
// GLFW 3.4 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
#include "mappings.h"
|
||||
|
@ -187,6 +189,8 @@ void _glfwInputError(int code, const char* format, ...)
|
|||
strcpy(description, "The requested format is unavailable");
|
||||
else if (code == GLFW_NO_WINDOW_CONTEXT)
|
||||
strcpy(description, "The specified window has no context");
|
||||
else if (code == GLFW_CURSOR_UNAVAILABLE)
|
||||
strcpy(description, "The specified cursor shape is unavailable");
|
||||
else
|
||||
strcpy(description, "ERROR: UNKNOWN GLFW ERROR");
|
||||
}
|
||||
|
|
14
raylib/external/glfw/src/input.c
vendored
14
raylib/external/glfw/src/input.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 - www.glfw.org
|
||||
// GLFW 3.4 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -755,9 +757,13 @@ GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape)
|
|||
if (shape != GLFW_ARROW_CURSOR &&
|
||||
shape != GLFW_IBEAM_CURSOR &&
|
||||
shape != GLFW_CROSSHAIR_CURSOR &&
|
||||
shape != GLFW_HAND_CURSOR &&
|
||||
shape != GLFW_HRESIZE_CURSOR &&
|
||||
shape != GLFW_VRESIZE_CURSOR)
|
||||
shape != GLFW_POINTING_HAND_CURSOR &&
|
||||
shape != GLFW_RESIZE_EW_CURSOR &&
|
||||
shape != GLFW_RESIZE_NS_CURSOR &&
|
||||
shape != GLFW_RESIZE_NWSE_CURSOR &&
|
||||
shape != GLFW_RESIZE_NESW_CURSOR &&
|
||||
shape != GLFW_RESIZE_ALL_CURSOR &&
|
||||
shape != GLFW_NOT_ALLOWED_CURSOR)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid standard cursor 0x%08X", shape);
|
||||
return NULL;
|
||||
|
|
13
raylib/external/glfw/src/internal.h
vendored
13
raylib/external/glfw/src/internal.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 - www.glfw.org
|
||||
// GLFW 3.4 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -84,8 +84,8 @@ typedef GLFWglproc (* _GLFWgetprocaddressfun)(const char*);
|
|||
typedef void (* _GLFWdestroycontextfun)(_GLFWwindow*);
|
||||
|
||||
#define GL_VERSION 0x1f02
|
||||
#define GL_NONE 0
|
||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
#define GL_NONE 0
|
||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
#define GL_UNSIGNED_BYTE 0x1401
|
||||
#define GL_EXTENSIONS 0x1f03
|
||||
#define GL_NUM_EXTENSIONS 0x821d
|
||||
|
@ -102,7 +102,7 @@ typedef void (* _GLFWdestroycontextfun)(_GLFWwindow*);
|
|||
#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82fc
|
||||
#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
|
||||
|
||||
typedef int GLint;
|
||||
typedef int GLint;
|
||||
typedef unsigned int GLuint;
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned int GLbitfield;
|
||||
|
@ -128,6 +128,7 @@ typedef enum VkStructureType
|
|||
VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000,
|
||||
VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
|
||||
VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000,
|
||||
VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000,
|
||||
VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
} VkStructureType;
|
||||
|
||||
|
@ -274,6 +275,9 @@ struct _GLFWwndconfig
|
|||
char className[256];
|
||||
char instanceName[256];
|
||||
} x11;
|
||||
struct {
|
||||
GLFWbool keymenu;
|
||||
} win32;
|
||||
};
|
||||
|
||||
// Context configuration
|
||||
|
@ -556,6 +560,7 @@ struct _GLFWlibrary
|
|||
GLFWbool KHR_win32_surface;
|
||||
#elif defined(_GLFW_COCOA)
|
||||
GLFWbool MVK_macos_surface;
|
||||
GLFWbool EXT_metal_surface;
|
||||
#elif defined(_GLFW_X11)
|
||||
GLFWbool KHR_xlib_surface;
|
||||
GLFWbool KHR_xcb_surface;
|
||||
|
|
55
raylib/external/glfw/src/linux_joystick.c
vendored
55
raylib/external/glfw/src/linux_joystick.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Linux - www.glfw.org
|
||||
// GLFW 3.4 Linux - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -104,9 +106,7 @@ static void handleAbsEvent(_GLFWjoystick* js, int code, int value)
|
|||
//
|
||||
static void pollAbsState(_GLFWjoystick* js)
|
||||
{
|
||||
int code;
|
||||
|
||||
for (code = 0; code < ABS_CNT; code++)
|
||||
for (int code = 0; code < ABS_CNT; code++)
|
||||
{
|
||||
if (js->linjs.absMap[code] < 0)
|
||||
continue;
|
||||
|
@ -126,18 +126,7 @@ static void pollAbsState(_GLFWjoystick* js)
|
|||
//
|
||||
static GLFWbool openJoystickDevice(const char* path)
|
||||
{
|
||||
int jid, code;
|
||||
char name[256] = "";
|
||||
char guid[33] = "";
|
||||
char evBits[(EV_CNT + 7) / 8] = {0};
|
||||
char keyBits[(KEY_CNT + 7) / 8] = {0};
|
||||
char absBits[(ABS_CNT + 7) / 8] = {0};
|
||||
int axisCount = 0, buttonCount = 0, hatCount = 0;
|
||||
struct input_id id;
|
||||
_GLFWjoystickLinux linjs = {0};
|
||||
_GLFWjoystick* js = NULL;
|
||||
|
||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||
{
|
||||
if (!_glfw.joysticks[jid].present)
|
||||
continue;
|
||||
|
@ -145,10 +134,16 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
_GLFWjoystickLinux linjs = {0};
|
||||
linjs.fd = open(path, O_RDONLY | O_NONBLOCK);
|
||||
if (linjs.fd == -1)
|
||||
return GLFW_FALSE;
|
||||
|
||||
char evBits[(EV_CNT + 7) / 8] = {0};
|
||||
char keyBits[(KEY_CNT + 7) / 8] = {0};
|
||||
char absBits[(ABS_CNT + 7) / 8] = {0};
|
||||
struct input_id id;
|
||||
|
||||
if (ioctl(linjs.fd, EVIOCGBIT(0, sizeof(evBits)), evBits) < 0 ||
|
||||
ioctl(linjs.fd, EVIOCGBIT(EV_KEY, sizeof(keyBits)), keyBits) < 0 ||
|
||||
ioctl(linjs.fd, EVIOCGBIT(EV_ABS, sizeof(absBits)), absBits) < 0 ||
|
||||
|
@ -168,9 +163,13 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
char name[256] = "";
|
||||
|
||||
if (ioctl(linjs.fd, EVIOCGNAME(sizeof(name)), name) < 0)
|
||||
strncpy(name, "Unknown", sizeof(name));
|
||||
|
||||
char guid[33] = "";
|
||||
|
||||
// Generate a joystick GUID that matches the SDL 2.0.5+ one
|
||||
if (id.vendor && id.product && id.version)
|
||||
{
|
||||
|
@ -189,7 +188,9 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||
name[8], name[9], name[10]);
|
||||
}
|
||||
|
||||
for (code = BTN_MISC; code < KEY_CNT; code++)
|
||||
int axisCount = 0, buttonCount = 0, hatCount = 0;
|
||||
|
||||
for (int code = BTN_MISC; code < KEY_CNT; code++)
|
||||
{
|
||||
if (!isBitSet(code, keyBits))
|
||||
continue;
|
||||
|
@ -198,7 +199,7 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||
buttonCount++;
|
||||
}
|
||||
|
||||
for (code = 0; code < ABS_CNT; code++)
|
||||
for (int code = 0; code < ABS_CNT; code++)
|
||||
{
|
||||
linjs.absMap[code] = -1;
|
||||
if (!isBitSet(code, absBits))
|
||||
|
@ -221,7 +222,8 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||
}
|
||||
}
|
||||
|
||||
js = _glfwAllocJoystick(name, guid, axisCount, buttonCount, hatCount);
|
||||
_GLFWjoystick* js =
|
||||
_glfwAllocJoystick(name, guid, axisCount, buttonCount, hatCount);
|
||||
if (!js)
|
||||
{
|
||||
close(linjs.fd);
|
||||
|
@ -266,8 +268,6 @@ static int compareJoysticks(const void* fp, const void* sp)
|
|||
//
|
||||
GLFWbool _glfwInitJoysticksLinux(void)
|
||||
{
|
||||
DIR* dir;
|
||||
int count = 0;
|
||||
const char* dirname = "/dev/input";
|
||||
|
||||
_glfw.linjs.inotify = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
|
||||
|
@ -289,7 +289,9 @@ GLFWbool _glfwInitJoysticksLinux(void)
|
|||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
dir = opendir(dirname);
|
||||
int count = 0;
|
||||
|
||||
DIR* dir = opendir(dirname);
|
||||
if (dir)
|
||||
{
|
||||
struct dirent* entry;
|
||||
|
@ -344,12 +346,11 @@ void _glfwTerminateJoysticksLinux(void)
|
|||
|
||||
void _glfwDetectJoystickConnectionLinux(void)
|
||||
{
|
||||
ssize_t offset = 0;
|
||||
char buffer[16384];
|
||||
|
||||
if (_glfw.linjs.inotify <= 0)
|
||||
return;
|
||||
|
||||
ssize_t offset = 0;
|
||||
char buffer[16384];
|
||||
const ssize_t size = read(_glfw.linjs.inotify, buffer, sizeof(buffer));
|
||||
|
||||
while (size > offset)
|
||||
|
@ -369,9 +370,7 @@ void _glfwDetectJoystickConnectionLinux(void)
|
|||
openJoystickDevice(path);
|
||||
else if (e->mask & IN_DELETE)
|
||||
{
|
||||
int jid;
|
||||
|
||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||
{
|
||||
if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0)
|
||||
{
|
||||
|
|
2
raylib/external/glfw/src/linux_joystick.h
vendored
2
raylib/external/glfw/src/linux_joystick.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Linux - www.glfw.org
|
||||
// GLFW 3.4 Linux - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
|
||||
//
|
||||
|
|
4
raylib/external/glfw/src/mappings.h
vendored
4
raylib/external/glfw/src/mappings.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 - www.glfw.org
|
||||
// GLFW 3.4 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
|
||||
//
|
||||
|
@ -84,7 +84,6 @@ const char* _glfwDefaultMappings[] =
|
|||
"030000000d0f00008700000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
|
||||
"030000000d0f00002700000000000000,FIGHTING STICK V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
|
||||
"78696e70757403000000000000000000,Fightstick TES,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,platform:Windows,",
|
||||
"03000000790000000600000000000000,G-Shark GS-GP702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,platform:Windows,",
|
||||
"03000000260900002625000000000000,Gamecube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,lefttrigger:a4,leftx:a0,lefty:a1,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Windows,",
|
||||
"030000008f0e00000d31000000000000,GAMEPAD 3 TURBO,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
|
||||
"03000000280400000140000000000000,GamePad Pro USB,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
|
||||
|
@ -207,7 +206,6 @@ const char* _glfwDefaultMappings[] =
|
|||
"030000008305000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
|
||||
"03000000260900008888000088020000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,platform:Mac OS X,",
|
||||
"03000000a306000022f6000001030000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Mac OS X,",
|
||||
"03000000790000000600000000000000,G-Shark GP-702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Mac OS X,",
|
||||
"03000000ad1b000001f9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,",
|
||||
"0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,",
|
||||
"030000000d0f00005f00000000010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
|
||||
|
|
8
raylib/external/glfw/src/monitor.c
vendored
8
raylib/external/glfw/src/monitor.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 - www.glfw.org
|
||||
// GLFW 3.4 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -54,6 +56,10 @@ static int compareVideoModes(const void* fp, const void* sp)
|
|||
if (farea != sarea)
|
||||
return farea - sarea;
|
||||
|
||||
// Then sort on width
|
||||
if (fm->width != sm->width)
|
||||
return fm->width - sm->width;
|
||||
|
||||
// Lastly sort on refresh rate
|
||||
return fm->refreshRate - sm->refreshRate;
|
||||
}
|
||||
|
|
10
raylib/external/glfw/src/nsgl_context.h
vendored
10
raylib/external/glfw/src/nsgl_context.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 macOS - www.glfw.org
|
||||
// GLFW 3.4 macOS - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
//
|
||||
|
@ -24,6 +24,9 @@
|
|||
//
|
||||
//========================================================================
|
||||
|
||||
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
||||
// SDK versions where one is unavailable or the other deprecated
|
||||
// We use the newer names in code and these macros to handle compatibility
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400
|
||||
#define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval
|
||||
#define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity
|
||||
|
@ -41,10 +44,6 @@ typedef struct _GLFWcontextNSGL
|
|||
{
|
||||
id pixelFormat;
|
||||
id object;
|
||||
CVDisplayLinkRef displayLink;
|
||||
atomic_int swapInterval;
|
||||
int swapIntervalsPassed;
|
||||
id swapIntervalCond;
|
||||
|
||||
} _GLFWcontextNSGL;
|
||||
|
||||
|
@ -64,5 +63,4 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
|||
const _GLFWctxconfig* ctxconfig,
|
||||
const _GLFWfbconfig* fbconfig);
|
||||
void _glfwDestroyContextNSGL(_GLFWwindow* window);
|
||||
void _glfwUpdateDisplayLinkDisplayNSGL(_GLFWwindow* window);
|
||||
|
||||
|
|
117
raylib/external/glfw/src/nsgl_context.m
vendored
117
raylib/external/glfw/src/nsgl_context.m
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 macOS - www.glfw.org
|
||||
// GLFW 3.4 macOS - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
//
|
||||
|
@ -23,32 +23,13 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
// Display link callback for manual swap interval implementation
|
||||
// This is based on a similar workaround added to SDL2
|
||||
//
|
||||
static CVReturn displayLinkCallback(CVDisplayLinkRef displayLink,
|
||||
const CVTimeStamp* now,
|
||||
const CVTimeStamp* outputTime,
|
||||
CVOptionFlags flagsIn,
|
||||
CVOptionFlags* flagsOut,
|
||||
void* userInfo)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow *) userInfo;
|
||||
|
||||
const int interval = atomic_load(&window->context.nsgl.swapInterval);
|
||||
if (interval > 0)
|
||||
{
|
||||
[window->context.nsgl.swapIntervalCond lock];
|
||||
window->context.nsgl.swapIntervalsPassed++;
|
||||
[window->context.nsgl.swapIntervalCond signal];
|
||||
[window->context.nsgl.swapIntervalCond unlock];
|
||||
}
|
||||
|
||||
return kCVReturnSuccess;
|
||||
}
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
|
||||
static void makeContextCurrentNSGL(_GLFWwindow* window)
|
||||
{
|
||||
|
@ -68,19 +49,28 @@ static void swapBuffersNSGL(_GLFWwindow* window)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
const int interval = atomic_load(&window->context.nsgl.swapInterval);
|
||||
if (interval > 0)
|
||||
// HACK: Simulate vsync with usleep as NSGL swap interval does not apply to
|
||||
// windows with a non-visible occlusion state
|
||||
if (!([window->ns.object occlusionState] & NSWindowOcclusionStateVisible))
|
||||
{
|
||||
[window->context.nsgl.swapIntervalCond lock];
|
||||
do
|
||||
int interval = 0;
|
||||
[window->context.nsgl.object getValues:&interval
|
||||
forParameter:NSOpenGLContextParameterSwapInterval];
|
||||
|
||||
if (interval > 0)
|
||||
{
|
||||
[window->context.nsgl.swapIntervalCond wait];
|
||||
} while (window->context.nsgl.swapIntervalsPassed % interval != 0);
|
||||
window->context.nsgl.swapIntervalsPassed = 0;
|
||||
[window->context.nsgl.swapIntervalCond unlock];
|
||||
const double framerate = 60.0;
|
||||
const uint64_t frequency = _glfwPlatformGetTimerFrequency();
|
||||
const uint64_t value = _glfwPlatformGetTimerValue();
|
||||
|
||||
const double elapsed = value / (double) frequency;
|
||||
const double period = 1.0 / framerate;
|
||||
const double delay = period - fmod(elapsed, period);
|
||||
|
||||
usleep(floorl(delay * 1e6));
|
||||
}
|
||||
}
|
||||
|
||||
// ARP appears to be unnecessary, but this is future-proof
|
||||
[window->context.nsgl.object flushBuffer];
|
||||
|
||||
} // autoreleasepool
|
||||
|
@ -89,11 +79,14 @@ static void swapBuffersNSGL(_GLFWwindow* window)
|
|||
static void swapIntervalNSGL(int interval)
|
||||
{
|
||||
@autoreleasepool {
|
||||
|
||||
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||
atomic_store(&window->context.nsgl.swapInterval, interval);
|
||||
[window->context.nsgl.swapIntervalCond lock];
|
||||
window->context.nsgl.swapIntervalsPassed = 0;
|
||||
[window->context.nsgl.swapIntervalCond unlock];
|
||||
if (window)
|
||||
{
|
||||
[window->context.nsgl.object setValues:&interval
|
||||
forParameter:NSOpenGLContextParameterSwapInterval];
|
||||
}
|
||||
|
||||
} // autoreleasepool
|
||||
}
|
||||
|
||||
|
@ -117,23 +110,10 @@ static GLFWglproc getProcAddressNSGL(const char* procname)
|
|||
return symbol;
|
||||
}
|
||||
|
||||
// Destroy the OpenGL context
|
||||
//
|
||||
static void destroyContextNSGL(_GLFWwindow* window)
|
||||
{
|
||||
@autoreleasepool {
|
||||
|
||||
if (window->context.nsgl.displayLink)
|
||||
{
|
||||
if (CVDisplayLinkIsRunning(window->context.nsgl.displayLink))
|
||||
CVDisplayLinkStop(window->context.nsgl.displayLink);
|
||||
|
||||
CVDisplayLinkRelease(window->context.nsgl.displayLink);
|
||||
}
|
||||
|
||||
[window->context.nsgl.swapIntervalCond release];
|
||||
window->context.nsgl.swapIntervalCond = nil;
|
||||
|
||||
[window->context.nsgl.pixelFormat release];
|
||||
window->context.nsgl.pixelFormat = nil;
|
||||
|
||||
|
@ -194,13 +174,6 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
|||
"NSGL: The targeted version of macOS does not support OpenGL 3.0 or 3.1 but may support 3.2 and above");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (!ctxconfig->forward || ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE)
|
||||
{
|
||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||
"NSGL: The targeted version of macOS only supports forward-compatible core profile contexts for OpenGL 3.2 and above");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Context robustness modes (GL_KHR_robustness) are not yet supported by
|
||||
|
@ -339,7 +312,7 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
|||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
NSOpenGLContext* share = NULL;
|
||||
NSOpenGLContext* share = nil;
|
||||
|
||||
if (ctxconfig->share)
|
||||
share = ctxconfig->share->context.nsgl.object;
|
||||
|
@ -361,17 +334,10 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
|||
forParameter:NSOpenGLContextParameterSurfaceOpacity];
|
||||
}
|
||||
|
||||
if (window->ns.retina)
|
||||
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
|
||||
|
||||
GLint interval = 0;
|
||||
[window->context.nsgl.object setValues:&interval
|
||||
forParameter:NSOpenGLContextParameterSwapInterval];
|
||||
[window->ns.view setWantsBestResolutionOpenGLSurface:window->ns.retina];
|
||||
|
||||
[window->context.nsgl.object setView:window->ns.view];
|
||||
|
||||
window->context.nsgl.swapIntervalCond = [NSCondition new];
|
||||
|
||||
window->context.makeCurrent = makeContextCurrentNSGL;
|
||||
window->context.swapBuffers = swapBuffersNSGL;
|
||||
window->context.swapInterval = swapIntervalNSGL;
|
||||
|
@ -379,26 +345,9 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
|||
window->context.getProcAddress = getProcAddressNSGL;
|
||||
window->context.destroy = destroyContextNSGL;
|
||||
|
||||
CVDisplayLinkCreateWithActiveCGDisplays(&window->context.nsgl.displayLink);
|
||||
CVDisplayLinkSetOutputCallback(window->context.nsgl.displayLink,
|
||||
&displayLinkCallback,
|
||||
window);
|
||||
CVDisplayLinkStart(window->context.nsgl.displayLink);
|
||||
|
||||
_glfwUpdateDisplayLinkDisplayNSGL(window);
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
void _glfwUpdateDisplayLinkDisplayNSGL(_GLFWwindow* window)
|
||||
{
|
||||
CGDirectDisplayID displayID =
|
||||
[[[window->ns.object screen] deviceDescription][@"NSScreenNumber"] unsignedIntValue];
|
||||
if (!displayID)
|
||||
return;
|
||||
|
||||
CVDisplayLinkSetCurrentCGDisplay(window->context.nsgl.displayLink, displayID);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW native API //////
|
||||
|
@ -412,7 +361,7 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle)
|
|||
if (window->context.client == GLFW_NO_API)
|
||||
{
|
||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||
return NULL;
|
||||
return nil;
|
||||
}
|
||||
|
||||
return window->context.nsgl.object;
|
||||
|
|
4
raylib/external/glfw/src/null_init.c
vendored
4
raylib/external/glfw/src/null_init.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 - www.glfw.org
|
||||
// GLFW 3.4 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2016 Google Inc.
|
||||
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
4
raylib/external/glfw/src/null_joystick.c
vendored
4
raylib/external/glfw/src/null_joystick.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 - www.glfw.org
|
||||
// GLFW 3.4 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
//
|
||||
|
@ -23,6 +23,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
6
raylib/external/glfw/src/null_joystick.h
vendored
6
raylib/external/glfw/src/null_joystick.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 - www.glfw.org
|
||||
// GLFW 3.4 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
//
|
||||
|
@ -24,8 +24,8 @@
|
|||
//
|
||||
//========================================================================
|
||||
|
||||
#define _GLFW_PLATFORM_JOYSTICK_STATE int nulljs
|
||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE int nulljs
|
||||
#define _GLFW_PLATFORM_JOYSTICK_STATE struct { int dummyJoystick; }
|
||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; }
|
||||
|
||||
#define _GLFW_PLATFORM_MAPPING_NAME ""
|
||||
|
||||
|
|
4
raylib/external/glfw/src/null_monitor.c
vendored
4
raylib/external/glfw/src/null_monitor.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 - www.glfw.org
|
||||
// GLFW 3.4 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2016 Google Inc.
|
||||
// Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
16
raylib/external/glfw/src/null_platform.h
vendored
16
raylib/external/glfw/src/null_platform.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 - www.glfw.org
|
||||
// GLFW 3.4 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2016 Google Inc.
|
||||
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -29,13 +29,13 @@
|
|||
|
||||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNull null
|
||||
|
||||
#define _GLFW_PLATFORM_CONTEXT_STATE
|
||||
#define _GLFW_PLATFORM_MONITOR_STATE
|
||||
#define _GLFW_PLATFORM_CURSOR_STATE
|
||||
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE
|
||||
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE
|
||||
#define _GLFW_EGL_CONTEXT_STATE
|
||||
#define _GLFW_EGL_LIBRARY_CONTEXT_STATE
|
||||
#define _GLFW_PLATFORM_CONTEXT_STATE struct { int dummyContext; }
|
||||
#define _GLFW_PLATFORM_MONITOR_STATE struct { int dummyMonitor; }
|
||||
#define _GLFW_PLATFORM_CURSOR_STATE struct { int dummyCursor; }
|
||||
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE struct { int dummyLibraryWindow; }
|
||||
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE struct { int dummyLibraryContext; }
|
||||
#define _GLFW_EGL_CONTEXT_STATE struct { int dummyEGLContext; }
|
||||
#define _GLFW_EGL_LIBRARY_CONTEXT_STATE struct { int dummyEGLLibraryContext; }
|
||||
|
||||
#include "osmesa_context.h"
|
||||
#include "posix_time.h"
|
||||
|
|
4
raylib/external/glfw/src/null_window.c
vendored
4
raylib/external/glfw/src/null_window.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 - www.glfw.org
|
||||
// GLFW 3.4 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2016 Google Inc.
|
||||
// Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
4
raylib/external/glfw/src/osmesa_context.c
vendored
4
raylib/external/glfw/src/osmesa_context.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 OSMesa - www.glfw.org
|
||||
// GLFW 3.4 OSMesa - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2016 Google Inc.
|
||||
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
2
raylib/external/glfw/src/osmesa_context.h
vendored
2
raylib/external/glfw/src/osmesa_context.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 OSMesa - www.glfw.org
|
||||
// GLFW 3.4 OSMesa - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2016 Google Inc.
|
||||
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
|
4
raylib/external/glfw/src/posix_thread.c
vendored
4
raylib/external/glfw/src/posix_thread.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 POSIX - www.glfw.org
|
||||
// GLFW 3.4 POSIX - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
2
raylib/external/glfw/src/posix_thread.h
vendored
2
raylib/external/glfw/src/posix_thread.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 POSIX - www.glfw.org
|
||||
// GLFW 3.4 POSIX - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
|
11
raylib/external/glfw/src/posix_time.c
vendored
11
raylib/external/glfw/src/posix_time.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 POSIX - www.glfw.org
|
||||
// GLFW 3.4 POSIX - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,9 +24,14 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
//#define _POSIX_C_SOURCE 199309L
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
|
@ -39,7 +44,7 @@
|
|||
//
|
||||
void _glfwInitTimerPOSIX(void)
|
||||
{
|
||||
#if defined(CLOCK_MONOTONIC)
|
||||
#if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK)
|
||||
struct timespec ts;
|
||||
|
||||
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
|
||||
|
@ -62,7 +67,7 @@ void _glfwInitTimerPOSIX(void)
|
|||
|
||||
uint64_t _glfwPlatformGetTimerValue(void)
|
||||
{
|
||||
#if defined(CLOCK_MONOTONIC)
|
||||
#if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK)
|
||||
if (_glfw.timer.posix.monotonic)
|
||||
{
|
||||
struct timespec ts;
|
||||
|
|
2
raylib/external/glfw/src/posix_time.h
vendored
2
raylib/external/glfw/src/posix_time.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 POSIX - www.glfw.org
|
||||
// GLFW 3.4 POSIX - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
|
8
raylib/external/glfw/src/vulkan.c
vendored
8
raylib/external/glfw/src/vulkan.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 - www.glfw.org
|
||||
// GLFW 3.4 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -55,6 +57,8 @@ GLFWbool _glfwInitVulkan(int mode)
|
|||
_glfw.vk.handle = _glfw_dlopen("vulkan-1.dll");
|
||||
#elif defined(_GLFW_COCOA)
|
||||
_glfw.vk.handle = _glfw_dlopen("libvulkan.1.dylib");
|
||||
if (!_glfw.vk.handle)
|
||||
_glfw.vk.handle = _glfwLoadLocalVulkanLoaderNS();
|
||||
#else
|
||||
_glfw.vk.handle = _glfw_dlopen("libvulkan.so.1");
|
||||
#endif
|
||||
|
@ -128,6 +132,8 @@ GLFWbool _glfwInitVulkan(int mode)
|
|||
#elif defined(_GLFW_COCOA)
|
||||
else if (strcmp(ep[i].extensionName, "VK_MVK_macos_surface") == 0)
|
||||
_glfw.vk.MVK_macos_surface = GLFW_TRUE;
|
||||
else if (strcmp(ep[i].extensionName, "VK_EXT_metal_surface") == 0)
|
||||
_glfw.vk.EXT_metal_surface = GLFW_TRUE;
|
||||
#elif defined(_GLFW_X11)
|
||||
else if (strcmp(ep[i].extensionName, "VK_KHR_xlib_surface") == 0)
|
||||
_glfw.vk.KHR_xlib_surface = GLFW_TRUE;
|
||||
|
|
58
raylib/external/glfw/src/wayland-idle-inhibit-unstable-v1-client-protocol.c
vendored
Normal file
58
raylib/external/glfw/src/wayland-idle-inhibit-unstable-v1-client-protocol.c
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2015 Samsung Electronics Co., Ltd
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
extern const struct wl_interface zwp_idle_inhibitor_v1_interface;
|
||||
|
||||
static const struct wl_interface *idle_inhibit_unstable_v1_wl_ii_types[] = {
|
||||
&zwp_idle_inhibitor_v1_interface,
|
||||
&wl_surface_interface,
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_idle_inhibit_manager_v1_requests[] = {
|
||||
{ "destroy", "", idle_inhibit_unstable_v1_wl_ii_types + 0 },
|
||||
{ "create_inhibitor", "no", idle_inhibit_unstable_v1_wl_ii_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface zwp_idle_inhibit_manager_v1_interface = {
|
||||
"zwp_idle_inhibit_manager_v1", 1,
|
||||
2, zwp_idle_inhibit_manager_v1_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_idle_inhibitor_v1_requests[] = {
|
||||
{ "destroy", "", idle_inhibit_unstable_v1_wl_ii_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface zwp_idle_inhibitor_v1_interface = {
|
||||
"zwp_idle_inhibitor_v1", 1,
|
||||
1, zwp_idle_inhibitor_v1_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
230
raylib/external/glfw/src/wayland-idle-inhibit-unstable-v1-client-protocol.h
vendored
Normal file
230
raylib/external/glfw/src/wayland-idle-inhibit-unstable-v1-client-protocol.h
vendored
Normal file
|
@ -0,0 +1,230 @@
|
|||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
#ifndef IDLE_INHIBIT_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
#define IDLE_INHIBIT_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "wayland-client.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @page page_idle_inhibit_unstable_v1 The idle_inhibit_unstable_v1 protocol
|
||||
* @section page_ifaces_idle_inhibit_unstable_v1 Interfaces
|
||||
* - @subpage page_iface_zwp_idle_inhibit_manager_v1 - control behavior when display idles
|
||||
* - @subpage page_iface_zwp_idle_inhibitor_v1 - context object for inhibiting idle behavior
|
||||
* @section page_copyright_idle_inhibit_unstable_v1 Copyright
|
||||
* <pre>
|
||||
*
|
||||
* Copyright © 2015 Samsung Electronics Co., Ltd
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* </pre>
|
||||
*/
|
||||
struct wl_surface;
|
||||
struct zwp_idle_inhibit_manager_v1;
|
||||
struct zwp_idle_inhibitor_v1;
|
||||
|
||||
/**
|
||||
* @page page_iface_zwp_idle_inhibit_manager_v1 zwp_idle_inhibit_manager_v1
|
||||
* @section page_iface_zwp_idle_inhibit_manager_v1_desc Description
|
||||
*
|
||||
* This interface permits inhibiting the idle behavior such as screen
|
||||
* blanking, locking, and screensaving. The client binds the idle manager
|
||||
* globally, then creates idle-inhibitor objects for each surface.
|
||||
*
|
||||
* Warning! The protocol described in this file is experimental and
|
||||
* backward incompatible changes may be made. Backward compatible changes
|
||||
* may be added together with the corresponding interface version bump.
|
||||
* Backward incompatible changes are done by bumping the version number in
|
||||
* the protocol and interface names and resetting the interface version.
|
||||
* Once the protocol is to be declared stable, the 'z' prefix and the
|
||||
* version number in the protocol and interface names are removed and the
|
||||
* interface version number is reset.
|
||||
* @section page_iface_zwp_idle_inhibit_manager_v1_api API
|
||||
* See @ref iface_zwp_idle_inhibit_manager_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_zwp_idle_inhibit_manager_v1 The zwp_idle_inhibit_manager_v1 interface
|
||||
*
|
||||
* This interface permits inhibiting the idle behavior such as screen
|
||||
* blanking, locking, and screensaving. The client binds the idle manager
|
||||
* globally, then creates idle-inhibitor objects for each surface.
|
||||
*
|
||||
* Warning! The protocol described in this file is experimental and
|
||||
* backward incompatible changes may be made. Backward compatible changes
|
||||
* may be added together with the corresponding interface version bump.
|
||||
* Backward incompatible changes are done by bumping the version number in
|
||||
* the protocol and interface names and resetting the interface version.
|
||||
* Once the protocol is to be declared stable, the 'z' prefix and the
|
||||
* version number in the protocol and interface names are removed and the
|
||||
* interface version number is reset.
|
||||
*/
|
||||
extern const struct wl_interface zwp_idle_inhibit_manager_v1_interface;
|
||||
/**
|
||||
* @page page_iface_zwp_idle_inhibitor_v1 zwp_idle_inhibitor_v1
|
||||
* @section page_iface_zwp_idle_inhibitor_v1_desc Description
|
||||
*
|
||||
* An idle inhibitor prevents the output that the associated surface is
|
||||
* visible on from being set to a state where it is not visually usable due
|
||||
* to lack of user interaction (e.g. blanked, dimmed, locked, set to power
|
||||
* save, etc.) Any screensaver processes are also blocked from displaying.
|
||||
*
|
||||
* If the surface is destroyed, unmapped, becomes occluded, loses
|
||||
* visibility, or otherwise becomes not visually relevant for the user, the
|
||||
* idle inhibitor will not be honored by the compositor; if the surface
|
||||
* subsequently regains visibility the inhibitor takes effect once again.
|
||||
* Likewise, the inhibitor isn't honored if the system was already idled at
|
||||
* the time the inhibitor was established, although if the system later
|
||||
* de-idles and re-idles the inhibitor will take effect.
|
||||
* @section page_iface_zwp_idle_inhibitor_v1_api API
|
||||
* See @ref iface_zwp_idle_inhibitor_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_zwp_idle_inhibitor_v1 The zwp_idle_inhibitor_v1 interface
|
||||
*
|
||||
* An idle inhibitor prevents the output that the associated surface is
|
||||
* visible on from being set to a state where it is not visually usable due
|
||||
* to lack of user interaction (e.g. blanked, dimmed, locked, set to power
|
||||
* save, etc.) Any screensaver processes are also blocked from displaying.
|
||||
*
|
||||
* If the surface is destroyed, unmapped, becomes occluded, loses
|
||||
* visibility, or otherwise becomes not visually relevant for the user, the
|
||||
* idle inhibitor will not be honored by the compositor; if the surface
|
||||
* subsequently regains visibility the inhibitor takes effect once again.
|
||||
* Likewise, the inhibitor isn't honored if the system was already idled at
|
||||
* the time the inhibitor was established, although if the system later
|
||||
* de-idles and re-idles the inhibitor will take effect.
|
||||
*/
|
||||
extern const struct wl_interface zwp_idle_inhibitor_v1_interface;
|
||||
|
||||
#define ZWP_IDLE_INHIBIT_MANAGER_V1_DESTROY 0
|
||||
#define ZWP_IDLE_INHIBIT_MANAGER_V1_CREATE_INHIBITOR 1
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_idle_inhibit_manager_v1
|
||||
*/
|
||||
#define ZWP_IDLE_INHIBIT_MANAGER_V1_DESTROY_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_idle_inhibit_manager_v1
|
||||
*/
|
||||
#define ZWP_IDLE_INHIBIT_MANAGER_V1_CREATE_INHIBITOR_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_zwp_idle_inhibit_manager_v1 */
|
||||
static inline void
|
||||
zwp_idle_inhibit_manager_v1_set_user_data(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) zwp_idle_inhibit_manager_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_zwp_idle_inhibit_manager_v1 */
|
||||
static inline void *
|
||||
zwp_idle_inhibit_manager_v1_get_user_data(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) zwp_idle_inhibit_manager_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
zwp_idle_inhibit_manager_v1_get_version(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) zwp_idle_inhibit_manager_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_idle_inhibit_manager_v1
|
||||
*
|
||||
* Destroy the inhibit manager.
|
||||
*/
|
||||
static inline void
|
||||
zwp_idle_inhibit_manager_v1_destroy(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_idle_inhibit_manager_v1,
|
||||
ZWP_IDLE_INHIBIT_MANAGER_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_idle_inhibit_manager_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_idle_inhibit_manager_v1
|
||||
*
|
||||
* Create a new inhibitor object associated with the given surface.
|
||||
*/
|
||||
static inline struct zwp_idle_inhibitor_v1 *
|
||||
zwp_idle_inhibit_manager_v1_create_inhibitor(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1, struct wl_surface *surface)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_idle_inhibit_manager_v1,
|
||||
ZWP_IDLE_INHIBIT_MANAGER_V1_CREATE_INHIBITOR, &zwp_idle_inhibitor_v1_interface, NULL, surface);
|
||||
|
||||
return (struct zwp_idle_inhibitor_v1 *) id;
|
||||
}
|
||||
|
||||
#define ZWP_IDLE_INHIBITOR_V1_DESTROY 0
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_idle_inhibitor_v1
|
||||
*/
|
||||
#define ZWP_IDLE_INHIBITOR_V1_DESTROY_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_zwp_idle_inhibitor_v1 */
|
||||
static inline void
|
||||
zwp_idle_inhibitor_v1_set_user_data(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibitor_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) zwp_idle_inhibitor_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_zwp_idle_inhibitor_v1 */
|
||||
static inline void *
|
||||
zwp_idle_inhibitor_v1_get_user_data(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibitor_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) zwp_idle_inhibitor_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
zwp_idle_inhibitor_v1_get_version(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibitor_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) zwp_idle_inhibitor_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_idle_inhibitor_v1
|
||||
*
|
||||
* Remove the inhibitor effect from the associated wl_surface.
|
||||
*/
|
||||
static inline void
|
||||
zwp_idle_inhibitor_v1_destroy(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibitor_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_idle_inhibitor_v1,
|
||||
ZWP_IDLE_INHIBITOR_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_idle_inhibitor_v1);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
98
raylib/external/glfw/src/wayland-pointer-constraints-unstable-v1-client-protocol.c
vendored
Normal file
98
raylib/external/glfw/src/wayland-pointer-constraints-unstable-v1-client-protocol.c
vendored
Normal file
|
@ -0,0 +1,98 @@
|
|||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2014 Jonas Ådahl
|
||||
* Copyright © 2015 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
|
||||
extern const struct wl_interface wl_pointer_interface;
|
||||
extern const struct wl_interface wl_region_interface;
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
extern const struct wl_interface zwp_confined_pointer_v1_interface;
|
||||
extern const struct wl_interface zwp_locked_pointer_v1_interface;
|
||||
|
||||
static const struct wl_interface *pointer_constraints_unstable_v1_wl_pc_types[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
&zwp_locked_pointer_v1_interface,
|
||||
&wl_surface_interface,
|
||||
&wl_pointer_interface,
|
||||
&wl_region_interface,
|
||||
NULL,
|
||||
&zwp_confined_pointer_v1_interface,
|
||||
&wl_surface_interface,
|
||||
&wl_pointer_interface,
|
||||
&wl_region_interface,
|
||||
NULL,
|
||||
&wl_region_interface,
|
||||
&wl_region_interface,
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_pointer_constraints_v1_requests[] = {
|
||||
{ "destroy", "", pointer_constraints_unstable_v1_wl_pc_types + 0 },
|
||||
{ "lock_pointer", "noo?ou", pointer_constraints_unstable_v1_wl_pc_types + 2 },
|
||||
{ "confine_pointer", "noo?ou", pointer_constraints_unstable_v1_wl_pc_types + 7 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface zwp_pointer_constraints_v1_interface = {
|
||||
"zwp_pointer_constraints_v1", 1,
|
||||
3, zwp_pointer_constraints_v1_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_locked_pointer_v1_requests[] = {
|
||||
{ "destroy", "", pointer_constraints_unstable_v1_wl_pc_types + 0 },
|
||||
{ "set_cursor_position_hint", "ff", pointer_constraints_unstable_v1_wl_pc_types + 0 },
|
||||
{ "set_region", "?o", pointer_constraints_unstable_v1_wl_pc_types + 12 },
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_locked_pointer_v1_events[] = {
|
||||
{ "locked", "", pointer_constraints_unstable_v1_wl_pc_types + 0 },
|
||||
{ "unlocked", "", pointer_constraints_unstable_v1_wl_pc_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface zwp_locked_pointer_v1_interface = {
|
||||
"zwp_locked_pointer_v1", 1,
|
||||
3, zwp_locked_pointer_v1_requests,
|
||||
2, zwp_locked_pointer_v1_events,
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_confined_pointer_v1_requests[] = {
|
||||
{ "destroy", "", pointer_constraints_unstable_v1_wl_pc_types + 0 },
|
||||
{ "set_region", "?o", pointer_constraints_unstable_v1_wl_pc_types + 13 },
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_confined_pointer_v1_events[] = {
|
||||
{ "confined", "", pointer_constraints_unstable_v1_wl_pc_types + 0 },
|
||||
{ "unconfined", "", pointer_constraints_unstable_v1_wl_pc_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface zwp_confined_pointer_v1_interface = {
|
||||
"zwp_confined_pointer_v1", 1,
|
||||
2, zwp_confined_pointer_v1_requests,
|
||||
2, zwp_confined_pointer_v1_events,
|
||||
};
|
||||
|
649
raylib/external/glfw/src/wayland-pointer-constraints-unstable-v1-client-protocol.h
vendored
Normal file
649
raylib/external/glfw/src/wayland-pointer-constraints-unstable-v1-client-protocol.h
vendored
Normal file
|
@ -0,0 +1,649 @@
|
|||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
#ifndef POINTER_CONSTRAINTS_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
#define POINTER_CONSTRAINTS_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "wayland-client.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @page page_pointer_constraints_unstable_v1 The pointer_constraints_unstable_v1 protocol
|
||||
* protocol for constraining pointer motions
|
||||
*
|
||||
* @section page_desc_pointer_constraints_unstable_v1 Description
|
||||
*
|
||||
* This protocol specifies a set of interfaces used for adding constraints to
|
||||
* the motion of a pointer. Possible constraints include confining pointer
|
||||
* motions to a given region, or locking it to its current position.
|
||||
*
|
||||
* In order to constrain the pointer, a client must first bind the global
|
||||
* interface "wp_pointer_constraints" which, if a compositor supports pointer
|
||||
* constraints, is exposed by the registry. Using the bound global object, the
|
||||
* client uses the request that corresponds to the type of constraint it wants
|
||||
* to make. See wp_pointer_constraints for more details.
|
||||
*
|
||||
* Warning! The protocol described in this file is experimental and backward
|
||||
* incompatible changes may be made. Backward compatible changes may be added
|
||||
* together with the corresponding interface version bump. Backward
|
||||
* incompatible changes are done by bumping the version number in the protocol
|
||||
* and interface names and resetting the interface version. Once the protocol
|
||||
* is to be declared stable, the 'z' prefix and the version number in the
|
||||
* protocol and interface names are removed and the interface version number is
|
||||
* reset.
|
||||
*
|
||||
* @section page_ifaces_pointer_constraints_unstable_v1 Interfaces
|
||||
* - @subpage page_iface_zwp_pointer_constraints_v1 - constrain the movement of a pointer
|
||||
* - @subpage page_iface_zwp_locked_pointer_v1 - receive relative pointer motion events
|
||||
* - @subpage page_iface_zwp_confined_pointer_v1 - confined pointer object
|
||||
* @section page_copyright_pointer_constraints_unstable_v1 Copyright
|
||||
* <pre>
|
||||
*
|
||||
* Copyright © 2014 Jonas Ådahl
|
||||
* Copyright © 2015 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* </pre>
|
||||
*/
|
||||
struct wl_pointer;
|
||||
struct wl_region;
|
||||
struct wl_surface;
|
||||
struct zwp_confined_pointer_v1;
|
||||
struct zwp_locked_pointer_v1;
|
||||
struct zwp_pointer_constraints_v1;
|
||||
|
||||
/**
|
||||
* @page page_iface_zwp_pointer_constraints_v1 zwp_pointer_constraints_v1
|
||||
* @section page_iface_zwp_pointer_constraints_v1_desc Description
|
||||
*
|
||||
* The global interface exposing pointer constraining functionality. It
|
||||
* exposes two requests: lock_pointer for locking the pointer to its
|
||||
* position, and confine_pointer for locking the pointer to a region.
|
||||
*
|
||||
* The lock_pointer and confine_pointer requests create the objects
|
||||
* wp_locked_pointer and wp_confined_pointer respectively, and the client can
|
||||
* use these objects to interact with the lock.
|
||||
*
|
||||
* For any surface, only one lock or confinement may be active across all
|
||||
* wl_pointer objects of the same seat. If a lock or confinement is requested
|
||||
* when another lock or confinement is active or requested on the same surface
|
||||
* and with any of the wl_pointer objects of the same seat, an
|
||||
* 'already_constrained' error will be raised.
|
||||
* @section page_iface_zwp_pointer_constraints_v1_api API
|
||||
* See @ref iface_zwp_pointer_constraints_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_zwp_pointer_constraints_v1 The zwp_pointer_constraints_v1 interface
|
||||
*
|
||||
* The global interface exposing pointer constraining functionality. It
|
||||
* exposes two requests: lock_pointer for locking the pointer to its
|
||||
* position, and confine_pointer for locking the pointer to a region.
|
||||
*
|
||||
* The lock_pointer and confine_pointer requests create the objects
|
||||
* wp_locked_pointer and wp_confined_pointer respectively, and the client can
|
||||
* use these objects to interact with the lock.
|
||||
*
|
||||
* For any surface, only one lock or confinement may be active across all
|
||||
* wl_pointer objects of the same seat. If a lock or confinement is requested
|
||||
* when another lock or confinement is active or requested on the same surface
|
||||
* and with any of the wl_pointer objects of the same seat, an
|
||||
* 'already_constrained' error will be raised.
|
||||
*/
|
||||
extern const struct wl_interface zwp_pointer_constraints_v1_interface;
|
||||
/**
|
||||
* @page page_iface_zwp_locked_pointer_v1 zwp_locked_pointer_v1
|
||||
* @section page_iface_zwp_locked_pointer_v1_desc Description
|
||||
*
|
||||
* The wp_locked_pointer interface represents a locked pointer state.
|
||||
*
|
||||
* While the lock of this object is active, the wl_pointer objects of the
|
||||
* associated seat will not emit any wl_pointer.motion events.
|
||||
*
|
||||
* This object will send the event 'locked' when the lock is activated.
|
||||
* Whenever the lock is activated, it is guaranteed that the locked surface
|
||||
* will already have received pointer focus and that the pointer will be
|
||||
* within the region passed to the request creating this object.
|
||||
*
|
||||
* To unlock the pointer, send the destroy request. This will also destroy
|
||||
* the wp_locked_pointer object.
|
||||
*
|
||||
* If the compositor decides to unlock the pointer the unlocked event is
|
||||
* sent. See wp_locked_pointer.unlock for details.
|
||||
*
|
||||
* When unlocking, the compositor may warp the cursor position to the set
|
||||
* cursor position hint. If it does, it will not result in any relative
|
||||
* motion events emitted via wp_relative_pointer.
|
||||
*
|
||||
* If the surface the lock was requested on is destroyed and the lock is not
|
||||
* yet activated, the wp_locked_pointer object is now defunct and must be
|
||||
* destroyed.
|
||||
* @section page_iface_zwp_locked_pointer_v1_api API
|
||||
* See @ref iface_zwp_locked_pointer_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_zwp_locked_pointer_v1 The zwp_locked_pointer_v1 interface
|
||||
*
|
||||
* The wp_locked_pointer interface represents a locked pointer state.
|
||||
*
|
||||
* While the lock of this object is active, the wl_pointer objects of the
|
||||
* associated seat will not emit any wl_pointer.motion events.
|
||||
*
|
||||
* This object will send the event 'locked' when the lock is activated.
|
||||
* Whenever the lock is activated, it is guaranteed that the locked surface
|
||||
* will already have received pointer focus and that the pointer will be
|
||||
* within the region passed to the request creating this object.
|
||||
*
|
||||
* To unlock the pointer, send the destroy request. This will also destroy
|
||||
* the wp_locked_pointer object.
|
||||
*
|
||||
* If the compositor decides to unlock the pointer the unlocked event is
|
||||
* sent. See wp_locked_pointer.unlock for details.
|
||||
*
|
||||
* When unlocking, the compositor may warp the cursor position to the set
|
||||
* cursor position hint. If it does, it will not result in any relative
|
||||
* motion events emitted via wp_relative_pointer.
|
||||
*
|
||||
* If the surface the lock was requested on is destroyed and the lock is not
|
||||
* yet activated, the wp_locked_pointer object is now defunct and must be
|
||||
* destroyed.
|
||||
*/
|
||||
extern const struct wl_interface zwp_locked_pointer_v1_interface;
|
||||
/**
|
||||
* @page page_iface_zwp_confined_pointer_v1 zwp_confined_pointer_v1
|
||||
* @section page_iface_zwp_confined_pointer_v1_desc Description
|
||||
*
|
||||
* The wp_confined_pointer interface represents a confined pointer state.
|
||||
*
|
||||
* This object will send the event 'confined' when the confinement is
|
||||
* activated. Whenever the confinement is activated, it is guaranteed that
|
||||
* the surface the pointer is confined to will already have received pointer
|
||||
* focus and that the pointer will be within the region passed to the request
|
||||
* creating this object. It is up to the compositor to decide whether this
|
||||
* requires some user interaction and if the pointer will warp to within the
|
||||
* passed region if outside.
|
||||
*
|
||||
* To unconfine the pointer, send the destroy request. This will also destroy
|
||||
* the wp_confined_pointer object.
|
||||
*
|
||||
* If the compositor decides to unconfine the pointer the unconfined event is
|
||||
* sent. The wp_confined_pointer object is at this point defunct and should
|
||||
* be destroyed.
|
||||
* @section page_iface_zwp_confined_pointer_v1_api API
|
||||
* See @ref iface_zwp_confined_pointer_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_zwp_confined_pointer_v1 The zwp_confined_pointer_v1 interface
|
||||
*
|
||||
* The wp_confined_pointer interface represents a confined pointer state.
|
||||
*
|
||||
* This object will send the event 'confined' when the confinement is
|
||||
* activated. Whenever the confinement is activated, it is guaranteed that
|
||||
* the surface the pointer is confined to will already have received pointer
|
||||
* focus and that the pointer will be within the region passed to the request
|
||||
* creating this object. It is up to the compositor to decide whether this
|
||||
* requires some user interaction and if the pointer will warp to within the
|
||||
* passed region if outside.
|
||||
*
|
||||
* To unconfine the pointer, send the destroy request. This will also destroy
|
||||
* the wp_confined_pointer object.
|
||||
*
|
||||
* If the compositor decides to unconfine the pointer the unconfined event is
|
||||
* sent. The wp_confined_pointer object is at this point defunct and should
|
||||
* be destroyed.
|
||||
*/
|
||||
extern const struct wl_interface zwp_confined_pointer_v1_interface;
|
||||
|
||||
#ifndef ZWP_POINTER_CONSTRAINTS_V1_ERROR_ENUM
|
||||
#define ZWP_POINTER_CONSTRAINTS_V1_ERROR_ENUM
|
||||
/**
|
||||
* @ingroup iface_zwp_pointer_constraints_v1
|
||||
* wp_pointer_constraints error values
|
||||
*
|
||||
* These errors can be emitted in response to wp_pointer_constraints
|
||||
* requests.
|
||||
*/
|
||||
enum zwp_pointer_constraints_v1_error {
|
||||
/**
|
||||
* pointer constraint already requested on that surface
|
||||
*/
|
||||
ZWP_POINTER_CONSTRAINTS_V1_ERROR_ALREADY_CONSTRAINED = 1,
|
||||
};
|
||||
#endif /* ZWP_POINTER_CONSTRAINTS_V1_ERROR_ENUM */
|
||||
|
||||
#ifndef ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM
|
||||
#define ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM
|
||||
/**
|
||||
* @ingroup iface_zwp_pointer_constraints_v1
|
||||
* the pointer constraint may reactivate
|
||||
*
|
||||
* A persistent pointer constraint may again reactivate once it has
|
||||
* been deactivated. See the corresponding deactivation event
|
||||
* (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
|
||||
* details.
|
||||
*/
|
||||
enum zwp_pointer_constraints_v1_lifetime {
|
||||
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT = 1,
|
||||
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT = 2,
|
||||
};
|
||||
#endif /* ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM */
|
||||
|
||||
#define ZWP_POINTER_CONSTRAINTS_V1_DESTROY 0
|
||||
#define ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER 1
|
||||
#define ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER 2
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_pointer_constraints_v1
|
||||
*/
|
||||
#define ZWP_POINTER_CONSTRAINTS_V1_DESTROY_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_pointer_constraints_v1
|
||||
*/
|
||||
#define ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_pointer_constraints_v1
|
||||
*/
|
||||
#define ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_zwp_pointer_constraints_v1 */
|
||||
static inline void
|
||||
zwp_pointer_constraints_v1_set_user_data(struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) zwp_pointer_constraints_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_zwp_pointer_constraints_v1 */
|
||||
static inline void *
|
||||
zwp_pointer_constraints_v1_get_user_data(struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) zwp_pointer_constraints_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
zwp_pointer_constraints_v1_get_version(struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) zwp_pointer_constraints_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_pointer_constraints_v1
|
||||
*
|
||||
* Used by the client to notify the server that it will no longer use this
|
||||
* pointer constraints object.
|
||||
*/
|
||||
static inline void
|
||||
zwp_pointer_constraints_v1_destroy(struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_pointer_constraints_v1,
|
||||
ZWP_POINTER_CONSTRAINTS_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_pointer_constraints_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_pointer_constraints_v1
|
||||
*
|
||||
* The lock_pointer request lets the client request to disable movements of
|
||||
* the virtual pointer (i.e. the cursor), effectively locking the pointer
|
||||
* to a position. This request may not take effect immediately; in the
|
||||
* future, when the compositor deems implementation-specific constraints
|
||||
* are satisfied, the pointer lock will be activated and the compositor
|
||||
* sends a locked event.
|
||||
*
|
||||
* The protocol provides no guarantee that the constraints are ever
|
||||
* satisfied, and does not require the compositor to send an error if the
|
||||
* constraints cannot ever be satisfied. It is thus possible to request a
|
||||
* lock that will never activate.
|
||||
*
|
||||
* There may not be another pointer constraint of any kind requested or
|
||||
* active on the surface for any of the wl_pointer objects of the seat of
|
||||
* the passed pointer when requesting a lock. If there is, an error will be
|
||||
* raised. See general pointer lock documentation for more details.
|
||||
*
|
||||
* The intersection of the region passed with this request and the input
|
||||
* region of the surface is used to determine where the pointer must be
|
||||
* in order for the lock to activate. It is up to the compositor whether to
|
||||
* warp the pointer or require some kind of user interaction for the lock
|
||||
* to activate. If the region is null the surface input region is used.
|
||||
*
|
||||
* A surface may receive pointer focus without the lock being activated.
|
||||
*
|
||||
* The request creates a new object wp_locked_pointer which is used to
|
||||
* interact with the lock as well as receive updates about its state. See
|
||||
* the the description of wp_locked_pointer for further information.
|
||||
*
|
||||
* Note that while a pointer is locked, the wl_pointer objects of the
|
||||
* corresponding seat will not emit any wl_pointer.motion events, but
|
||||
* relative motion events will still be emitted via wp_relative_pointer
|
||||
* objects of the same seat. wl_pointer.axis and wl_pointer.button events
|
||||
* are unaffected.
|
||||
*/
|
||||
static inline struct zwp_locked_pointer_v1 *
|
||||
zwp_pointer_constraints_v1_lock_pointer(struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1, struct wl_surface *surface, struct wl_pointer *pointer, struct wl_region *region, uint32_t lifetime)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_pointer_constraints_v1,
|
||||
ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER, &zwp_locked_pointer_v1_interface, NULL, surface, pointer, region, lifetime);
|
||||
|
||||
return (struct zwp_locked_pointer_v1 *) id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_pointer_constraints_v1
|
||||
*
|
||||
* The confine_pointer request lets the client request to confine the
|
||||
* pointer cursor to a given region. This request may not take effect
|
||||
* immediately; in the future, when the compositor deems implementation-
|
||||
* specific constraints are satisfied, the pointer confinement will be
|
||||
* activated and the compositor sends a confined event.
|
||||
*
|
||||
* The intersection of the region passed with this request and the input
|
||||
* region of the surface is used to determine where the pointer must be
|
||||
* in order for the confinement to activate. It is up to the compositor
|
||||
* whether to warp the pointer or require some kind of user interaction for
|
||||
* the confinement to activate. If the region is null the surface input
|
||||
* region is used.
|
||||
*
|
||||
* The request will create a new object wp_confined_pointer which is used
|
||||
* to interact with the confinement as well as receive updates about its
|
||||
* state. See the the description of wp_confined_pointer for further
|
||||
* information.
|
||||
*/
|
||||
static inline struct zwp_confined_pointer_v1 *
|
||||
zwp_pointer_constraints_v1_confine_pointer(struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1, struct wl_surface *surface, struct wl_pointer *pointer, struct wl_region *region, uint32_t lifetime)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_pointer_constraints_v1,
|
||||
ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER, &zwp_confined_pointer_v1_interface, NULL, surface, pointer, region, lifetime);
|
||||
|
||||
return (struct zwp_confined_pointer_v1 *) id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_locked_pointer_v1
|
||||
* @struct zwp_locked_pointer_v1_listener
|
||||
*/
|
||||
struct zwp_locked_pointer_v1_listener {
|
||||
/**
|
||||
* lock activation event
|
||||
*
|
||||
* Notification that the pointer lock of the seat's pointer is
|
||||
* activated.
|
||||
*/
|
||||
void (*locked)(void *data,
|
||||
struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1);
|
||||
/**
|
||||
* lock deactivation event
|
||||
*
|
||||
* Notification that the pointer lock of the seat's pointer is no
|
||||
* longer active. If this is a oneshot pointer lock (see
|
||||
* wp_pointer_constraints.lifetime) this object is now defunct and
|
||||
* should be destroyed. If this is a persistent pointer lock (see
|
||||
* wp_pointer_constraints.lifetime) this pointer lock may again
|
||||
* reactivate in the future.
|
||||
*/
|
||||
void (*unlocked)(void *data,
|
||||
struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_locked_pointer_v1
|
||||
*/
|
||||
static inline int
|
||||
zwp_locked_pointer_v1_add_listener(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1,
|
||||
const struct zwp_locked_pointer_v1_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) zwp_locked_pointer_v1,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define ZWP_LOCKED_POINTER_V1_DESTROY 0
|
||||
#define ZWP_LOCKED_POINTER_V1_SET_CURSOR_POSITION_HINT 1
|
||||
#define ZWP_LOCKED_POINTER_V1_SET_REGION 2
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_locked_pointer_v1
|
||||
*/
|
||||
#define ZWP_LOCKED_POINTER_V1_LOCKED_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_locked_pointer_v1
|
||||
*/
|
||||
#define ZWP_LOCKED_POINTER_V1_UNLOCKED_SINCE_VERSION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_locked_pointer_v1
|
||||
*/
|
||||
#define ZWP_LOCKED_POINTER_V1_DESTROY_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_locked_pointer_v1
|
||||
*/
|
||||
#define ZWP_LOCKED_POINTER_V1_SET_CURSOR_POSITION_HINT_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_locked_pointer_v1
|
||||
*/
|
||||
#define ZWP_LOCKED_POINTER_V1_SET_REGION_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_zwp_locked_pointer_v1 */
|
||||
static inline void
|
||||
zwp_locked_pointer_v1_set_user_data(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) zwp_locked_pointer_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_zwp_locked_pointer_v1 */
|
||||
static inline void *
|
||||
zwp_locked_pointer_v1_get_user_data(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) zwp_locked_pointer_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
zwp_locked_pointer_v1_get_version(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) zwp_locked_pointer_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_locked_pointer_v1
|
||||
*
|
||||
* Destroy the locked pointer object. If applicable, the compositor will
|
||||
* unlock the pointer.
|
||||
*/
|
||||
static inline void
|
||||
zwp_locked_pointer_v1_destroy(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_locked_pointer_v1,
|
||||
ZWP_LOCKED_POINTER_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_locked_pointer_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_locked_pointer_v1
|
||||
*
|
||||
* Set the cursor position hint relative to the top left corner of the
|
||||
* surface.
|
||||
*
|
||||
* If the client is drawing its own cursor, it should update the position
|
||||
* hint to the position of its own cursor. A compositor may use this
|
||||
* information to warp the pointer upon unlock in order to avoid pointer
|
||||
* jumps.
|
||||
*
|
||||
* The cursor position hint is double buffered. The new hint will only take
|
||||
* effect when the associated surface gets it pending state applied. See
|
||||
* wl_surface.commit for details.
|
||||
*/
|
||||
static inline void
|
||||
zwp_locked_pointer_v1_set_cursor_position_hint(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1, wl_fixed_t surface_x, wl_fixed_t surface_y)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_locked_pointer_v1,
|
||||
ZWP_LOCKED_POINTER_V1_SET_CURSOR_POSITION_HINT, surface_x, surface_y);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_locked_pointer_v1
|
||||
*
|
||||
* Set a new region used to lock the pointer.
|
||||
*
|
||||
* The new lock region is double-buffered. The new lock region will
|
||||
* only take effect when the associated surface gets its pending state
|
||||
* applied. See wl_surface.commit for details.
|
||||
*
|
||||
* For details about the lock region, see wp_locked_pointer.
|
||||
*/
|
||||
static inline void
|
||||
zwp_locked_pointer_v1_set_region(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1, struct wl_region *region)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_locked_pointer_v1,
|
||||
ZWP_LOCKED_POINTER_V1_SET_REGION, region);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_confined_pointer_v1
|
||||
* @struct zwp_confined_pointer_v1_listener
|
||||
*/
|
||||
struct zwp_confined_pointer_v1_listener {
|
||||
/**
|
||||
* pointer confined
|
||||
*
|
||||
* Notification that the pointer confinement of the seat's
|
||||
* pointer is activated.
|
||||
*/
|
||||
void (*confined)(void *data,
|
||||
struct zwp_confined_pointer_v1 *zwp_confined_pointer_v1);
|
||||
/**
|
||||
* pointer unconfined
|
||||
*
|
||||
* Notification that the pointer confinement of the seat's
|
||||
* pointer is no longer active. If this is a oneshot pointer
|
||||
* confinement (see wp_pointer_constraints.lifetime) this object is
|
||||
* now defunct and should be destroyed. If this is a persistent
|
||||
* pointer confinement (see wp_pointer_constraints.lifetime) this
|
||||
* pointer confinement may again reactivate in the future.
|
||||
*/
|
||||
void (*unconfined)(void *data,
|
||||
struct zwp_confined_pointer_v1 *zwp_confined_pointer_v1);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_confined_pointer_v1
|
||||
*/
|
||||
static inline int
|
||||
zwp_confined_pointer_v1_add_listener(struct zwp_confined_pointer_v1 *zwp_confined_pointer_v1,
|
||||
const struct zwp_confined_pointer_v1_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) zwp_confined_pointer_v1,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define ZWP_CONFINED_POINTER_V1_DESTROY 0
|
||||
#define ZWP_CONFINED_POINTER_V1_SET_REGION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_confined_pointer_v1
|
||||
*/
|
||||
#define ZWP_CONFINED_POINTER_V1_CONFINED_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_confined_pointer_v1
|
||||
*/
|
||||
#define ZWP_CONFINED_POINTER_V1_UNCONFINED_SINCE_VERSION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_confined_pointer_v1
|
||||
*/
|
||||
#define ZWP_CONFINED_POINTER_V1_DESTROY_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_confined_pointer_v1
|
||||
*/
|
||||
#define ZWP_CONFINED_POINTER_V1_SET_REGION_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_zwp_confined_pointer_v1 */
|
||||
static inline void
|
||||
zwp_confined_pointer_v1_set_user_data(struct zwp_confined_pointer_v1 *zwp_confined_pointer_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) zwp_confined_pointer_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_zwp_confined_pointer_v1 */
|
||||
static inline void *
|
||||
zwp_confined_pointer_v1_get_user_data(struct zwp_confined_pointer_v1 *zwp_confined_pointer_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) zwp_confined_pointer_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
zwp_confined_pointer_v1_get_version(struct zwp_confined_pointer_v1 *zwp_confined_pointer_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) zwp_confined_pointer_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_confined_pointer_v1
|
||||
*
|
||||
* Destroy the confined pointer object. If applicable, the compositor will
|
||||
* unconfine the pointer.
|
||||
*/
|
||||
static inline void
|
||||
zwp_confined_pointer_v1_destroy(struct zwp_confined_pointer_v1 *zwp_confined_pointer_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_confined_pointer_v1,
|
||||
ZWP_CONFINED_POINTER_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_confined_pointer_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_confined_pointer_v1
|
||||
*
|
||||
* Set a new region used to confine the pointer.
|
||||
*
|
||||
* The new confine region is double-buffered. The new confine region will
|
||||
* only take effect when the associated surface gets its pending state
|
||||
* applied. See wl_surface.commit for details.
|
||||
*
|
||||
* If the confinement is active when the new confinement region is applied
|
||||
* and the pointer ends up outside of newly applied region, the pointer may
|
||||
* warped to a position within the new confinement region. If warped, a
|
||||
* wl_pointer.motion event will be emitted, but no
|
||||
* wp_relative_pointer.relative_motion event.
|
||||
*
|
||||
* The compositor may also, instead of using the new region, unconfine the
|
||||
* pointer.
|
||||
*
|
||||
* For details about the confine region, see wp_confined_pointer.
|
||||
*/
|
||||
static inline void
|
||||
zwp_confined_pointer_v1_set_region(struct zwp_confined_pointer_v1 *zwp_confined_pointer_v1, struct wl_region *region)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_confined_pointer_v1,
|
||||
ZWP_CONFINED_POINTER_V1_SET_REGION, region);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
69
raylib/external/glfw/src/wayland-relative-pointer-unstable-v1-client-protocol.c
vendored
Normal file
69
raylib/external/glfw/src/wayland-relative-pointer-unstable-v1-client-protocol.c
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2014 Jonas Ådahl
|
||||
* Copyright © 2015 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
|
||||
extern const struct wl_interface wl_pointer_interface;
|
||||
extern const struct wl_interface zwp_relative_pointer_v1_interface;
|
||||
|
||||
static const struct wl_interface *relative_pointer_unstable_v1_wl_rp_types[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&zwp_relative_pointer_v1_interface,
|
||||
&wl_pointer_interface,
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_relative_pointer_manager_v1_requests[] = {
|
||||
{ "destroy", "", relative_pointer_unstable_v1_wl_rp_types + 0 },
|
||||
{ "get_relative_pointer", "no", relative_pointer_unstable_v1_wl_rp_types + 6 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface zwp_relative_pointer_manager_v1_interface = {
|
||||
"zwp_relative_pointer_manager_v1", 1,
|
||||
2, zwp_relative_pointer_manager_v1_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_relative_pointer_v1_requests[] = {
|
||||
{ "destroy", "", relative_pointer_unstable_v1_wl_rp_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_relative_pointer_v1_events[] = {
|
||||
{ "relative_motion", "uuffff", relative_pointer_unstable_v1_wl_rp_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface zwp_relative_pointer_v1_interface = {
|
||||
"zwp_relative_pointer_v1", 1,
|
||||
1, zwp_relative_pointer_v1_requests,
|
||||
1, zwp_relative_pointer_v1_events,
|
||||
};
|
||||
|
295
raylib/external/glfw/src/wayland-relative-pointer-unstable-v1-client-protocol.h
vendored
Normal file
295
raylib/external/glfw/src/wayland-relative-pointer-unstable-v1-client-protocol.h
vendored
Normal file
|
@ -0,0 +1,295 @@
|
|||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
#ifndef RELATIVE_POINTER_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
#define RELATIVE_POINTER_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "wayland-client.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @page page_relative_pointer_unstable_v1 The relative_pointer_unstable_v1 protocol
|
||||
* protocol for relative pointer motion events
|
||||
*
|
||||
* @section page_desc_relative_pointer_unstable_v1 Description
|
||||
*
|
||||
* This protocol specifies a set of interfaces used for making clients able to
|
||||
* receive relative pointer events not obstructed by barriers (such as the
|
||||
* monitor edge or other pointer barriers).
|
||||
*
|
||||
* To start receiving relative pointer events, a client must first bind the
|
||||
* global interface "wp_relative_pointer_manager" which, if a compositor
|
||||
* supports relative pointer motion events, is exposed by the registry. After
|
||||
* having created the relative pointer manager proxy object, the client uses
|
||||
* it to create the actual relative pointer object using the
|
||||
* "get_relative_pointer" request given a wl_pointer. The relative pointer
|
||||
* motion events will then, when applicable, be transmitted via the proxy of
|
||||
* the newly created relative pointer object. See the documentation of the
|
||||
* relative pointer interface for more details.
|
||||
*
|
||||
* Warning! The protocol described in this file is experimental and backward
|
||||
* incompatible changes may be made. Backward compatible changes may be added
|
||||
* together with the corresponding interface version bump. Backward
|
||||
* incompatible changes are done by bumping the version number in the protocol
|
||||
* and interface names and resetting the interface version. Once the protocol
|
||||
* is to be declared stable, the 'z' prefix and the version number in the
|
||||
* protocol and interface names are removed and the interface version number is
|
||||
* reset.
|
||||
*
|
||||
* @section page_ifaces_relative_pointer_unstable_v1 Interfaces
|
||||
* - @subpage page_iface_zwp_relative_pointer_manager_v1 - get relative pointer objects
|
||||
* - @subpage page_iface_zwp_relative_pointer_v1 - relative pointer object
|
||||
* @section page_copyright_relative_pointer_unstable_v1 Copyright
|
||||
* <pre>
|
||||
*
|
||||
* Copyright © 2014 Jonas Ådahl
|
||||
* Copyright © 2015 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* </pre>
|
||||
*/
|
||||
struct wl_pointer;
|
||||
struct zwp_relative_pointer_manager_v1;
|
||||
struct zwp_relative_pointer_v1;
|
||||
|
||||
/**
|
||||
* @page page_iface_zwp_relative_pointer_manager_v1 zwp_relative_pointer_manager_v1
|
||||
* @section page_iface_zwp_relative_pointer_manager_v1_desc Description
|
||||
*
|
||||
* A global interface used for getting the relative pointer object for a
|
||||
* given pointer.
|
||||
* @section page_iface_zwp_relative_pointer_manager_v1_api API
|
||||
* See @ref iface_zwp_relative_pointer_manager_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_zwp_relative_pointer_manager_v1 The zwp_relative_pointer_manager_v1 interface
|
||||
*
|
||||
* A global interface used for getting the relative pointer object for a
|
||||
* given pointer.
|
||||
*/
|
||||
extern const struct wl_interface zwp_relative_pointer_manager_v1_interface;
|
||||
/**
|
||||
* @page page_iface_zwp_relative_pointer_v1 zwp_relative_pointer_v1
|
||||
* @section page_iface_zwp_relative_pointer_v1_desc Description
|
||||
*
|
||||
* A wp_relative_pointer object is an extension to the wl_pointer interface
|
||||
* used for emitting relative pointer events. It shares the same focus as
|
||||
* wl_pointer objects of the same seat and will only emit events when it has
|
||||
* focus.
|
||||
* @section page_iface_zwp_relative_pointer_v1_api API
|
||||
* See @ref iface_zwp_relative_pointer_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_zwp_relative_pointer_v1 The zwp_relative_pointer_v1 interface
|
||||
*
|
||||
* A wp_relative_pointer object is an extension to the wl_pointer interface
|
||||
* used for emitting relative pointer events. It shares the same focus as
|
||||
* wl_pointer objects of the same seat and will only emit events when it has
|
||||
* focus.
|
||||
*/
|
||||
extern const struct wl_interface zwp_relative_pointer_v1_interface;
|
||||
|
||||
#define ZWP_RELATIVE_POINTER_MANAGER_V1_DESTROY 0
|
||||
#define ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER 1
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_relative_pointer_manager_v1
|
||||
*/
|
||||
#define ZWP_RELATIVE_POINTER_MANAGER_V1_DESTROY_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_relative_pointer_manager_v1
|
||||
*/
|
||||
#define ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_zwp_relative_pointer_manager_v1 */
|
||||
static inline void
|
||||
zwp_relative_pointer_manager_v1_set_user_data(struct zwp_relative_pointer_manager_v1 *zwp_relative_pointer_manager_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) zwp_relative_pointer_manager_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_zwp_relative_pointer_manager_v1 */
|
||||
static inline void *
|
||||
zwp_relative_pointer_manager_v1_get_user_data(struct zwp_relative_pointer_manager_v1 *zwp_relative_pointer_manager_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) zwp_relative_pointer_manager_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
zwp_relative_pointer_manager_v1_get_version(struct zwp_relative_pointer_manager_v1 *zwp_relative_pointer_manager_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) zwp_relative_pointer_manager_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_relative_pointer_manager_v1
|
||||
*
|
||||
* Used by the client to notify the server that it will no longer use this
|
||||
* relative pointer manager object.
|
||||
*/
|
||||
static inline void
|
||||
zwp_relative_pointer_manager_v1_destroy(struct zwp_relative_pointer_manager_v1 *zwp_relative_pointer_manager_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_relative_pointer_manager_v1,
|
||||
ZWP_RELATIVE_POINTER_MANAGER_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_relative_pointer_manager_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_relative_pointer_manager_v1
|
||||
*
|
||||
* Create a relative pointer interface given a wl_pointer object. See the
|
||||
* wp_relative_pointer interface for more details.
|
||||
*/
|
||||
static inline struct zwp_relative_pointer_v1 *
|
||||
zwp_relative_pointer_manager_v1_get_relative_pointer(struct zwp_relative_pointer_manager_v1 *zwp_relative_pointer_manager_v1, struct wl_pointer *pointer)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_relative_pointer_manager_v1,
|
||||
ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER, &zwp_relative_pointer_v1_interface, NULL, pointer);
|
||||
|
||||
return (struct zwp_relative_pointer_v1 *) id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_relative_pointer_v1
|
||||
* @struct zwp_relative_pointer_v1_listener
|
||||
*/
|
||||
struct zwp_relative_pointer_v1_listener {
|
||||
/**
|
||||
* relative pointer motion
|
||||
*
|
||||
* Relative x/y pointer motion from the pointer of the seat
|
||||
* associated with this object.
|
||||
*
|
||||
* A relative motion is in the same dimension as regular wl_pointer
|
||||
* motion events, except they do not represent an absolute
|
||||
* position. For example, moving a pointer from (x, y) to (x', y')
|
||||
* would have the equivalent relative motion (x' - x, y' - y). If a
|
||||
* pointer motion caused the absolute pointer position to be
|
||||
* clipped by for example the edge of the monitor, the relative
|
||||
* motion is unaffected by the clipping and will represent the
|
||||
* unclipped motion.
|
||||
*
|
||||
* This event also contains non-accelerated motion deltas. The
|
||||
* non-accelerated delta is, when applicable, the regular pointer
|
||||
* motion delta as it was before having applied motion acceleration
|
||||
* and other transformations such as normalization.
|
||||
*
|
||||
* Note that the non-accelerated delta does not represent 'raw'
|
||||
* events as they were read from some device. Pointer motion
|
||||
* acceleration is device- and configuration-specific and
|
||||
* non-accelerated deltas and accelerated deltas may have the same
|
||||
* value on some devices.
|
||||
*
|
||||
* Relative motions are not coupled to wl_pointer.motion events,
|
||||
* and can be sent in combination with such events, but also
|
||||
* independently. There may also be scenarios where
|
||||
* wl_pointer.motion is sent, but there is no relative motion. The
|
||||
* order of an absolute and relative motion event originating from
|
||||
* the same physical motion is not guaranteed.
|
||||
*
|
||||
* If the client needs button events or focus state, it can receive
|
||||
* them from a wl_pointer object of the same seat that the
|
||||
* wp_relative_pointer object is associated with.
|
||||
* @param utime_hi high 32 bits of a 64 bit timestamp with microsecond granularity
|
||||
* @param utime_lo low 32 bits of a 64 bit timestamp with microsecond granularity
|
||||
* @param dx the x component of the motion vector
|
||||
* @param dy the y component of the motion vector
|
||||
* @param dx_unaccel the x component of the unaccelerated motion vector
|
||||
* @param dy_unaccel the y component of the unaccelerated motion vector
|
||||
*/
|
||||
void (*relative_motion)(void *data,
|
||||
struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1,
|
||||
uint32_t utime_hi,
|
||||
uint32_t utime_lo,
|
||||
wl_fixed_t dx,
|
||||
wl_fixed_t dy,
|
||||
wl_fixed_t dx_unaccel,
|
||||
wl_fixed_t dy_unaccel);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_relative_pointer_v1
|
||||
*/
|
||||
static inline int
|
||||
zwp_relative_pointer_v1_add_listener(struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1,
|
||||
const struct zwp_relative_pointer_v1_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) zwp_relative_pointer_v1,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define ZWP_RELATIVE_POINTER_V1_DESTROY 0
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_relative_pointer_v1
|
||||
*/
|
||||
#define ZWP_RELATIVE_POINTER_V1_RELATIVE_MOTION_SINCE_VERSION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_relative_pointer_v1
|
||||
*/
|
||||
#define ZWP_RELATIVE_POINTER_V1_DESTROY_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_zwp_relative_pointer_v1 */
|
||||
static inline void
|
||||
zwp_relative_pointer_v1_set_user_data(struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) zwp_relative_pointer_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_zwp_relative_pointer_v1 */
|
||||
static inline void *
|
||||
zwp_relative_pointer_v1_get_user_data(struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) zwp_relative_pointer_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
zwp_relative_pointer_v1_get_version(struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) zwp_relative_pointer_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_relative_pointer_v1
|
||||
*/
|
||||
static inline void
|
||||
zwp_relative_pointer_v1_destroy(struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_relative_pointer_v1,
|
||||
ZWP_RELATIVE_POINTER_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_relative_pointer_v1);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
64
raylib/external/glfw/src/wayland-viewporter-client-protocol.c
vendored
Normal file
64
raylib/external/glfw/src/wayland-viewporter-client-protocol.c
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2013-2016 Collabora, Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
extern const struct wl_interface wp_viewport_interface;
|
||||
|
||||
static const struct wl_interface *viewporter_wl_v_types[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&wp_viewport_interface,
|
||||
&wl_surface_interface,
|
||||
};
|
||||
|
||||
static const struct wl_message wp_viewporter_requests[] = {
|
||||
{ "destroy", "", viewporter_wl_v_types + 0 },
|
||||
{ "get_viewport", "no", viewporter_wl_v_types + 4 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface wp_viewporter_interface = {
|
||||
"wp_viewporter", 1,
|
||||
2, wp_viewporter_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message wp_viewport_requests[] = {
|
||||
{ "destroy", "", viewporter_wl_v_types + 0 },
|
||||
{ "set_source", "ffff", viewporter_wl_v_types + 0 },
|
||||
{ "set_destination", "ii", viewporter_wl_v_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface wp_viewport_interface = {
|
||||
"wp_viewport", 1,
|
||||
3, wp_viewport_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
408
raylib/external/glfw/src/wayland-viewporter-client-protocol.h
vendored
Normal file
408
raylib/external/glfw/src/wayland-viewporter-client-protocol.h
vendored
Normal file
|
@ -0,0 +1,408 @@
|
|||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
#ifndef VIEWPORTER_CLIENT_PROTOCOL_H
|
||||
#define VIEWPORTER_CLIENT_PROTOCOL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "wayland-client.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @page page_viewporter The viewporter protocol
|
||||
* @section page_ifaces_viewporter Interfaces
|
||||
* - @subpage page_iface_wp_viewporter - surface cropping and scaling
|
||||
* - @subpage page_iface_wp_viewport - crop and scale interface to a wl_surface
|
||||
* @section page_copyright_viewporter Copyright
|
||||
* <pre>
|
||||
*
|
||||
* Copyright © 2013-2016 Collabora, Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* </pre>
|
||||
*/
|
||||
struct wl_surface;
|
||||
struct wp_viewport;
|
||||
struct wp_viewporter;
|
||||
|
||||
/**
|
||||
* @page page_iface_wp_viewporter wp_viewporter
|
||||
* @section page_iface_wp_viewporter_desc Description
|
||||
*
|
||||
* The global interface exposing surface cropping and scaling
|
||||
* capabilities is used to instantiate an interface extension for a
|
||||
* wl_surface object. This extended interface will then allow
|
||||
* cropping and scaling the surface contents, effectively
|
||||
* disconnecting the direct relationship between the buffer and the
|
||||
* surface size.
|
||||
* @section page_iface_wp_viewporter_api API
|
||||
* See @ref iface_wp_viewporter.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_wp_viewporter The wp_viewporter interface
|
||||
*
|
||||
* The global interface exposing surface cropping and scaling
|
||||
* capabilities is used to instantiate an interface extension for a
|
||||
* wl_surface object. This extended interface will then allow
|
||||
* cropping and scaling the surface contents, effectively
|
||||
* disconnecting the direct relationship between the buffer and the
|
||||
* surface size.
|
||||
*/
|
||||
extern const struct wl_interface wp_viewporter_interface;
|
||||
/**
|
||||
* @page page_iface_wp_viewport wp_viewport
|
||||
* @section page_iface_wp_viewport_desc Description
|
||||
*
|
||||
* An additional interface to a wl_surface object, which allows the
|
||||
* client to specify the cropping and scaling of the surface
|
||||
* contents.
|
||||
*
|
||||
* This interface works with two concepts: the source rectangle (src_x,
|
||||
* src_y, src_width, src_height), and the destination size (dst_width,
|
||||
* dst_height). The contents of the source rectangle are scaled to the
|
||||
* destination size, and content outside the source rectangle is ignored.
|
||||
* This state is double-buffered, and is applied on the next
|
||||
* wl_surface.commit.
|
||||
*
|
||||
* The two parts of crop and scale state are independent: the source
|
||||
* rectangle, and the destination size. Initially both are unset, that
|
||||
* is, no scaling is applied. The whole of the current wl_buffer is
|
||||
* used as the source, and the surface size is as defined in
|
||||
* wl_surface.attach.
|
||||
*
|
||||
* If the destination size is set, it causes the surface size to become
|
||||
* dst_width, dst_height. The source (rectangle) is scaled to exactly
|
||||
* this size. This overrides whatever the attached wl_buffer size is,
|
||||
* unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
|
||||
* has no content and therefore no size. Otherwise, the size is always
|
||||
* at least 1x1 in surface local coordinates.
|
||||
*
|
||||
* If the source rectangle is set, it defines what area of the wl_buffer is
|
||||
* taken as the source. If the source rectangle is set and the destination
|
||||
* size is not set, then src_width and src_height must be integers, and the
|
||||
* surface size becomes the source rectangle size. This results in cropping
|
||||
* without scaling. If src_width or src_height are not integers and
|
||||
* destination size is not set, the bad_size protocol error is raised when
|
||||
* the surface state is applied.
|
||||
*
|
||||
* The coordinate transformations from buffer pixel coordinates up to
|
||||
* the surface-local coordinates happen in the following order:
|
||||
* 1. buffer_transform (wl_surface.set_buffer_transform)
|
||||
* 2. buffer_scale (wl_surface.set_buffer_scale)
|
||||
* 3. crop and scale (wp_viewport.set*)
|
||||
* This means, that the source rectangle coordinates of crop and scale
|
||||
* are given in the coordinates after the buffer transform and scale,
|
||||
* i.e. in the coordinates that would be the surface-local coordinates
|
||||
* if the crop and scale was not applied.
|
||||
*
|
||||
* If src_x or src_y are negative, the bad_value protocol error is raised.
|
||||
* Otherwise, if the source rectangle is partially or completely outside of
|
||||
* the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
|
||||
* when the surface state is applied. A NULL wl_buffer does not raise the
|
||||
* out_of_buffer error.
|
||||
*
|
||||
* The x, y arguments of wl_surface.attach are applied as normal to
|
||||
* the surface. They indicate how many pixels to remove from the
|
||||
* surface size from the left and the top. In other words, they are
|
||||
* still in the surface-local coordinate system, just like dst_width
|
||||
* and dst_height are.
|
||||
*
|
||||
* If the wl_surface associated with the wp_viewport is destroyed,
|
||||
* all wp_viewport requests except 'destroy' raise the protocol error
|
||||
* no_surface.
|
||||
*
|
||||
* If the wp_viewport object is destroyed, the crop and scale
|
||||
* state is removed from the wl_surface. The change will be applied
|
||||
* on the next wl_surface.commit.
|
||||
* @section page_iface_wp_viewport_api API
|
||||
* See @ref iface_wp_viewport.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_wp_viewport The wp_viewport interface
|
||||
*
|
||||
* An additional interface to a wl_surface object, which allows the
|
||||
* client to specify the cropping and scaling of the surface
|
||||
* contents.
|
||||
*
|
||||
* This interface works with two concepts: the source rectangle (src_x,
|
||||
* src_y, src_width, src_height), and the destination size (dst_width,
|
||||
* dst_height). The contents of the source rectangle are scaled to the
|
||||
* destination size, and content outside the source rectangle is ignored.
|
||||
* This state is double-buffered, and is applied on the next
|
||||
* wl_surface.commit.
|
||||
*
|
||||
* The two parts of crop and scale state are independent: the source
|
||||
* rectangle, and the destination size. Initially both are unset, that
|
||||
* is, no scaling is applied. The whole of the current wl_buffer is
|
||||
* used as the source, and the surface size is as defined in
|
||||
* wl_surface.attach.
|
||||
*
|
||||
* If the destination size is set, it causes the surface size to become
|
||||
* dst_width, dst_height. The source (rectangle) is scaled to exactly
|
||||
* this size. This overrides whatever the attached wl_buffer size is,
|
||||
* unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
|
||||
* has no content and therefore no size. Otherwise, the size is always
|
||||
* at least 1x1 in surface local coordinates.
|
||||
*
|
||||
* If the source rectangle is set, it defines what area of the wl_buffer is
|
||||
* taken as the source. If the source rectangle is set and the destination
|
||||
* size is not set, then src_width and src_height must be integers, and the
|
||||
* surface size becomes the source rectangle size. This results in cropping
|
||||
* without scaling. If src_width or src_height are not integers and
|
||||
* destination size is not set, the bad_size protocol error is raised when
|
||||
* the surface state is applied.
|
||||
*
|
||||
* The coordinate transformations from buffer pixel coordinates up to
|
||||
* the surface-local coordinates happen in the following order:
|
||||
* 1. buffer_transform (wl_surface.set_buffer_transform)
|
||||
* 2. buffer_scale (wl_surface.set_buffer_scale)
|
||||
* 3. crop and scale (wp_viewport.set*)
|
||||
* This means, that the source rectangle coordinates of crop and scale
|
||||
* are given in the coordinates after the buffer transform and scale,
|
||||
* i.e. in the coordinates that would be the surface-local coordinates
|
||||
* if the crop and scale was not applied.
|
||||
*
|
||||
* If src_x or src_y are negative, the bad_value protocol error is raised.
|
||||
* Otherwise, if the source rectangle is partially or completely outside of
|
||||
* the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
|
||||
* when the surface state is applied. A NULL wl_buffer does not raise the
|
||||
* out_of_buffer error.
|
||||
*
|
||||
* The x, y arguments of wl_surface.attach are applied as normal to
|
||||
* the surface. They indicate how many pixels to remove from the
|
||||
* surface size from the left and the top. In other words, they are
|
||||
* still in the surface-local coordinate system, just like dst_width
|
||||
* and dst_height are.
|
||||
*
|
||||
* If the wl_surface associated with the wp_viewport is destroyed,
|
||||
* all wp_viewport requests except 'destroy' raise the protocol error
|
||||
* no_surface.
|
||||
*
|
||||
* If the wp_viewport object is destroyed, the crop and scale
|
||||
* state is removed from the wl_surface. The change will be applied
|
||||
* on the next wl_surface.commit.
|
||||
*/
|
||||
extern const struct wl_interface wp_viewport_interface;
|
||||
|
||||
#ifndef WP_VIEWPORTER_ERROR_ENUM
|
||||
#define WP_VIEWPORTER_ERROR_ENUM
|
||||
enum wp_viewporter_error {
|
||||
/**
|
||||
* the surface already has a viewport object associated
|
||||
*/
|
||||
WP_VIEWPORTER_ERROR_VIEWPORT_EXISTS = 0,
|
||||
};
|
||||
#endif /* WP_VIEWPORTER_ERROR_ENUM */
|
||||
|
||||
#define WP_VIEWPORTER_DESTROY 0
|
||||
#define WP_VIEWPORTER_GET_VIEWPORT 1
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_viewporter
|
||||
*/
|
||||
#define WP_VIEWPORTER_DESTROY_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_wp_viewporter
|
||||
*/
|
||||
#define WP_VIEWPORTER_GET_VIEWPORT_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_wp_viewporter */
|
||||
static inline void
|
||||
wp_viewporter_set_user_data(struct wp_viewporter *wp_viewporter, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) wp_viewporter, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_wp_viewporter */
|
||||
static inline void *
|
||||
wp_viewporter_get_user_data(struct wp_viewporter *wp_viewporter)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) wp_viewporter);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
wp_viewporter_get_version(struct wp_viewporter *wp_viewporter)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) wp_viewporter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_viewporter
|
||||
*
|
||||
* Informs the server that the client will not be using this
|
||||
* protocol object anymore. This does not affect any other objects,
|
||||
* wp_viewport objects included.
|
||||
*/
|
||||
static inline void
|
||||
wp_viewporter_destroy(struct wp_viewporter *wp_viewporter)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) wp_viewporter,
|
||||
WP_VIEWPORTER_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) wp_viewporter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_viewporter
|
||||
*
|
||||
* Instantiate an interface extension for the given wl_surface to
|
||||
* crop and scale its content. If the given wl_surface already has
|
||||
* a wp_viewport object associated, the viewport_exists
|
||||
* protocol error is raised.
|
||||
*/
|
||||
static inline struct wp_viewport *
|
||||
wp_viewporter_get_viewport(struct wp_viewporter *wp_viewporter, struct wl_surface *surface)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) wp_viewporter,
|
||||
WP_VIEWPORTER_GET_VIEWPORT, &wp_viewport_interface, NULL, surface);
|
||||
|
||||
return (struct wp_viewport *) id;
|
||||
}
|
||||
|
||||
#ifndef WP_VIEWPORT_ERROR_ENUM
|
||||
#define WP_VIEWPORT_ERROR_ENUM
|
||||
enum wp_viewport_error {
|
||||
/**
|
||||
* negative or zero values in width or height
|
||||
*/
|
||||
WP_VIEWPORT_ERROR_BAD_VALUE = 0,
|
||||
/**
|
||||
* destination size is not integer
|
||||
*/
|
||||
WP_VIEWPORT_ERROR_BAD_SIZE = 1,
|
||||
/**
|
||||
* source rectangle extends outside of the content area
|
||||
*/
|
||||
WP_VIEWPORT_ERROR_OUT_OF_BUFFER = 2,
|
||||
/**
|
||||
* the wl_surface was destroyed
|
||||
*/
|
||||
WP_VIEWPORT_ERROR_NO_SURFACE = 3,
|
||||
};
|
||||
#endif /* WP_VIEWPORT_ERROR_ENUM */
|
||||
|
||||
#define WP_VIEWPORT_DESTROY 0
|
||||
#define WP_VIEWPORT_SET_SOURCE 1
|
||||
#define WP_VIEWPORT_SET_DESTINATION 2
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_viewport
|
||||
*/
|
||||
#define WP_VIEWPORT_DESTROY_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_wp_viewport
|
||||
*/
|
||||
#define WP_VIEWPORT_SET_SOURCE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_wp_viewport
|
||||
*/
|
||||
#define WP_VIEWPORT_SET_DESTINATION_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_wp_viewport */
|
||||
static inline void
|
||||
wp_viewport_set_user_data(struct wp_viewport *wp_viewport, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) wp_viewport, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_wp_viewport */
|
||||
static inline void *
|
||||
wp_viewport_get_user_data(struct wp_viewport *wp_viewport)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) wp_viewport);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
wp_viewport_get_version(struct wp_viewport *wp_viewport)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) wp_viewport);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_viewport
|
||||
*
|
||||
* The associated wl_surface's crop and scale state is removed.
|
||||
* The change is applied on the next wl_surface.commit.
|
||||
*/
|
||||
static inline void
|
||||
wp_viewport_destroy(struct wp_viewport *wp_viewport)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) wp_viewport,
|
||||
WP_VIEWPORT_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) wp_viewport);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_viewport
|
||||
*
|
||||
* Set the source rectangle of the associated wl_surface. See
|
||||
* wp_viewport for the description, and relation to the wl_buffer
|
||||
* size.
|
||||
*
|
||||
* If all of x, y, width and height are -1.0, the source rectangle is
|
||||
* unset instead. Any other set of values where width or height are zero
|
||||
* or negative, or x or y are negative, raise the bad_value protocol
|
||||
* error.
|
||||
*
|
||||
* The crop and scale state is double-buffered state, and will be
|
||||
* applied on the next wl_surface.commit.
|
||||
*/
|
||||
static inline void
|
||||
wp_viewport_set_source(struct wp_viewport *wp_viewport, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) wp_viewport,
|
||||
WP_VIEWPORT_SET_SOURCE, x, y, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_wp_viewport
|
||||
*
|
||||
* Set the destination size of the associated wl_surface. See
|
||||
* wp_viewport for the description, and relation to the wl_buffer
|
||||
* size.
|
||||
*
|
||||
* If width is -1 and height is -1, the destination size is unset
|
||||
* instead. Any other pair of values for width and height that
|
||||
* contains zero or negative values raises the bad_value protocol
|
||||
* error.
|
||||
*
|
||||
* The crop and scale state is double-buffered state, and will be
|
||||
* applied on the next wl_surface.commit.
|
||||
*/
|
||||
static inline void
|
||||
wp_viewport_set_destination(struct wp_viewport *wp_viewport, int32_t width, int32_t height)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) wp_viewport,
|
||||
WP_VIEWPORT_SET_DESTINATION, width, height);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
65
raylib/external/glfw/src/wayland-xdg-decoration-client-protocol.c
vendored
Normal file
65
raylib/external/glfw/src/wayland-xdg-decoration-client-protocol.c
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2018 Simon Ser
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
|
||||
extern const struct wl_interface xdg_toplevel_interface;
|
||||
extern const struct wl_interface zxdg_toplevel_decoration_v1_interface;
|
||||
|
||||
static const struct wl_interface *xdg_decoration_unstable_v1_types[] = {
|
||||
NULL,
|
||||
&zxdg_toplevel_decoration_v1_interface,
|
||||
&xdg_toplevel_interface,
|
||||
};
|
||||
|
||||
static const struct wl_message zxdg_decoration_manager_v1_requests[] = {
|
||||
{ "destroy", "", xdg_decoration_unstable_v1_types + 0 },
|
||||
{ "get_toplevel_decoration", "no", xdg_decoration_unstable_v1_types + 1 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface zxdg_decoration_manager_v1_interface = {
|
||||
"zxdg_decoration_manager_v1", 1,
|
||||
2, zxdg_decoration_manager_v1_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message zxdg_toplevel_decoration_v1_requests[] = {
|
||||
{ "destroy", "", xdg_decoration_unstable_v1_types + 0 },
|
||||
{ "set_mode", "u", xdg_decoration_unstable_v1_types + 0 },
|
||||
{ "unset_mode", "", xdg_decoration_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message zxdg_toplevel_decoration_v1_events[] = {
|
||||
{ "configure", "u", xdg_decoration_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface zxdg_toplevel_decoration_v1_interface = {
|
||||
"zxdg_toplevel_decoration_v1", 1,
|
||||
3, zxdg_toplevel_decoration_v1_requests,
|
||||
1, zxdg_toplevel_decoration_v1_events,
|
||||
};
|
||||
|
376
raylib/external/glfw/src/wayland-xdg-decoration-client-protocol.h
vendored
Normal file
376
raylib/external/glfw/src/wayland-xdg-decoration-client-protocol.h
vendored
Normal file
|
@ -0,0 +1,376 @@
|
|||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
#ifndef XDG_DECORATION_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
#define XDG_DECORATION_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "wayland-client.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @page page_xdg_decoration_unstable_v1 The xdg_decoration_unstable_v1 protocol
|
||||
* @section page_ifaces_xdg_decoration_unstable_v1 Interfaces
|
||||
* - @subpage page_iface_zxdg_decoration_manager_v1 - window decoration manager
|
||||
* - @subpage page_iface_zxdg_toplevel_decoration_v1 - decoration object for a toplevel surface
|
||||
* @section page_copyright_xdg_decoration_unstable_v1 Copyright
|
||||
* <pre>
|
||||
*
|
||||
* Copyright © 2018 Simon Ser
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* </pre>
|
||||
*/
|
||||
struct xdg_toplevel;
|
||||
struct zxdg_decoration_manager_v1;
|
||||
struct zxdg_toplevel_decoration_v1;
|
||||
|
||||
/**
|
||||
* @page page_iface_zxdg_decoration_manager_v1 zxdg_decoration_manager_v1
|
||||
* @section page_iface_zxdg_decoration_manager_v1_desc Description
|
||||
*
|
||||
* This interface allows a compositor to announce support for server-side
|
||||
* decorations.
|
||||
*
|
||||
* A window decoration is a set of window controls as deemed appropriate by
|
||||
* the party managing them, such as user interface components used to move,
|
||||
* resize and change a window's state.
|
||||
*
|
||||
* A client can use this protocol to request being decorated by a supporting
|
||||
* compositor.
|
||||
*
|
||||
* If compositor and client do not negotiate the use of a server-side
|
||||
* decoration using this protocol, clients continue to self-decorate as they
|
||||
* see fit.
|
||||
*
|
||||
* Warning! The protocol described in this file is experimental and
|
||||
* backward incompatible changes may be made. Backward compatible changes
|
||||
* may be added together with the corresponding interface version bump.
|
||||
* Backward incompatible changes are done by bumping the version number in
|
||||
* the protocol and interface names and resetting the interface version.
|
||||
* Once the protocol is to be declared stable, the 'z' prefix and the
|
||||
* version number in the protocol and interface names are removed and the
|
||||
* interface version number is reset.
|
||||
* @section page_iface_zxdg_decoration_manager_v1_api API
|
||||
* See @ref iface_zxdg_decoration_manager_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_zxdg_decoration_manager_v1 The zxdg_decoration_manager_v1 interface
|
||||
*
|
||||
* This interface allows a compositor to announce support for server-side
|
||||
* decorations.
|
||||
*
|
||||
* A window decoration is a set of window controls as deemed appropriate by
|
||||
* the party managing them, such as user interface components used to move,
|
||||
* resize and change a window's state.
|
||||
*
|
||||
* A client can use this protocol to request being decorated by a supporting
|
||||
* compositor.
|
||||
*
|
||||
* If compositor and client do not negotiate the use of a server-side
|
||||
* decoration using this protocol, clients continue to self-decorate as they
|
||||
* see fit.
|
||||
*
|
||||
* Warning! The protocol described in this file is experimental and
|
||||
* backward incompatible changes may be made. Backward compatible changes
|
||||
* may be added together with the corresponding interface version bump.
|
||||
* Backward incompatible changes are done by bumping the version number in
|
||||
* the protocol and interface names and resetting the interface version.
|
||||
* Once the protocol is to be declared stable, the 'z' prefix and the
|
||||
* version number in the protocol and interface names are removed and the
|
||||
* interface version number is reset.
|
||||
*/
|
||||
extern const struct wl_interface zxdg_decoration_manager_v1_interface;
|
||||
/**
|
||||
* @page page_iface_zxdg_toplevel_decoration_v1 zxdg_toplevel_decoration_v1
|
||||
* @section page_iface_zxdg_toplevel_decoration_v1_desc Description
|
||||
*
|
||||
* The decoration object allows the compositor to toggle server-side window
|
||||
* decorations for a toplevel surface. The client can request to switch to
|
||||
* another mode.
|
||||
*
|
||||
* The xdg_toplevel_decoration object must be destroyed before its
|
||||
* xdg_toplevel.
|
||||
* @section page_iface_zxdg_toplevel_decoration_v1_api API
|
||||
* See @ref iface_zxdg_toplevel_decoration_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_zxdg_toplevel_decoration_v1 The zxdg_toplevel_decoration_v1 interface
|
||||
*
|
||||
* The decoration object allows the compositor to toggle server-side window
|
||||
* decorations for a toplevel surface. The client can request to switch to
|
||||
* another mode.
|
||||
*
|
||||
* The xdg_toplevel_decoration object must be destroyed before its
|
||||
* xdg_toplevel.
|
||||
*/
|
||||
extern const struct wl_interface zxdg_toplevel_decoration_v1_interface;
|
||||
|
||||
#define ZXDG_DECORATION_MANAGER_V1_DESTROY 0
|
||||
#define ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION 1
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup iface_zxdg_decoration_manager_v1
|
||||
*/
|
||||
#define ZXDG_DECORATION_MANAGER_V1_DESTROY_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zxdg_decoration_manager_v1
|
||||
*/
|
||||
#define ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_zxdg_decoration_manager_v1 */
|
||||
static inline void
|
||||
zxdg_decoration_manager_v1_set_user_data(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) zxdg_decoration_manager_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_zxdg_decoration_manager_v1 */
|
||||
static inline void *
|
||||
zxdg_decoration_manager_v1_get_user_data(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) zxdg_decoration_manager_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
zxdg_decoration_manager_v1_get_version(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) zxdg_decoration_manager_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zxdg_decoration_manager_v1
|
||||
*
|
||||
* Destroy the decoration manager. This doesn't destroy objects created
|
||||
* with the manager.
|
||||
*/
|
||||
static inline void
|
||||
zxdg_decoration_manager_v1_destroy(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zxdg_decoration_manager_v1,
|
||||
ZXDG_DECORATION_MANAGER_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zxdg_decoration_manager_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zxdg_decoration_manager_v1
|
||||
*
|
||||
* Create a new decoration object associated with the given toplevel.
|
||||
*
|
||||
* Creating an xdg_toplevel_decoration from an xdg_toplevel which has a
|
||||
* buffer attached or committed is a client error, and any attempts by a
|
||||
* client to attach or manipulate a buffer prior to the first
|
||||
* xdg_toplevel_decoration.configure event must also be treated as
|
||||
* errors.
|
||||
*/
|
||||
static inline struct zxdg_toplevel_decoration_v1 *
|
||||
zxdg_decoration_manager_v1_get_toplevel_decoration(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1, struct xdg_toplevel *toplevel)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) zxdg_decoration_manager_v1,
|
||||
ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION, &zxdg_toplevel_decoration_v1_interface, NULL, toplevel);
|
||||
|
||||
return (struct zxdg_toplevel_decoration_v1 *) id;
|
||||
}
|
||||
|
||||
#ifndef ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ENUM
|
||||
#define ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ENUM
|
||||
enum zxdg_toplevel_decoration_v1_error {
|
||||
/**
|
||||
* xdg_toplevel has a buffer attached before configure
|
||||
*/
|
||||
ZXDG_TOPLEVEL_DECORATION_V1_ERROR_UNCONFIGURED_BUFFER = 0,
|
||||
/**
|
||||
* xdg_toplevel already has a decoration object
|
||||
*/
|
||||
ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ALREADY_CONSTRUCTED = 1,
|
||||
/**
|
||||
* xdg_toplevel destroyed before the decoration object
|
||||
*/
|
||||
ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ORPHANED = 2,
|
||||
};
|
||||
#endif /* ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ENUM */
|
||||
|
||||
#ifndef ZXDG_TOPLEVEL_DECORATION_V1_MODE_ENUM
|
||||
#define ZXDG_TOPLEVEL_DECORATION_V1_MODE_ENUM
|
||||
/**
|
||||
* @ingroup iface_zxdg_toplevel_decoration_v1
|
||||
* window decoration modes
|
||||
*
|
||||
* These values describe window decoration modes.
|
||||
*/
|
||||
enum zxdg_toplevel_decoration_v1_mode {
|
||||
/**
|
||||
* no server-side window decoration
|
||||
*/
|
||||
ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE = 1,
|
||||
/**
|
||||
* server-side window decoration
|
||||
*/
|
||||
ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE = 2,
|
||||
};
|
||||
#endif /* ZXDG_TOPLEVEL_DECORATION_V1_MODE_ENUM */
|
||||
|
||||
/**
|
||||
* @ingroup iface_zxdg_toplevel_decoration_v1
|
||||
* @struct zxdg_toplevel_decoration_v1_listener
|
||||
*/
|
||||
struct zxdg_toplevel_decoration_v1_listener {
|
||||
/**
|
||||
* suggest a surface change
|
||||
*
|
||||
* The configure event asks the client to change its decoration
|
||||
* mode. The configured state should not be applied immediately.
|
||||
* Clients must send an ack_configure in response to this event.
|
||||
* See xdg_surface.configure and xdg_surface.ack_configure for
|
||||
* details.
|
||||
*
|
||||
* A configure event can be sent at any time. The specified mode
|
||||
* must be obeyed by the client.
|
||||
* @param mode the decoration mode
|
||||
*/
|
||||
void (*configure)(void *data,
|
||||
struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1,
|
||||
uint32_t mode);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup iface_zxdg_toplevel_decoration_v1
|
||||
*/
|
||||
static inline int
|
||||
zxdg_toplevel_decoration_v1_add_listener(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1,
|
||||
const struct zxdg_toplevel_decoration_v1_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) zxdg_toplevel_decoration_v1,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define ZXDG_TOPLEVEL_DECORATION_V1_DESTROY 0
|
||||
#define ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE 1
|
||||
#define ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE 2
|
||||
|
||||
/**
|
||||
* @ingroup iface_zxdg_toplevel_decoration_v1
|
||||
*/
|
||||
#define ZXDG_TOPLEVEL_DECORATION_V1_CONFIGURE_SINCE_VERSION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_zxdg_toplevel_decoration_v1
|
||||
*/
|
||||
#define ZXDG_TOPLEVEL_DECORATION_V1_DESTROY_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zxdg_toplevel_decoration_v1
|
||||
*/
|
||||
#define ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zxdg_toplevel_decoration_v1
|
||||
*/
|
||||
#define ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_zxdg_toplevel_decoration_v1 */
|
||||
static inline void
|
||||
zxdg_toplevel_decoration_v1_set_user_data(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) zxdg_toplevel_decoration_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_zxdg_toplevel_decoration_v1 */
|
||||
static inline void *
|
||||
zxdg_toplevel_decoration_v1_get_user_data(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) zxdg_toplevel_decoration_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
zxdg_toplevel_decoration_v1_get_version(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_decoration_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zxdg_toplevel_decoration_v1
|
||||
*
|
||||
* Switch back to a mode without any server-side decorations at the next
|
||||
* commit.
|
||||
*/
|
||||
static inline void
|
||||
zxdg_toplevel_decoration_v1_destroy(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zxdg_toplevel_decoration_v1,
|
||||
ZXDG_TOPLEVEL_DECORATION_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zxdg_toplevel_decoration_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zxdg_toplevel_decoration_v1
|
||||
*
|
||||
* Set the toplevel surface decoration mode. This informs the compositor
|
||||
* that the client prefers the provided decoration mode.
|
||||
*
|
||||
* After requesting a decoration mode, the compositor will respond by
|
||||
* emitting a xdg_surface.configure event. The client should then update
|
||||
* its content, drawing it without decorations if the received mode is
|
||||
* server-side decorations. The client must also acknowledge the configure
|
||||
* when committing the new content (see xdg_surface.ack_configure).
|
||||
*
|
||||
* The compositor can decide not to use the client's mode and enforce a
|
||||
* different mode instead.
|
||||
*
|
||||
* Clients whose decoration mode depend on the xdg_toplevel state may send
|
||||
* a set_mode request in response to a xdg_surface.configure event and wait
|
||||
* for the next xdg_surface.configure event to prevent unwanted state.
|
||||
* Such clients are responsible for preventing configure loops and must
|
||||
* make sure not to send multiple successive set_mode requests with the
|
||||
* same decoration mode.
|
||||
*/
|
||||
static inline void
|
||||
zxdg_toplevel_decoration_v1_set_mode(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, uint32_t mode)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zxdg_toplevel_decoration_v1,
|
||||
ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE, mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zxdg_toplevel_decoration_v1
|
||||
*
|
||||
* Unset the toplevel surface decoration mode. This informs the compositor
|
||||
* that the client doesn't prefer a particular decoration mode.
|
||||
*
|
||||
* This request has the same semantics as set_mode.
|
||||
*/
|
||||
static inline void
|
||||
zxdg_toplevel_decoration_v1_unset_mode(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zxdg_toplevel_decoration_v1,
|
||||
ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
171
raylib/external/glfw/src/wayland-xdg-shell-client-protocol.c
vendored
Normal file
171
raylib/external/glfw/src/wayland-xdg-shell-client-protocol.c
vendored
Normal file
|
@ -0,0 +1,171 @@
|
|||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2008-2013 Kristian Høgsberg
|
||||
* Copyright © 2013 Rafael Antognolli
|
||||
* Copyright © 2013 Jasper St. Pierre
|
||||
* Copyright © 2010-2013 Intel Corporation
|
||||
* Copyright © 2015-2017 Samsung Electronics Co., Ltd
|
||||
* Copyright © 2015-2017 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
|
||||
extern const struct wl_interface wl_output_interface;
|
||||
extern const struct wl_interface wl_seat_interface;
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
extern const struct wl_interface xdg_popup_interface;
|
||||
extern const struct wl_interface xdg_positioner_interface;
|
||||
extern const struct wl_interface xdg_surface_interface;
|
||||
extern const struct wl_interface xdg_toplevel_interface;
|
||||
|
||||
static const struct wl_interface *xdg_shell_wl_xs_types[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&xdg_positioner_interface,
|
||||
&xdg_surface_interface,
|
||||
&wl_surface_interface,
|
||||
&xdg_toplevel_interface,
|
||||
&xdg_popup_interface,
|
||||
&xdg_surface_interface,
|
||||
&xdg_positioner_interface,
|
||||
&xdg_toplevel_interface,
|
||||
&wl_seat_interface,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&wl_seat_interface,
|
||||
NULL,
|
||||
&wl_seat_interface,
|
||||
NULL,
|
||||
NULL,
|
||||
&wl_output_interface,
|
||||
&wl_seat_interface,
|
||||
NULL,
|
||||
&xdg_positioner_interface,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_wm_base_requests[] = {
|
||||
{ "destroy", "", xdg_shell_wl_xs_types + 0 },
|
||||
{ "create_positioner", "n", xdg_shell_wl_xs_types + 4 },
|
||||
{ "get_xdg_surface", "no", xdg_shell_wl_xs_types + 5 },
|
||||
{ "pong", "u", xdg_shell_wl_xs_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_wm_base_events[] = {
|
||||
{ "ping", "u", xdg_shell_wl_xs_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_wm_base_interface = {
|
||||
"xdg_wm_base", 3,
|
||||
4, xdg_wm_base_requests,
|
||||
1, xdg_wm_base_events,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_positioner_requests[] = {
|
||||
{ "destroy", "", xdg_shell_wl_xs_types + 0 },
|
||||
{ "set_size", "ii", xdg_shell_wl_xs_types + 0 },
|
||||
{ "set_anchor_rect", "iiii", xdg_shell_wl_xs_types + 0 },
|
||||
{ "set_anchor", "u", xdg_shell_wl_xs_types + 0 },
|
||||
{ "set_gravity", "u", xdg_shell_wl_xs_types + 0 },
|
||||
{ "set_constraint_adjustment", "u", xdg_shell_wl_xs_types + 0 },
|
||||
{ "set_offset", "ii", xdg_shell_wl_xs_types + 0 },
|
||||
{ "set_reactive", "3", xdg_shell_wl_xs_types + 0 },
|
||||
{ "set_parent_size", "3ii", xdg_shell_wl_xs_types + 0 },
|
||||
{ "set_parent_configure", "3u", xdg_shell_wl_xs_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_positioner_interface = {
|
||||
"xdg_positioner", 3,
|
||||
10, xdg_positioner_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_surface_requests[] = {
|
||||
{ "destroy", "", xdg_shell_wl_xs_types + 0 },
|
||||
{ "get_toplevel", "n", xdg_shell_wl_xs_types + 7 },
|
||||
{ "get_popup", "n?oo", xdg_shell_wl_xs_types + 8 },
|
||||
{ "set_window_geometry", "iiii", xdg_shell_wl_xs_types + 0 },
|
||||
{ "ack_configure", "u", xdg_shell_wl_xs_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_surface_events[] = {
|
||||
{ "configure", "u", xdg_shell_wl_xs_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_surface_interface = {
|
||||
"xdg_surface", 3,
|
||||
5, xdg_surface_requests,
|
||||
1, xdg_surface_events,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_toplevel_requests[] = {
|
||||
{ "destroy", "", xdg_shell_wl_xs_types + 0 },
|
||||
{ "set_parent", "?o", xdg_shell_wl_xs_types + 11 },
|
||||
{ "set_title", "s", xdg_shell_wl_xs_types + 0 },
|
||||
{ "set_app_id", "s", xdg_shell_wl_xs_types + 0 },
|
||||
{ "show_window_menu", "ouii", xdg_shell_wl_xs_types + 12 },
|
||||
{ "move", "ou", xdg_shell_wl_xs_types + 16 },
|
||||
{ "resize", "ouu", xdg_shell_wl_xs_types + 18 },
|
||||
{ "set_max_size", "ii", xdg_shell_wl_xs_types + 0 },
|
||||
{ "set_min_size", "ii", xdg_shell_wl_xs_types + 0 },
|
||||
{ "set_maximized", "", xdg_shell_wl_xs_types + 0 },
|
||||
{ "unset_maximized", "", xdg_shell_wl_xs_types + 0 },
|
||||
{ "set_fullscreen", "?o", xdg_shell_wl_xs_types + 21 },
|
||||
{ "unset_fullscreen", "", xdg_shell_wl_xs_types + 0 },
|
||||
{ "set_minimized", "", xdg_shell_wl_xs_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_toplevel_events[] = {
|
||||
{ "configure", "iia", xdg_shell_wl_xs_types + 0 },
|
||||
{ "close", "", xdg_shell_wl_xs_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_toplevel_interface = {
|
||||
"xdg_toplevel", 3,
|
||||
14, xdg_toplevel_requests,
|
||||
2, xdg_toplevel_events,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_popup_requests[] = {
|
||||
{ "destroy", "", xdg_shell_wl_xs_types + 0 },
|
||||
{ "grab", "ou", xdg_shell_wl_xs_types + 22 },
|
||||
{ "reposition", "3ou", xdg_shell_wl_xs_types + 24 },
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_popup_events[] = {
|
||||
{ "configure", "iiii", xdg_shell_wl_xs_types + 0 },
|
||||
{ "popup_done", "", xdg_shell_wl_xs_types + 0 },
|
||||
{ "repositioned", "3u", xdg_shell_wl_xs_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_popup_interface = {
|
||||
"xdg_popup", 3,
|
||||
3, xdg_popup_requests,
|
||||
3, xdg_popup_events,
|
||||
};
|
||||
|
1970
raylib/external/glfw/src/wayland-xdg-shell-client-protocol.h
vendored
Normal file
1970
raylib/external/glfw/src/wayland-xdg-shell-client-protocol.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
27
raylib/external/glfw/src/wgl_context.c
vendored
27
raylib/external/glfw/src/wgl_context.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 WGL - www.glfw.org
|
||||
// GLFW 3.4 WGL - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -75,8 +77,8 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||
{
|
||||
const int attrib = WGL_NUMBER_PIXEL_FORMATS_ARB;
|
||||
|
||||
if (!_glfw.wgl.GetPixelFormatAttribivARB(window->context.wgl.dc,
|
||||
1, 0, 1, &attrib, &nativeCount))
|
||||
if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc,
|
||||
1, 0, 1, &attrib, &nativeCount))
|
||||
{
|
||||
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||
"WGL: Failed to retrieve pixel format attribute");
|
||||
|
@ -139,10 +141,10 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||
{
|
||||
// Get pixel format attributes through "modern" extension
|
||||
|
||||
if (!_glfw.wgl.GetPixelFormatAttribivARB(window->context.wgl.dc,
|
||||
pixelFormat, 0,
|
||||
attribCount,
|
||||
attribs, values))
|
||||
if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc,
|
||||
pixelFormat, 0,
|
||||
attribCount,
|
||||
attribs, values))
|
||||
{
|
||||
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||
"WGL: Failed to retrieve pixel format attributes");
|
||||
|
@ -360,7 +362,7 @@ static void swapIntervalWGL(int interval)
|
|||
}
|
||||
|
||||
if (_glfw.wgl.EXT_swap_control)
|
||||
_glfw.wgl.SwapIntervalEXT(interval);
|
||||
wglSwapIntervalEXT(interval);
|
||||
}
|
||||
|
||||
static int extensionSupportedWGL(const char* extension)
|
||||
|
@ -368,9 +370,9 @@ static int extensionSupportedWGL(const char* extension)
|
|||
const char* extensions = NULL;
|
||||
|
||||
if (_glfw.wgl.GetExtensionsStringARB)
|
||||
extensions = _glfw.wgl.GetExtensionsStringARB(wglGetCurrentDC());
|
||||
extensions = wglGetExtensionsStringARB(wglGetCurrentDC());
|
||||
else if (_glfw.wgl.GetExtensionsStringEXT)
|
||||
extensions = _glfw.wgl.GetExtensionsStringEXT();
|
||||
extensions = wglGetExtensionsStringEXT();
|
||||
|
||||
if (!extensions)
|
||||
return GLFW_FALSE;
|
||||
|
@ -387,8 +389,6 @@ static GLFWglproc getProcAddressWGL(const char* procname)
|
|||
return (GLFWglproc) GetProcAddress(_glfw.wgl.instance, procname);
|
||||
}
|
||||
|
||||
// Destroy the OpenGL context
|
||||
//
|
||||
static void destroyContextWGL(_GLFWwindow* window)
|
||||
{
|
||||
if (window->context.wgl.handle)
|
||||
|
@ -693,8 +693,7 @@ GLFWbool _glfwCreateContextWGL(_GLFWwindow* window,
|
|||
setAttrib(0, 0);
|
||||
|
||||
window->context.wgl.handle =
|
||||
_glfw.wgl.CreateContextAttribsARB(window->context.wgl.dc,
|
||||
share, attribs);
|
||||
wglCreateContextAttribsARB(window->context.wgl.dc, share, attribs);
|
||||
if (!window->context.wgl.handle)
|
||||
{
|
||||
const DWORD error = GetLastError();
|
||||
|
|
11
raylib/external/glfw/src/wgl_context.h
vendored
11
raylib/external/glfw/src/wgl_context.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 WGL - www.glfw.org
|
||||
// GLFW 3.4 WGL - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -76,12 +76,19 @@
|
|||
#define ERROR_INVALID_PROFILE_ARB 0x2096
|
||||
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
|
||||
|
||||
// WGL extension pointer typedefs
|
||||
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC)(int);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC)(HDC,int,int,UINT,const int*,int*);
|
||||
typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void);
|
||||
typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC,HGLRC,const int*);
|
||||
#define wglSwapIntervalEXT _glfw.wgl.SwapIntervalEXT
|
||||
#define wglGetPixelFormatAttribivARB _glfw.wgl.GetPixelFormatAttribivARB
|
||||
#define wglGetExtensionsStringEXT _glfw.wgl.GetExtensionsStringEXT
|
||||
#define wglGetExtensionsStringARB _glfw.wgl.GetExtensionsStringARB
|
||||
#define wglCreateContextAttribsARB _glfw.wgl.CreateContextAttribsARB
|
||||
|
||||
// opengl32.dll function pointer typedefs
|
||||
typedef HGLRC (WINAPI * PFN_wglCreateContext)(HDC);
|
||||
typedef BOOL (WINAPI * PFN_wglDeleteContext)(HGLRC);
|
||||
typedef PROC (WINAPI * PFN_wglGetProcAddress)(LPCSTR);
|
||||
|
@ -89,8 +96,6 @@ typedef HDC (WINAPI * PFN_wglGetCurrentDC)(void);
|
|||
typedef HGLRC (WINAPI * PFN_wglGetCurrentContext)(void);
|
||||
typedef BOOL (WINAPI * PFN_wglMakeCurrent)(HDC,HGLRC);
|
||||
typedef BOOL (WINAPI * PFN_wglShareLists)(HGLRC,HGLRC);
|
||||
|
||||
// opengl32.dll function pointer typedefs
|
||||
#define wglCreateContext _glfw.wgl.CreateContext
|
||||
#define wglDeleteContext _glfw.wgl.DeleteContext
|
||||
#define wglGetProcAddress _glfw.wgl.GetProcAddress
|
||||
|
|
8
raylib/external/glfw/src/win32_init.c
vendored
8
raylib/external/glfw/src/win32_init.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Win32 - www.glfw.org
|
||||
// GLFW 3.4 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -523,7 +525,7 @@ BOOL _glfwIsWindowsVersionOrGreaterWin32(WORD major, WORD minor, WORD sp)
|
|||
cond = VerSetConditionMask(cond, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||
cond = VerSetConditionMask(cond, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
|
||||
// HACK: Use RtlVerifyVersionInfo instead of VerifyVersionInfoW as the
|
||||
// latter lies unless the user knew to embedd a non-default manifest
|
||||
// latter lies unless the user knew to embed a non-default manifest
|
||||
// announcing support for Windows 10 via supportedOS GUID
|
||||
return RtlVerifyVersionInfo(&osvi, mask, cond) == 0;
|
||||
}
|
||||
|
@ -538,7 +540,7 @@ BOOL _glfwIsWindows10BuildOrGreaterWin32(WORD build)
|
|||
cond = VerSetConditionMask(cond, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||
cond = VerSetConditionMask(cond, VER_BUILDNUMBER, VER_GREATER_EQUAL);
|
||||
// HACK: Use RtlVerifyVersionInfo instead of VerifyVersionInfoW as the
|
||||
// latter lies unless the user knew to embedd a non-default manifest
|
||||
// latter lies unless the user knew to embed a non-default manifest
|
||||
// announcing support for Windows 10 via supportedOS GUID
|
||||
return RtlVerifyVersionInfo(&osvi, mask, cond) == 0;
|
||||
}
|
||||
|
|
4
raylib/external/glfw/src/win32_joystick.c
vendored
4
raylib/external/glfw/src/win32_joystick.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Win32 - www.glfw.org
|
||||
// GLFW 3.4 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
4
raylib/external/glfw/src/win32_joystick.h
vendored
4
raylib/external/glfw/src/win32_joystick.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Win32 - www.glfw.org
|
||||
// GLFW 3.4 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
//
|
||||
|
@ -25,7 +25,7 @@
|
|||
//========================================================================
|
||||
|
||||
#define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickWin32 win32
|
||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE int dummy
|
||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; }
|
||||
|
||||
#define _GLFW_PLATFORM_MAPPING_NAME "Windows"
|
||||
|
||||
|
|
21
raylib/external/glfw/src/win32_monitor.c
vendored
21
raylib/external/glfw/src/win32_monitor.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Win32 - www.glfw.org
|
||||
// GLFW 3.4 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -31,6 +33,7 @@
|
|||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <malloc.h>
|
||||
#include <wchar.h>
|
||||
|
||||
|
||||
// Callback for EnumDisplayMonitors in createMonitor
|
||||
|
@ -475,7 +478,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
|||
GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||
{
|
||||
HDC dc;
|
||||
WORD values[768];
|
||||
WORD values[3][256];
|
||||
|
||||
dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL);
|
||||
GetDeviceGammaRamp(dc, values);
|
||||
|
@ -483,9 +486,9 @@ GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
|||
|
||||
_glfwAllocGammaArrays(ramp, 256);
|
||||
|
||||
memcpy(ramp->red, values + 0, 256 * sizeof(unsigned short));
|
||||
memcpy(ramp->green, values + 256, 256 * sizeof(unsigned short));
|
||||
memcpy(ramp->blue, values + 512, 256 * sizeof(unsigned short));
|
||||
memcpy(ramp->red, values[0], sizeof(values[0]));
|
||||
memcpy(ramp->green, values[1], sizeof(values[1]));
|
||||
memcpy(ramp->blue, values[2], sizeof(values[2]));
|
||||
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
@ -493,7 +496,7 @@ GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
|||
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||
{
|
||||
HDC dc;
|
||||
WORD values[768];
|
||||
WORD values[3][256];
|
||||
|
||||
if (ramp->size != 256)
|
||||
{
|
||||
|
@ -502,9 +505,9 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
|||
return;
|
||||
}
|
||||
|
||||
memcpy(values + 0, ramp->red, 256 * sizeof(unsigned short));
|
||||
memcpy(values + 256, ramp->green, 256 * sizeof(unsigned short));
|
||||
memcpy(values + 512, ramp->blue, 256 * sizeof(unsigned short));
|
||||
memcpy(values[0], ramp->red, sizeof(values[0]));
|
||||
memcpy(values[1], ramp->green, sizeof(values[1]));
|
||||
memcpy(values[2], ramp->blue, sizeof(values[2]));
|
||||
|
||||
dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL);
|
||||
SetDeviceGammaRamp(dc, values);
|
||||
|
|
5
raylib/external/glfw/src/win32_platform.h
vendored
5
raylib/external/glfw/src/win32_platform.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Win32 - www.glfw.org
|
||||
// GLFW 3.4 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -212,7 +212,7 @@ typedef enum
|
|||
|
||||
// HACK: Define macros that some dinput.h variants don't
|
||||
#ifndef DIDFT_OPTIONAL
|
||||
#define DIDFT_OPTIONAL 0x80000000
|
||||
#define DIDFT_OPTIONAL 0x80000000
|
||||
#endif
|
||||
|
||||
// winmm.dll function pointer typedefs
|
||||
|
@ -315,6 +315,7 @@ typedef struct _GLFWwindowWin32
|
|||
// Whether to enable framebuffer transparency on DWM
|
||||
GLFWbool transparent;
|
||||
GLFWbool scaleToMonitor;
|
||||
GLFWbool keymenu;
|
||||
|
||||
// The last received cursor position, regardless of source
|
||||
int lastCursorPosX, lastCursorPosY;
|
||||
|
|
4
raylib/external/glfw/src/win32_thread.c
vendored
4
raylib/external/glfw/src/win32_thread.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Win32 - www.glfw.org
|
||||
// GLFW 3.4 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
4
raylib/external/glfw/src/win32_time.c
vendored
4
raylib/external/glfw/src/win32_time.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Win32 - www.glfw.org
|
||||
// GLFW 3.4 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
274
raylib/external/glfw/src/win32_window.c
vendored
274
raylib/external/glfw/src/win32_window.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Win32 - www.glfw.org
|
||||
// GLFW 3.4 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -34,8 +36,6 @@
|
|||
#include <windowsx.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
#define _GLFW_KEY_INVALID -2
|
||||
|
||||
// Returns the window style for the specified window
|
||||
//
|
||||
static DWORD getWindowStyle(const _GLFWwindow* window)
|
||||
|
@ -409,7 +409,7 @@ static void updateFramebufferTransparency(const _GLFWwindow* window)
|
|||
// issue. When set to black, something is making the hit test
|
||||
// not resize with the window frame.
|
||||
SetLayeredWindowAttributes(window->win32.handle,
|
||||
RGB(0, 193, 48), 255, LWA_COLORKEY);
|
||||
RGB(255, 0, 255), 255, LWA_COLORKEY);
|
||||
}
|
||||
|
||||
DeleteObject(region);
|
||||
|
@ -446,77 +446,6 @@ static int getKeyMods(void)
|
|||
return mods;
|
||||
}
|
||||
|
||||
// Retrieves and translates modifier keys
|
||||
//
|
||||
static int getAsyncKeyMods(void)
|
||||
{
|
||||
int mods = 0;
|
||||
|
||||
if (GetAsyncKeyState(VK_SHIFT) & 0x8000)
|
||||
mods |= GLFW_MOD_SHIFT;
|
||||
if (GetAsyncKeyState(VK_CONTROL) & 0x8000)
|
||||
mods |= GLFW_MOD_CONTROL;
|
||||
if (GetAsyncKeyState(VK_MENU) & 0x8000)
|
||||
mods |= GLFW_MOD_ALT;
|
||||
if ((GetAsyncKeyState(VK_LWIN) | GetAsyncKeyState(VK_RWIN)) & 0x8000)
|
||||
mods |= GLFW_MOD_SUPER;
|
||||
if (GetAsyncKeyState(VK_CAPITAL) & 1)
|
||||
mods |= GLFW_MOD_CAPS_LOCK;
|
||||
if (GetAsyncKeyState(VK_NUMLOCK) & 1)
|
||||
mods |= GLFW_MOD_NUM_LOCK;
|
||||
|
||||
return mods;
|
||||
}
|
||||
|
||||
// Translates a Windows key to the corresponding GLFW key
|
||||
//
|
||||
static int translateKey(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// The Ctrl keys require special handling
|
||||
if (wParam == VK_CONTROL)
|
||||
{
|
||||
MSG next;
|
||||
DWORD time;
|
||||
|
||||
// Right side keys have the extended key bit set
|
||||
if (lParam & 0x01000000)
|
||||
return GLFW_KEY_RIGHT_CONTROL;
|
||||
|
||||
// HACK: Alt Gr sends Left Ctrl and then Right Alt in close sequence
|
||||
// We only want the Right Alt message, so if the next message is
|
||||
// Right Alt we ignore this (synthetic) Left Ctrl message
|
||||
time = GetMessageTime();
|
||||
|
||||
if (PeekMessageW(&next, NULL, 0, 0, PM_NOREMOVE))
|
||||
{
|
||||
if (next.message == WM_KEYDOWN ||
|
||||
next.message == WM_SYSKEYDOWN ||
|
||||
next.message == WM_KEYUP ||
|
||||
next.message == WM_SYSKEYUP)
|
||||
{
|
||||
if (next.wParam == VK_MENU &&
|
||||
(next.lParam & 0x01000000) &&
|
||||
next.time == time)
|
||||
{
|
||||
// Next message is Right Alt down so discard this
|
||||
return _GLFW_KEY_INVALID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return GLFW_KEY_LEFT_CONTROL;
|
||||
}
|
||||
|
||||
if (wParam == VK_PROCESSKEY)
|
||||
{
|
||||
// IME notifies that keys have been filtered by setting the virtual
|
||||
// key-code to VK_PROCESSKEY
|
||||
return _GLFW_KEY_INVALID;
|
||||
}
|
||||
|
||||
return _glfw.win32.keycodes[HIWORD(lParam) & 0x1FF];
|
||||
}
|
||||
|
||||
static void fitToMonitor(_GLFWwindow* window)
|
||||
{
|
||||
MONITORINFO mi = { sizeof(mi) };
|
||||
|
@ -629,12 +558,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
// clicking a caption button
|
||||
if (HIWORD(lParam) == WM_LBUTTONDOWN)
|
||||
{
|
||||
if (LOWORD(lParam) == HTCLOSE ||
|
||||
LOWORD(lParam) == HTMINBUTTON ||
|
||||
LOWORD(lParam) == HTMAXBUTTON)
|
||||
{
|
||||
if (LOWORD(lParam) != HTCLIENT)
|
||||
window->win32.frameAction = GLFW_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -701,7 +626,12 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
|
||||
// User trying to access application menu using ALT?
|
||||
case SC_KEYMENU:
|
||||
return 0;
|
||||
{
|
||||
if (!window->win32.keymenu)
|
||||
return 0;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -733,6 +663,10 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
}
|
||||
|
||||
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), plain);
|
||||
|
||||
if (uMsg == WM_SYSCHAR && window->win32.keymenu)
|
||||
break;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -741,13 +675,64 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
{
|
||||
const int key = translateKey(wParam, lParam);
|
||||
const int scancode = (lParam >> 16) & 0x1ff;
|
||||
const int action = ((lParam >> 31) & 1) ? GLFW_RELEASE : GLFW_PRESS;
|
||||
int key, scancode;
|
||||
const int action = (HIWORD(lParam) & KF_UP) ? GLFW_RELEASE : GLFW_PRESS;
|
||||
const int mods = getKeyMods();
|
||||
|
||||
if (key == _GLFW_KEY_INVALID)
|
||||
scancode = (HIWORD(lParam) & (KF_EXTENDED | 0xff));
|
||||
if (!scancode)
|
||||
{
|
||||
// NOTE: Some synthetic key messages have a scancode of zero
|
||||
// HACK: Map the virtual key back to a usable scancode
|
||||
scancode = MapVirtualKeyW((UINT) wParam, MAPVK_VK_TO_VSC);
|
||||
}
|
||||
|
||||
key = _glfw.win32.keycodes[scancode];
|
||||
|
||||
// The Ctrl keys require special handling
|
||||
if (wParam == VK_CONTROL)
|
||||
{
|
||||
if (HIWORD(lParam) & KF_EXTENDED)
|
||||
{
|
||||
// Right side keys have the extended key bit set
|
||||
key = GLFW_KEY_RIGHT_CONTROL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// NOTE: Alt Gr sends Left Ctrl followed by Right Alt
|
||||
// HACK: We only want one event for Alt Gr, so if we detect
|
||||
// this sequence we discard this Left Ctrl message now
|
||||
// and later report Right Alt normally
|
||||
MSG next;
|
||||
const DWORD time = GetMessageTime();
|
||||
|
||||
if (PeekMessageW(&next, NULL, 0, 0, PM_NOREMOVE))
|
||||
{
|
||||
if (next.message == WM_KEYDOWN ||
|
||||
next.message == WM_SYSKEYDOWN ||
|
||||
next.message == WM_KEYUP ||
|
||||
next.message == WM_SYSKEYUP)
|
||||
{
|
||||
if (next.wParam == VK_MENU &&
|
||||
(HIWORD(next.lParam) & KF_EXTENDED) &&
|
||||
next.time == time)
|
||||
{
|
||||
// Next message is Right Alt down so discard this
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This is a regular Left Ctrl message
|
||||
key = GLFW_KEY_LEFT_CONTROL;
|
||||
}
|
||||
}
|
||||
else if (wParam == VK_PROCESSKEY)
|
||||
{
|
||||
// IME notifies that keys have been filtered by setting the
|
||||
// virtual key-code to VK_PROCESSKEY
|
||||
break;
|
||||
}
|
||||
|
||||
if (action == GLFW_RELEASE && wParam == VK_SHIFT)
|
||||
{
|
||||
|
@ -830,7 +815,19 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
const int x = GET_X_LPARAM(lParam);
|
||||
const int y = GET_Y_LPARAM(lParam);
|
||||
|
||||
// Disabled cursor motion input is provided by WM_INPUT
|
||||
if (!window->win32.cursorTracked)
|
||||
{
|
||||
TRACKMOUSEEVENT tme;
|
||||
ZeroMemory(&tme, sizeof(tme));
|
||||
tme.cbSize = sizeof(tme);
|
||||
tme.dwFlags = TME_LEAVE;
|
||||
tme.hwndTrack = window->win32.handle;
|
||||
TrackMouseEvent(&tme);
|
||||
|
||||
window->win32.cursorTracked = GLFW_TRUE;
|
||||
_glfwInputCursorEnter(window, GLFW_TRUE);
|
||||
}
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
const int dx = x - window->win32.lastCursorPosX;
|
||||
|
@ -851,19 +848,6 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
window->win32.lastCursorPosX = x;
|
||||
window->win32.lastCursorPosY = y;
|
||||
|
||||
if (!window->win32.cursorTracked)
|
||||
{
|
||||
TRACKMOUSEEVENT tme;
|
||||
ZeroMemory(&tme, sizeof(tme));
|
||||
tme.cbSize = sizeof(tme);
|
||||
tme.dwFlags = TME_LEAVE;
|
||||
tme.hwndTrack = window->win32.handle;
|
||||
TrackMouseEvent(&tme);
|
||||
|
||||
window->win32.cursorTracked = GLFW_TRUE;
|
||||
_glfwInputCursorEnter(window, GLFW_TRUE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -942,6 +926,9 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
case WM_ENTERSIZEMOVE:
|
||||
case WM_ENTERMENULOOP:
|
||||
{
|
||||
if (window->win32.frameAction)
|
||||
break;
|
||||
|
||||
// HACK: Enable the cursor while the user is moving or
|
||||
// resizing the window or using the window menu
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
|
@ -953,6 +940,9 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
case WM_EXITSIZEMOVE:
|
||||
case WM_EXITMENULOOP:
|
||||
{
|
||||
if (window->win32.frameAction)
|
||||
break;
|
||||
|
||||
// HACK: Disable the cursor once the user is done moving or
|
||||
// resizing the window or using the menu
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
|
@ -1225,6 +1215,7 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||
xpos = CW_USEDEFAULT;
|
||||
ypos = CW_USEDEFAULT;
|
||||
|
||||
window->win32.maximized = wndconfig->maximized;
|
||||
if (wndconfig->maximized)
|
||||
style |= WS_MAXIMIZE;
|
||||
|
||||
|
@ -1271,13 +1262,15 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||
}
|
||||
|
||||
window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
|
||||
window->win32.keymenu = wndconfig->win32.keymenu;
|
||||
|
||||
// Adjust window size to account for DPI scaling of the window frame and
|
||||
// optionally DPI scaling of the content area
|
||||
// This cannot be done until we know what monitor it was placed on
|
||||
// Adjust window rect to account for DPI scaling of the window frame and
|
||||
// (if enabled) DPI scaling of the content area
|
||||
// This cannot be done until we know what monitor the window was placed on
|
||||
if (!window->monitor)
|
||||
{
|
||||
RECT rect = { 0, 0, wndconfig->width, wndconfig->height };
|
||||
WINDOWPLACEMENT wp = { sizeof(wp) };
|
||||
|
||||
if (wndconfig->scaleToMonitor)
|
||||
{
|
||||
|
@ -1298,10 +1291,11 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||
else
|
||||
AdjustWindowRectEx(&rect, style, FALSE, exStyle);
|
||||
|
||||
SetWindowPos(window->win32.handle, NULL,
|
||||
rect.left, rect.top,
|
||||
rect.right - rect.left, rect.bottom - rect.top,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER);
|
||||
// Only update the restored window rect as the window may be maximized
|
||||
GetWindowPlacement(window->win32.handle, &wp);
|
||||
wp.rcNormalPosition = rect;
|
||||
wp.showCmd = SW_HIDE;
|
||||
SetWindowPlacement(window->win32.handle, &wp);
|
||||
}
|
||||
|
||||
DragAcceptFiles(window->win32.handle, TRUE);
|
||||
|
@ -1722,7 +1716,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||
|
||||
_glfwInputWindowMonitor(window, monitor);
|
||||
|
||||
if (monitor)
|
||||
if (window->monitor)
|
||||
{
|
||||
MONITORINFO mi = { sizeof(mi) };
|
||||
UINT flags = SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOCOPYBITS;
|
||||
|
@ -1918,30 +1912,40 @@ void _glfwPlatformPollEvents(void)
|
|||
}
|
||||
}
|
||||
|
||||
// HACK: Release modifier keys that the system did not emit KEYUP for
|
||||
// NOTE: Shift keys on Windows tend to "stick" when both are pressed as
|
||||
// no key up message is generated by the first key release
|
||||
// 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
|
||||
handle = GetActiveWindow();
|
||||
if (handle)
|
||||
{
|
||||
// NOTE: Shift keys on Windows tend to "stick" when both are pressed as
|
||||
// no key up message is generated by the first key release
|
||||
// The other half of this is in the handling of WM_KEYUP
|
||||
// HACK: Query actual key state and synthesize release events as needed
|
||||
window = GetPropW(handle, L"GLFW");
|
||||
if (window)
|
||||
{
|
||||
const GLFWbool lshift = (GetAsyncKeyState(VK_LSHIFT) >> 15) & 1;
|
||||
const GLFWbool rshift = (GetAsyncKeyState(VK_RSHIFT) >> 15) & 1;
|
||||
int i;
|
||||
const int keys[4][2] =
|
||||
{
|
||||
{ VK_LSHIFT, GLFW_KEY_LEFT_SHIFT },
|
||||
{ VK_RSHIFT, GLFW_KEY_RIGHT_SHIFT },
|
||||
{ VK_LWIN, GLFW_KEY_LEFT_SUPER },
|
||||
{ VK_RWIN, GLFW_KEY_RIGHT_SUPER }
|
||||
};
|
||||
|
||||
if (!lshift && window->keys[GLFW_KEY_LEFT_SHIFT] == GLFW_PRESS)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
const int mods = getAsyncKeyMods();
|
||||
const int scancode = _glfw.win32.scancodes[GLFW_KEY_LEFT_SHIFT];
|
||||
_glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, scancode, GLFW_RELEASE, mods);
|
||||
}
|
||||
else if (!rshift && window->keys[GLFW_KEY_RIGHT_SHIFT] == GLFW_PRESS)
|
||||
{
|
||||
const int mods = getAsyncKeyMods();
|
||||
const int scancode = _glfw.win32.scancodes[GLFW_KEY_RIGHT_SHIFT];
|
||||
_glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, scancode, GLFW_RELEASE, mods);
|
||||
const int vk = keys[i][0];
|
||||
const int key = keys[i][1];
|
||||
const int scancode = _glfw.win32.scancodes[key];
|
||||
|
||||
if ((GetKeyState(vk) & 0x8000))
|
||||
continue;
|
||||
if (window->keys[key] != GLFW_PRESS)
|
||||
continue;
|
||||
|
||||
_glfwInputKey(window, key, scancode, GLFW_RELEASE, getKeyMods());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2023,6 +2027,13 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
|||
|
||||
const char* _glfwPlatformGetScancodeName(int scancode)
|
||||
{
|
||||
if (scancode < 0 || scancode > (KF_EXTENDED | 0xff) ||
|
||||
_glfw.win32.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _glfw.win32.keynames[_glfw.win32.keycodes[scancode]];
|
||||
}
|
||||
|
||||
|
@ -2052,14 +2063,25 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
|||
id = OCR_IBEAM;
|
||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||
id = OCR_CROSS;
|
||||
else if (shape == GLFW_HAND_CURSOR)
|
||||
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||
id = OCR_HAND;
|
||||
else if (shape == GLFW_HRESIZE_CURSOR)
|
||||
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||
id = OCR_SIZEWE;
|
||||
else if (shape == GLFW_VRESIZE_CURSOR)
|
||||
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||
id = OCR_SIZENS;
|
||||
else if (shape == GLFW_RESIZE_NWSE_CURSOR)
|
||||
id = OCR_SIZENWSE;
|
||||
else if (shape == GLFW_RESIZE_NESW_CURSOR)
|
||||
id = OCR_SIZENESW;
|
||||
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||
id = OCR_SIZEALL;
|
||||
else if (shape == GLFW_NOT_ALLOWED_CURSOR)
|
||||
id = OCR_NO;
|
||||
else
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Unknown standard cursor");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
cursor->win32.handle = LoadImageW(NULL,
|
||||
MAKEINTRESOURCEW(id), IMAGE_CURSOR, 0, 0,
|
||||
|
|
7
raylib/external/glfw/src/window.c
vendored
7
raylib/external/glfw/src/window.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 - www.glfw.org
|
||||
// GLFW 3.4 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -25,6 +25,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -361,6 +363,9 @@ GLFWAPI void glfwWindowHint(int hint, int value)
|
|||
case GLFW_COCOA_RETINA_FRAMEBUFFER:
|
||||
_glfw.hints.window.ns.retina = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
case GLFW_WIN32_KEYBOARD_MENU:
|
||||
_glfw.hints.window.win32.keymenu = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
case GLFW_COCOA_GRAPHICS_SWITCHING:
|
||||
_glfw.hints.context.nsgl.offline = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
|
|
88
raylib/external/glfw/src/wl_init.c
vendored
88
raylib/external/glfw/src/wl_init.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Wayland - www.glfw.org
|
||||
// GLFW 3.4 Wayland - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
|
||||
//
|
||||
|
@ -23,6 +23,10 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
//#define _POSIX_C_SOURCE 199309L
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -36,6 +40,7 @@
|
|||
#include <sys/mman.h>
|
||||
#include <sys/timerfd.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <wayland-client.h>
|
||||
|
||||
|
||||
|
@ -123,6 +128,7 @@ static void pointerHandleLeave(void* data,
|
|||
_glfw.wl.serial = serial;
|
||||
_glfw.wl.pointerFocus = NULL;
|
||||
_glfwInputCursorEnter(window, GLFW_FALSE);
|
||||
_glfw.wl.cursorPreviousName = NULL;
|
||||
}
|
||||
|
||||
static void setCursor(_GLFWwindow* window, const char* name)
|
||||
|
@ -167,6 +173,7 @@ static void setCursor(_GLFWwindow* window, const char* name)
|
|||
wl_surface_damage(surface, 0, 0,
|
||||
image->width, image->height);
|
||||
wl_surface_commit(surface);
|
||||
_glfw.wl.cursorPreviousName = name;
|
||||
}
|
||||
|
||||
static void pointerHandleMotion(void* data,
|
||||
|
@ -176,48 +183,47 @@ static void pointerHandleMotion(void* data,
|
|||
wl_fixed_t sy)
|
||||
{
|
||||
_GLFWwindow* window = _glfw.wl.pointerFocus;
|
||||
const char* cursorName;
|
||||
const char* cursorName = NULL;
|
||||
double x, y;
|
||||
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
return;
|
||||
else
|
||||
{
|
||||
window->wl.cursorPosX = wl_fixed_to_double(sx);
|
||||
window->wl.cursorPosY = wl_fixed_to_double(sy);
|
||||
}
|
||||
x = wl_fixed_to_double(sx);
|
||||
y = wl_fixed_to_double(sy);
|
||||
|
||||
switch (window->wl.decorations.focus)
|
||||
{
|
||||
case mainWindow:
|
||||
_glfwInputCursorPos(window,
|
||||
wl_fixed_to_double(sx),
|
||||
wl_fixed_to_double(sy));
|
||||
window->wl.cursorPosX = x;
|
||||
window->wl.cursorPosY = y;
|
||||
_glfwInputCursorPos(window, x, y);
|
||||
_glfw.wl.cursorPreviousName = NULL;
|
||||
return;
|
||||
case topDecoration:
|
||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
||||
if (y < _GLFW_DECORATION_WIDTH)
|
||||
cursorName = "n-resize";
|
||||
else
|
||||
cursorName = "left_ptr";
|
||||
break;
|
||||
case leftDecoration:
|
||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
||||
if (y < _GLFW_DECORATION_WIDTH)
|
||||
cursorName = "nw-resize";
|
||||
else
|
||||
cursorName = "w-resize";
|
||||
break;
|
||||
case rightDecoration:
|
||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
||||
if (y < _GLFW_DECORATION_WIDTH)
|
||||
cursorName = "ne-resize";
|
||||
else
|
||||
cursorName = "e-resize";
|
||||
break;
|
||||
case bottomDecoration:
|
||||
if (window->wl.cursorPosX < _GLFW_DECORATION_WIDTH)
|
||||
if (x < _GLFW_DECORATION_WIDTH)
|
||||
cursorName = "sw-resize";
|
||||
else if (window->wl.cursorPosX > window->wl.width + _GLFW_DECORATION_WIDTH)
|
||||
else if (x > window->wl.width + _GLFW_DECORATION_WIDTH)
|
||||
cursorName = "se-resize";
|
||||
else
|
||||
cursorName = "s-resize";
|
||||
|
@ -225,7 +231,8 @@ static void pointerHandleMotion(void* data,
|
|||
default:
|
||||
assert(0);
|
||||
}
|
||||
setCursor(window, cursorName);
|
||||
if (_glfw.wl.cursorPreviousName != cursorName)
|
||||
setCursor(window, cursorName);
|
||||
}
|
||||
|
||||
static void pointerHandleButton(void* data,
|
||||
|
@ -237,9 +244,7 @@ static void pointerHandleButton(void* data,
|
|||
{
|
||||
_GLFWwindow* window = _glfw.wl.pointerFocus;
|
||||
int glfwButton;
|
||||
|
||||
// Both xdg-shell and wl_shell use the same values.
|
||||
uint32_t edges = WL_SHELL_SURFACE_RESIZE_NONE;
|
||||
uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE;
|
||||
|
||||
if (!window)
|
||||
return;
|
||||
|
@ -251,46 +256,39 @@ static void pointerHandleButton(void* data,
|
|||
break;
|
||||
case topDecoration:
|
||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
||||
edges = WL_SHELL_SURFACE_RESIZE_TOP;
|
||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP;
|
||||
else
|
||||
{
|
||||
if (window->wl.xdg.toplevel)
|
||||
xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
|
||||
else
|
||||
wl_shell_surface_move(window->wl.shellSurface, _glfw.wl.seat, serial);
|
||||
xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
|
||||
}
|
||||
break;
|
||||
case leftDecoration:
|
||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
||||
edges = WL_SHELL_SURFACE_RESIZE_TOP_LEFT;
|
||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT;
|
||||
else
|
||||
edges = WL_SHELL_SURFACE_RESIZE_LEFT;
|
||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_LEFT;
|
||||
break;
|
||||
case rightDecoration:
|
||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
||||
edges = WL_SHELL_SURFACE_RESIZE_TOP_RIGHT;
|
||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT;
|
||||
else
|
||||
edges = WL_SHELL_SURFACE_RESIZE_RIGHT;
|
||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_RIGHT;
|
||||
break;
|
||||
case bottomDecoration:
|
||||
if (window->wl.cursorPosX < _GLFW_DECORATION_WIDTH)
|
||||
edges = WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT;
|
||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT;
|
||||
else if (window->wl.cursorPosX > window->wl.width + _GLFW_DECORATION_WIDTH)
|
||||
edges = WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT;
|
||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT;
|
||||
else
|
||||
edges = WL_SHELL_SURFACE_RESIZE_BOTTOM;
|
||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
if (edges != WL_SHELL_SURFACE_RESIZE_NONE)
|
||||
if (edges != XDG_TOPLEVEL_RESIZE_EDGE_NONE)
|
||||
{
|
||||
if (window->wl.xdg.toplevel)
|
||||
xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat,
|
||||
serial, edges);
|
||||
else
|
||||
wl_shell_surface_resize(window->wl.shellSurface, _glfw.wl.seat,
|
||||
serial, edges);
|
||||
xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat,
|
||||
serial, edges);
|
||||
}
|
||||
}
|
||||
else if (button == BTN_RIGHT)
|
||||
|
@ -805,11 +803,6 @@ static void registryHandleGlobal(void* data,
|
|||
_glfw.wl.shm =
|
||||
wl_registry_bind(registry, name, &wl_shm_interface, 1);
|
||||
}
|
||||
else if (strcmp(interface, "wl_shell") == 0)
|
||||
{
|
||||
_glfw.wl.shell =
|
||||
wl_registry_bind(registry, name, &wl_shell_interface, 1);
|
||||
}
|
||||
else if (strcmp(interface, "wl_output") == 0)
|
||||
{
|
||||
_glfwAddOutputWayland(name, version);
|
||||
|
@ -1164,6 +1157,13 @@ int _glfwPlatformInit(void)
|
|||
if (_glfw.wl.seatVersion >= 4)
|
||||
_glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
|
||||
|
||||
if (!_glfw.wl.wmBase)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Wayland: Failed to find xdg-shell in your compositor");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (_glfw.wl.pointer && _glfw.wl.shm)
|
||||
{
|
||||
cursorTheme = getenv("XCURSOR_THEME");
|
||||
|
@ -1257,8 +1257,6 @@ void _glfwPlatformTerminate(void)
|
|||
wl_compositor_destroy(_glfw.wl.compositor);
|
||||
if (_glfw.wl.shm)
|
||||
wl_shm_destroy(_glfw.wl.shm);
|
||||
if (_glfw.wl.shell)
|
||||
wl_shell_destroy(_glfw.wl.shell);
|
||||
if (_glfw.wl.viewporter)
|
||||
wp_viewporter_destroy(_glfw.wl.viewporter);
|
||||
if (_glfw.wl.decorationManager)
|
||||
|
|
6
raylib/external/glfw/src/wl_monitor.c
vendored
6
raylib/external/glfw/src/wl_monitor.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Wayland - www.glfw.org
|
||||
// GLFW 3.4 Wayland - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
|
||||
//
|
||||
|
@ -23,6 +23,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -198,7 +200,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
|||
GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Wayland: Gamma ramp access it not available");
|
||||
"Wayland: Gamma ramp access is not available");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
|
|
11
raylib/external/glfw/src/wl_platform.h
vendored
11
raylib/external/glfw/src/wl_platform.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Wayland - www.glfw.org
|
||||
// GLFW 3.4 Wayland - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
|
||||
//
|
||||
|
@ -75,8 +75,8 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
|
|||
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWayland wl
|
||||
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWayland wl
|
||||
|
||||
#define _GLFW_PLATFORM_CONTEXT_STATE
|
||||
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE
|
||||
#define _GLFW_PLATFORM_CONTEXT_STATE struct { int dummyContext; }
|
||||
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE struct { int dummyLibraryContext; }
|
||||
|
||||
struct wl_cursor_image {
|
||||
uint32_t width;
|
||||
|
@ -180,7 +180,6 @@ typedef struct _GLFWwindowWayland
|
|||
GLFWbool transparent;
|
||||
struct wl_surface* surface;
|
||||
struct wl_egl_window* native;
|
||||
struct wl_shell_surface* shellSurface;
|
||||
struct wl_callback* callback;
|
||||
|
||||
struct {
|
||||
|
@ -227,7 +226,6 @@ typedef struct _GLFWlibraryWayland
|
|||
struct wl_registry* registry;
|
||||
struct wl_compositor* compositor;
|
||||
struct wl_subcompositor* subcompositor;
|
||||
struct wl_shell* shell;
|
||||
struct wl_shm* shm;
|
||||
struct wl_seat* seat;
|
||||
struct wl_pointer* pointer;
|
||||
|
@ -249,6 +247,7 @@ typedef struct _GLFWlibraryWayland
|
|||
struct wl_cursor_theme* cursorTheme;
|
||||
struct wl_cursor_theme* cursorThemeHiDPI;
|
||||
struct wl_surface* cursorSurface;
|
||||
const char* cursorPreviousName;
|
||||
int cursorTimerfd;
|
||||
uint32_t serial;
|
||||
|
||||
|
@ -332,7 +331,7 @@ typedef struct _GLFWlibraryWayland
|
|||
typedef struct _GLFWmonitorWayland
|
||||
{
|
||||
struct wl_output* output;
|
||||
int name;
|
||||
uint32_t name;
|
||||
int currentMode;
|
||||
|
||||
int x;
|
||||
|
|
316
raylib/external/glfw/src/wl_window.c
vendored
316
raylib/external/glfw/src/wl_window.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Wayland - www.glfw.org
|
||||
// GLFW 3.4 Wayland - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
|
||||
//
|
||||
|
@ -23,6 +23,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
|
@ -39,72 +41,6 @@
|
|||
#include <poll.h>
|
||||
|
||||
|
||||
static void shellSurfaceHandlePing(void* data,
|
||||
struct wl_shell_surface* shellSurface,
|
||||
uint32_t serial)
|
||||
{
|
||||
wl_shell_surface_pong(shellSurface, serial);
|
||||
}
|
||||
|
||||
static void shellSurfaceHandleConfigure(void* data,
|
||||
struct wl_shell_surface* shellSurface,
|
||||
uint32_t edges,
|
||||
int32_t width,
|
||||
int32_t height)
|
||||
{
|
||||
_GLFWwindow* window = data;
|
||||
float aspectRatio;
|
||||
float targetRatio;
|
||||
|
||||
if (!window->monitor)
|
||||
{
|
||||
if (_glfw.wl.viewporter && window->decorated)
|
||||
{
|
||||
width -= _GLFW_DECORATION_HORIZONTAL;
|
||||
height -= _GLFW_DECORATION_VERTICAL;
|
||||
}
|
||||
if (width < 1)
|
||||
width = 1;
|
||||
if (height < 1)
|
||||
height = 1;
|
||||
|
||||
if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE)
|
||||
{
|
||||
aspectRatio = (float)width / (float)height;
|
||||
targetRatio = (float)window->numer / (float)window->denom;
|
||||
if (aspectRatio < targetRatio)
|
||||
height = width / targetRatio;
|
||||
else if (aspectRatio > targetRatio)
|
||||
width = height * targetRatio;
|
||||
}
|
||||
|
||||
if (window->minwidth != GLFW_DONT_CARE && width < window->minwidth)
|
||||
width = window->minwidth;
|
||||
else if (window->maxwidth != GLFW_DONT_CARE && width > window->maxwidth)
|
||||
width = window->maxwidth;
|
||||
|
||||
if (window->minheight != GLFW_DONT_CARE && height < window->minheight)
|
||||
height = window->minheight;
|
||||
else if (window->maxheight != GLFW_DONT_CARE && height > window->maxheight)
|
||||
height = window->maxheight;
|
||||
}
|
||||
|
||||
_glfwInputWindowSize(window, width, height);
|
||||
_glfwPlatformSetWindowSize(window, width, height);
|
||||
_glfwInputWindowDamage(window);
|
||||
}
|
||||
|
||||
static void shellSurfaceHandlePopupDone(void* data,
|
||||
struct wl_shell_surface* shellSurface)
|
||||
{
|
||||
}
|
||||
|
||||
static const struct wl_shell_surface_listener shellSurfaceListener = {
|
||||
shellSurfaceHandlePing,
|
||||
shellSurfaceHandleConfigure,
|
||||
shellSurfaceHandlePopupDone
|
||||
};
|
||||
|
||||
static int createTmpfileCloexec(char* tmpname)
|
||||
{
|
||||
int fd;
|
||||
|
@ -132,7 +68,7 @@ static int createTmpfileCloexec(char* tmpname)
|
|||
* SCM_RIGHTS methods.
|
||||
*
|
||||
* posix_fallocate() is used to guarantee that disk space is available
|
||||
* for the file at the given size. If disk space is insufficent, errno
|
||||
* for the file at the given size. If disk space is insufficient, errno
|
||||
* is set to ENOSPC. If posix_fallocate() is not supported, program may
|
||||
* receive SIGBUS on accessing mmap()'ed file contents instead.
|
||||
*/
|
||||
|
@ -529,66 +465,11 @@ static void setFullscreen(_GLFWwindow* window, _GLFWmonitor* monitor,
|
|||
window->wl.xdg.toplevel,
|
||||
monitor->wl.output);
|
||||
}
|
||||
else if (window->wl.shellSurface)
|
||||
{
|
||||
wl_shell_surface_set_fullscreen(
|
||||
window->wl.shellSurface,
|
||||
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
|
||||
refreshRate * 1000, // Convert Hz to mHz.
|
||||
monitor->wl.output);
|
||||
}
|
||||
setIdleInhibitor(window, GLFW_TRUE);
|
||||
if (!window->wl.decorations.serverSide)
|
||||
destroyDecorations(window);
|
||||
}
|
||||
|
||||
static GLFWbool createShellSurface(_GLFWwindow* window)
|
||||
{
|
||||
if (!_glfw.wl.shell)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Wayland: wl_shell protocol not available");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
window->wl.shellSurface = wl_shell_get_shell_surface(_glfw.wl.shell,
|
||||
window->wl.surface);
|
||||
if (!window->wl.shellSurface)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Wayland: Shell surface creation failed");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
wl_shell_surface_add_listener(window->wl.shellSurface,
|
||||
&shellSurfaceListener,
|
||||
window);
|
||||
|
||||
if (window->wl.title)
|
||||
wl_shell_surface_set_title(window->wl.shellSurface, window->wl.title);
|
||||
|
||||
if (window->monitor)
|
||||
{
|
||||
setFullscreen(window, window->monitor, 0);
|
||||
}
|
||||
else if (window->wl.maximized)
|
||||
{
|
||||
wl_shell_surface_set_maximized(window->wl.shellSurface, NULL);
|
||||
setIdleInhibitor(window, GLFW_FALSE);
|
||||
createDecorations(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
wl_shell_surface_set_toplevel(window->wl.shellSurface);
|
||||
setIdleInhibitor(window, GLFW_FALSE);
|
||||
createDecorations(window);
|
||||
}
|
||||
|
||||
wl_surface_commit(window->wl.surface);
|
||||
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
static void xdgToplevelHandleConfigure(void* data,
|
||||
struct xdg_toplevel* toplevel,
|
||||
int32_t width,
|
||||
|
@ -889,28 +770,6 @@ static void handleEvents(int timeout)
|
|||
}
|
||||
}
|
||||
|
||||
// Translates a GLFW standard cursor to a theme cursor name
|
||||
//
|
||||
static char *translateCursorShape(int shape)
|
||||
{
|
||||
switch (shape)
|
||||
{
|
||||
case GLFW_ARROW_CURSOR:
|
||||
return "left_ptr";
|
||||
case GLFW_IBEAM_CURSOR:
|
||||
return "xterm";
|
||||
case GLFW_CROSSHAIR_CURSOR:
|
||||
return "crosshair";
|
||||
case GLFW_HAND_CURSOR:
|
||||
return "grabbing";
|
||||
case GLFW_HRESIZE_CURSOR:
|
||||
return "sb_h_double_arrow";
|
||||
case GLFW_VRESIZE_CURSOR:
|
||||
return "sb_v_double_arrow";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW platform API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -949,16 +808,8 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||
|
||||
if (wndconfig->visible)
|
||||
{
|
||||
if (_glfw.wl.wmBase)
|
||||
{
|
||||
if (!createXdgSurface(window))
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!createShellSurface(window))
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
if (!createXdgSurface(window))
|
||||
return GLFW_FALSE;
|
||||
|
||||
window->wl.visible = GLFW_TRUE;
|
||||
}
|
||||
|
@ -966,7 +817,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||
{
|
||||
window->wl.xdg.surface = NULL;
|
||||
window->wl.xdg.toplevel = NULL;
|
||||
window->wl.shellSurface = NULL;
|
||||
window->wl.visible = GLFW_FALSE;
|
||||
}
|
||||
|
||||
|
@ -1008,9 +858,6 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|||
if (window->wl.native)
|
||||
wl_egl_window_destroy(window->wl.native);
|
||||
|
||||
if (window->wl.shellSurface)
|
||||
wl_shell_surface_destroy(window->wl.shellSurface);
|
||||
|
||||
if (window->wl.xdg.toplevel)
|
||||
xdg_toplevel_destroy(window->wl.xdg.toplevel);
|
||||
|
||||
|
@ -1031,8 +878,6 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
|||
window->wl.title = _glfw_strdup(title);
|
||||
if (window->wl.xdg.toplevel)
|
||||
xdg_toplevel_set_title(window->wl.xdg.toplevel, title);
|
||||
else if (window->wl.shellSurface)
|
||||
wl_shell_surface_set_title(window->wl.shellSurface, title);
|
||||
}
|
||||
|
||||
void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
|
||||
|
@ -1078,23 +923,15 @@ void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
|
|||
int minwidth, int minheight,
|
||||
int maxwidth, int maxheight)
|
||||
{
|
||||
if (_glfw.wl.wmBase)
|
||||
if (window->wl.xdg.toplevel)
|
||||
{
|
||||
if (window->wl.xdg.toplevel)
|
||||
{
|
||||
if (minwidth == GLFW_DONT_CARE || minheight == GLFW_DONT_CARE)
|
||||
minwidth = minheight = 0;
|
||||
if (maxwidth == GLFW_DONT_CARE || maxheight == GLFW_DONT_CARE)
|
||||
maxwidth = maxheight = 0;
|
||||
xdg_toplevel_set_min_size(window->wl.xdg.toplevel, minwidth, minheight);
|
||||
xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight);
|
||||
wl_surface_commit(window->wl.surface);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: find out how to trigger a resize.
|
||||
// The actual limits are checked in the wl_shell_surface::configure handler.
|
||||
if (minwidth == GLFW_DONT_CARE || minheight == GLFW_DONT_CARE)
|
||||
minwidth = minheight = 0;
|
||||
if (maxwidth == GLFW_DONT_CARE || maxheight == GLFW_DONT_CARE)
|
||||
maxwidth = maxheight = 0;
|
||||
xdg_toplevel_set_min_size(window->wl.xdg.toplevel, minwidth, minheight);
|
||||
xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight);
|
||||
wl_surface_commit(window->wl.surface);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1102,7 +939,7 @@ void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window,
|
|||
int numer, int denom)
|
||||
{
|
||||
// TODO: find out how to trigger a resize.
|
||||
// The actual limits are checked in the wl_shell_surface::configure handler.
|
||||
// The actual limits are checked in the xdg_toplevel::configure handler.
|
||||
}
|
||||
|
||||
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window,
|
||||
|
@ -1141,16 +978,8 @@ void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
|
|||
|
||||
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
||||
{
|
||||
if (_glfw.wl.wmBase)
|
||||
{
|
||||
if (window->wl.xdg.toplevel)
|
||||
xdg_toplevel_set_minimized(window->wl.xdg.toplevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Wayland: Iconify window not supported on wl_shell");
|
||||
}
|
||||
if (window->wl.xdg.toplevel)
|
||||
xdg_toplevel_set_minimized(window->wl.xdg.toplevel);
|
||||
}
|
||||
|
||||
void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
||||
|
@ -1162,12 +991,7 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|||
if (window->wl.maximized)
|
||||
xdg_toplevel_unset_maximized(window->wl.xdg.toplevel);
|
||||
// There is no way to unset minimized, or even to know if we are
|
||||
// minimized, so there is nothing to do here.
|
||||
}
|
||||
else if (window->wl.shellSurface)
|
||||
{
|
||||
if (window->monitor || window->wl.maximized)
|
||||
wl_shell_surface_set_toplevel(window->wl.shellSurface);
|
||||
// minimized, so there is nothing to do in this case.
|
||||
}
|
||||
_glfwInputWindowMonitor(window, NULL);
|
||||
window->wl.maximized = GLFW_FALSE;
|
||||
|
@ -1179,11 +1003,6 @@ void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
|
|||
{
|
||||
xdg_toplevel_set_maximized(window->wl.xdg.toplevel);
|
||||
}
|
||||
else if (window->wl.shellSurface)
|
||||
{
|
||||
// Let the compositor select the best output.
|
||||
wl_shell_surface_set_maximized(window->wl.shellSurface, NULL);
|
||||
}
|
||||
window->wl.maximized = GLFW_TRUE;
|
||||
}
|
||||
|
||||
|
@ -1191,10 +1010,7 @@ void _glfwPlatformShowWindow(_GLFWwindow* window)
|
|||
{
|
||||
if (!window->wl.visible)
|
||||
{
|
||||
if (_glfw.wl.wmBase)
|
||||
createXdgSurface(window);
|
||||
else if (!window->wl.shellSurface)
|
||||
createShellSurface(window);
|
||||
createXdgSurface(window);
|
||||
window->wl.visible = GLFW_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -1208,11 +1024,6 @@ void _glfwPlatformHideWindow(_GLFWwindow* window)
|
|||
window->wl.xdg.toplevel = NULL;
|
||||
window->wl.xdg.surface = NULL;
|
||||
}
|
||||
else if (window->wl.shellSurface)
|
||||
{
|
||||
wl_shell_surface_destroy(window->wl.shellSurface);
|
||||
window->wl.shellSurface = NULL;
|
||||
}
|
||||
window->wl.visible = GLFW_FALSE;
|
||||
}
|
||||
|
||||
|
@ -1243,8 +1054,6 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||
{
|
||||
if (window->wl.xdg.toplevel)
|
||||
xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel);
|
||||
else if (window->wl.shellSurface)
|
||||
wl_shell_surface_set_toplevel(window->wl.shellSurface);
|
||||
setIdleInhibitor(window, GLFW_FALSE);
|
||||
if (!_glfw.wl.decorationManager)
|
||||
createDecorations(window);
|
||||
|
@ -1259,8 +1068,8 @@ int _glfwPlatformWindowFocused(_GLFWwindow* window)
|
|||
|
||||
int _glfwPlatformWindowIconified(_GLFWwindow* window)
|
||||
{
|
||||
// wl_shell doesn't have any iconified concept, and xdg-shell doesn’t give
|
||||
// any way to request whether a surface is iconified.
|
||||
// xdg-shell doesn’t give any way to request whether a surface is
|
||||
// iconified.
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
|
@ -1402,26 +1211,79 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
|||
|
||||
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
||||
{
|
||||
struct wl_cursor* standardCursor;
|
||||
const char* name = NULL;
|
||||
|
||||
standardCursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme,
|
||||
translateCursorShape(shape));
|
||||
if (!standardCursor)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Wayland: Standard cursor \"%s\" not found",
|
||||
translateCursorShape(shape));
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
// Try the XDG names first
|
||||
if (shape == GLFW_ARROW_CURSOR)
|
||||
name = "default";
|
||||
else if (shape == GLFW_IBEAM_CURSOR)
|
||||
name = "text";
|
||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||
name = "crosshair";
|
||||
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||
name = "pointer";
|
||||
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||
name = "ew-resize";
|
||||
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||
name = "ns-resize";
|
||||
else if (shape == GLFW_RESIZE_NWSE_CURSOR)
|
||||
name = "nwse-resize";
|
||||
else if (shape == GLFW_RESIZE_NESW_CURSOR)
|
||||
name = "nesw-resize";
|
||||
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||
name = "all-scroll";
|
||||
else if (shape == GLFW_NOT_ALLOWED_CURSOR)
|
||||
name = "not-allowed";
|
||||
|
||||
cursor->wl.cursor = standardCursor;
|
||||
cursor->wl.currentImage = 0;
|
||||
cursor->wl.cursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, name);
|
||||
|
||||
if (_glfw.wl.cursorThemeHiDPI)
|
||||
{
|
||||
standardCursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI,
|
||||
translateCursorShape(shape));
|
||||
cursor->wl.cursorHiDPI = standardCursor;
|
||||
cursor->wl.cursorHiDPI =
|
||||
wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI, name);
|
||||
}
|
||||
|
||||
if (!cursor->wl.cursor)
|
||||
{
|
||||
// Fall back to the core X11 names
|
||||
if (shape == GLFW_ARROW_CURSOR)
|
||||
name = "left_ptr";
|
||||
else if (shape == GLFW_IBEAM_CURSOR)
|
||||
name = "xterm";
|
||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||
name = "crosshair";
|
||||
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||
name = "hand2";
|
||||
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||
name = "sb_h_double_arrow";
|
||||
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||
name = "sb_v_double_arrow";
|
||||
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||
name = "fleur";
|
||||
else
|
||||
{
|
||||
_glfwInputError(GLFW_CURSOR_UNAVAILABLE,
|
||||
"Wayland: Standard cursor shape unavailable");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
cursor->wl.cursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, name);
|
||||
if (!cursor->wl.cursor)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Wayland: Failed to create standard cursor \"%s\"",
|
||||
name);
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (_glfw.wl.cursorThemeHiDPI)
|
||||
{
|
||||
if (!cursor->wl.cursorHiDPI)
|
||||
{
|
||||
cursor->wl.cursorHiDPI =
|
||||
wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return GLFW_TRUE;
|
||||
|
|
95
raylib/external/glfw/src/x11_init.c
vendored
95
raylib/external/glfw/src/x11_init.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 X11 - www.glfw.org
|
||||
// GLFW 3.4 X11 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -34,6 +36,7 @@
|
|||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <locale.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
// Translate an X11 key code to a GLFW key code.
|
||||
|
@ -52,7 +55,7 @@ static int translateKeyCode(int scancode)
|
|||
// Note: This way we always force "NumLock = ON", which is intentional
|
||||
// since the returned key code should correspond to a physical
|
||||
// location.
|
||||
keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, 0, 1);
|
||||
keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, _glfw.x11.xkb.group, 1);
|
||||
switch (keySym)
|
||||
{
|
||||
case XK_KP_0: return GLFW_KEY_KP_0;
|
||||
|
@ -74,7 +77,7 @@ static int translateKeyCode(int scancode)
|
|||
|
||||
// Now try primary keysym for function keys (non-printable keys)
|
||||
// These should not depend on the current keyboard layout
|
||||
keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, 0, 0);
|
||||
keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, _glfw.x11.xkb.group, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -329,14 +332,13 @@ static void createKeyTables(void)
|
|||
//
|
||||
static GLFWbool hasUsableInputMethodStyle(void)
|
||||
{
|
||||
unsigned int i;
|
||||
GLFWbool found = GLFW_FALSE;
|
||||
XIMStyles* styles = NULL;
|
||||
|
||||
if (XGetIMValues(_glfw.x11.im, XNQueryInputStyle, &styles, NULL) != NULL)
|
||||
return GLFW_FALSE;
|
||||
|
||||
for (i = 0; i < styles->count_styles; i++)
|
||||
for (unsigned int i = 0; i < styles->count_styles; i++)
|
||||
{
|
||||
if (styles->supported_styles[i] == (XIMPreeditNothing | XIMStatusNothing))
|
||||
{
|
||||
|
@ -355,10 +357,9 @@ static Atom getSupportedAtom(Atom* supportedAtoms,
|
|||
unsigned long atomCount,
|
||||
const char* atomName)
|
||||
{
|
||||
unsigned long i;
|
||||
const Atom atom = XInternAtom(_glfw.x11.display, atomName, False);
|
||||
|
||||
for (i = 0; i < atomCount; i++)
|
||||
for (unsigned int i = 0; i < atomCount; i++)
|
||||
{
|
||||
if (supportedAtoms[i] == atom)
|
||||
return atom;
|
||||
|
@ -371,18 +372,11 @@ static Atom getSupportedAtom(Atom* supportedAtoms,
|
|||
//
|
||||
static void detectEWMH(void)
|
||||
{
|
||||
// First we read the _NET_SUPPORTING_WM_CHECK property on the root window
|
||||
|
||||
Window* windowFromRoot = NULL;
|
||||
Window* windowFromChild = NULL;
|
||||
|
||||
// First we need a couple of atoms
|
||||
const Atom supportingWmCheck =
|
||||
XInternAtom(_glfw.x11.display, "_NET_SUPPORTING_WM_CHECK", False);
|
||||
const Atom wmSupported =
|
||||
XInternAtom(_glfw.x11.display, "_NET_SUPPORTED", False);
|
||||
|
||||
// Then we look for the _NET_SUPPORTING_WM_CHECK property of the root window
|
||||
if (!_glfwGetWindowPropertyX11(_glfw.x11.root,
|
||||
supportingWmCheck,
|
||||
_glfw.x11.NET_SUPPORTING_WM_CHECK,
|
||||
XA_WINDOW,
|
||||
(unsigned char**) &windowFromRoot))
|
||||
{
|
||||
|
@ -391,10 +385,12 @@ static void detectEWMH(void)
|
|||
|
||||
_glfwGrabErrorHandlerX11();
|
||||
|
||||
// It should be the ID of a child window (of the root)
|
||||
// Then we look for the same property on the child window
|
||||
// If it exists, it should be the XID of a top-level window
|
||||
// Then we look for the same property on that window
|
||||
|
||||
Window* windowFromChild = NULL;
|
||||
if (!_glfwGetWindowPropertyX11(*windowFromRoot,
|
||||
supportingWmCheck,
|
||||
_glfw.x11.NET_SUPPORTING_WM_CHECK,
|
||||
XA_WINDOW,
|
||||
(unsigned char**) &windowFromChild))
|
||||
{
|
||||
|
@ -404,7 +400,8 @@ static void detectEWMH(void)
|
|||
|
||||
_glfwReleaseErrorHandlerX11();
|
||||
|
||||
// It should be the ID of that same child window
|
||||
// If the property exists, it should contain the XID of the window
|
||||
|
||||
if (*windowFromRoot != *windowFromChild)
|
||||
{
|
||||
XFree(windowFromRoot);
|
||||
|
@ -415,19 +412,20 @@ static void detectEWMH(void)
|
|||
XFree(windowFromRoot);
|
||||
XFree(windowFromChild);
|
||||
|
||||
// We are now fairly sure that an EWMH-compliant window manager is running
|
||||
// We are now fairly sure that an EWMH-compliant WM is currently running
|
||||
// We can now start querying the WM about what features it supports by
|
||||
// looking in the _NET_SUPPORTED property on the root window
|
||||
// It should contain a list of supported EWMH protocol and state atoms
|
||||
|
||||
Atom* supportedAtoms;
|
||||
unsigned long atomCount;
|
||||
|
||||
// Now we need to check the _NET_SUPPORTED property of the root window
|
||||
// It should be a list of supported WM protocol and state atoms
|
||||
atomCount = _glfwGetWindowPropertyX11(_glfw.x11.root,
|
||||
wmSupported,
|
||||
XA_ATOM,
|
||||
(unsigned char**) &supportedAtoms);
|
||||
Atom* supportedAtoms = NULL;
|
||||
const unsigned long atomCount =
|
||||
_glfwGetWindowPropertyX11(_glfw.x11.root,
|
||||
_glfw.x11.NET_SUPPORTED,
|
||||
XA_ATOM,
|
||||
(unsigned char**) &supportedAtoms);
|
||||
|
||||
// See which of the atoms we support that are supported by the WM
|
||||
|
||||
_glfw.x11.NET_WM_STATE =
|
||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE");
|
||||
_glfw.x11.NET_WM_STATE_ABOVE =
|
||||
|
@ -618,6 +616,12 @@ static GLFWbool initExtensions(void)
|
|||
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageDestroy");
|
||||
_glfw.x11.xcursor.ImageLoadCursor = (PFN_XcursorImageLoadCursor)
|
||||
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageLoadCursor");
|
||||
_glfw.x11.xcursor.GetTheme = (PFN_XcursorGetTheme)
|
||||
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorGetTheme");
|
||||
_glfw.x11.xcursor.GetDefaultSize = (PFN_XcursorGetDefaultSize)
|
||||
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorGetDefaultSize");
|
||||
_glfw.x11.xcursor.LibraryLoadImage = (PFN_XcursorLibraryLoadImage)
|
||||
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorLibraryLoadImage");
|
||||
}
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
|
@ -662,6 +666,14 @@ static GLFWbool initExtensions(void)
|
|||
if (supported)
|
||||
_glfw.x11.xkb.detectable = GLFW_TRUE;
|
||||
}
|
||||
|
||||
_glfw.x11.xkb.group = 0;
|
||||
XkbStateRec state;
|
||||
if (XkbGetState(_glfw.x11.display, XkbUseCoreKbd, &state) == Success)
|
||||
{
|
||||
XkbSelectEventDetails(_glfw.x11.display, XkbUseCoreKbd, XkbStateNotify, XkbAllStateComponentsMask, XkbGroupStateMask);
|
||||
_glfw.x11.xkb.group = (unsigned int)state.group;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
|
@ -707,9 +719,6 @@ static GLFWbool initExtensions(void)
|
|||
// the keyboard mapping.
|
||||
createKeyTables();
|
||||
|
||||
// Detect whether an EWMH-conformant window manager is running
|
||||
detectEWMH();
|
||||
|
||||
// String format atoms
|
||||
_glfw.x11.NULL_ = XInternAtom(_glfw.x11.display, "NULL", False);
|
||||
_glfw.x11.UTF8_STRING = XInternAtom(_glfw.x11.display, "UTF8_STRING", False);
|
||||
|
@ -753,6 +762,10 @@ static GLFWbool initExtensions(void)
|
|||
XInternAtom(_glfw.x11.display, "WM_STATE", False);
|
||||
_glfw.x11.WM_DELETE_WINDOW =
|
||||
XInternAtom(_glfw.x11.display, "WM_DELETE_WINDOW", False);
|
||||
_glfw.x11.NET_SUPPORTED =
|
||||
XInternAtom(_glfw.x11.display, "_NET_SUPPORTED", False);
|
||||
_glfw.x11.NET_SUPPORTING_WM_CHECK =
|
||||
XInternAtom(_glfw.x11.display, "_NET_SUPPORTING_WM_CHECK", False);
|
||||
_glfw.x11.NET_WM_ICON =
|
||||
XInternAtom(_glfw.x11.display, "_NET_WM_ICON", False);
|
||||
_glfw.x11.NET_WM_PING =
|
||||
|
@ -777,6 +790,9 @@ static GLFWbool initExtensions(void)
|
|||
_glfw.x11.NET_WM_CM_Sx = XInternAtom(_glfw.x11.display, name, False);
|
||||
}
|
||||
|
||||
// Detect whether an EWMH-conformant window manager is running
|
||||
detectEWMH();
|
||||
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
|
@ -784,13 +800,10 @@ static GLFWbool initExtensions(void)
|
|||
//
|
||||
static void getSystemContentScale(float* xscale, float* yscale)
|
||||
{
|
||||
// NOTE: Fall back to the display-wide DPI instead of RandR monitor DPI if
|
||||
// Xft.dpi retrieval below fails as we don't currently have an exact
|
||||
// policy for which monitor a window is considered to "be on"
|
||||
float xdpi = DisplayWidth(_glfw.x11.display, _glfw.x11.screen) *
|
||||
25.4f / DisplayWidthMM(_glfw.x11.display, _glfw.x11.screen);
|
||||
float ydpi = DisplayHeight(_glfw.x11.display, _glfw.x11.screen) *
|
||||
25.4f / DisplayHeightMM(_glfw.x11.display, _glfw.x11.screen);
|
||||
// Start by assuming the default X11 DPI
|
||||
// NOTE: Some desktop environments (KDE) may remove the Xft.dpi field when it
|
||||
// would be set to 96, so assume that is the case if we cannot find it
|
||||
float xdpi = 96.f, ydpi = 96.f;
|
||||
|
||||
// NOTE: Basing the scale on Xft.dpi where available should provide the most
|
||||
// consistent user experience (matches Qt, Gtk, etc), although not
|
||||
|
|
118
raylib/external/glfw/src/x11_monitor.c
vendored
118
raylib/external/glfw/src/x11_monitor.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 X11 - www.glfw.org
|
||||
// GLFW 3.4 X11 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -54,9 +56,7 @@ static int calculateRefreshRate(const XRRModeInfo* mi)
|
|||
//
|
||||
static const XRRModeInfo* getModeInfo(const XRRScreenResources* sr, RRMode id)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sr->nmode; i++)
|
||||
for (int i = 0; i < sr->nmode; i++)
|
||||
{
|
||||
if (sr->modes[i].id == id)
|
||||
return sr->modes + i;
|
||||
|
@ -102,7 +102,7 @@ void _glfwPollMonitorsX11(void)
|
|||
{
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||
{
|
||||
int i, j, disconnectedCount, screenCount = 0;
|
||||
int disconnectedCount, screenCount = 0;
|
||||
_GLFWmonitor** disconnected = NULL;
|
||||
XineramaScreenInfo* screens = NULL;
|
||||
XRRScreenResources* sr = XRRGetScreenResourcesCurrent(_glfw.x11.display,
|
||||
|
@ -122,14 +122,11 @@ void _glfwPollMonitorsX11(void)
|
|||
_glfw.monitorCount * sizeof(_GLFWmonitor*));
|
||||
}
|
||||
|
||||
for (i = 0; i < sr->noutput; i++)
|
||||
for (int i = 0; i < sr->noutput; i++)
|
||||
{
|
||||
int type, widthMM, heightMM;
|
||||
XRROutputInfo* oi;
|
||||
XRRCrtcInfo* ci;
|
||||
_GLFWmonitor* monitor;
|
||||
int j, type, widthMM, heightMM;
|
||||
|
||||
oi = XRRGetOutputInfo(_glfw.x11.display, sr, sr->outputs[i]);
|
||||
XRROutputInfo* oi = XRRGetOutputInfo(_glfw.x11.display, sr, sr->outputs[i]);
|
||||
if (oi->connection != RR_Connected || oi->crtc == None)
|
||||
{
|
||||
XRRFreeOutputInfo(oi);
|
||||
|
@ -152,7 +149,7 @@ void _glfwPollMonitorsX11(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, oi->crtc);
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, oi->crtc);
|
||||
if (ci->rotation == RR_Rotate_90 || ci->rotation == RR_Rotate_270)
|
||||
{
|
||||
widthMM = oi->mm_height;
|
||||
|
@ -164,7 +161,17 @@ void _glfwPollMonitorsX11(void)
|
|||
heightMM = oi->mm_height;
|
||||
}
|
||||
|
||||
monitor = _glfwAllocMonitor(oi->name, widthMM, heightMM);
|
||||
if (widthMM <= 0 || heightMM <= 0)
|
||||
{
|
||||
// HACK: If RandR does not provide a physical size, assume the
|
||||
// X11 default 96 DPI and calcuate from the CRTC viewport
|
||||
// NOTE: These members are affected by rotation, unlike the mode
|
||||
// info and output info members
|
||||
widthMM = (int) (ci->width * 25.4f / 96.f);
|
||||
heightMM = (int) (ci->height * 25.4f / 96.f);
|
||||
}
|
||||
|
||||
_GLFWmonitor* monitor = _glfwAllocMonitor(oi->name, widthMM, heightMM);
|
||||
monitor->x11.output = sr->outputs[i];
|
||||
monitor->x11.crtc = oi->crtc;
|
||||
|
||||
|
@ -196,7 +203,7 @@ void _glfwPollMonitorsX11(void)
|
|||
if (screens)
|
||||
XFree(screens);
|
||||
|
||||
for (i = 0; i < disconnectedCount; i++)
|
||||
for (int i = 0; i < disconnectedCount; i++)
|
||||
{
|
||||
if (disconnected[i])
|
||||
_glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0);
|
||||
|
@ -221,24 +228,20 @@ void _glfwSetVideoModeX11(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
|||
{
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||
{
|
||||
XRRScreenResources* sr;
|
||||
XRRCrtcInfo* ci;
|
||||
XRROutputInfo* oi;
|
||||
GLFWvidmode current;
|
||||
const GLFWvidmode* best;
|
||||
RRMode native = None;
|
||||
int i;
|
||||
|
||||
best = _glfwChooseVideoMode(monitor, desired);
|
||||
const GLFWvidmode* best = _glfwChooseVideoMode(monitor, desired);
|
||||
_glfwPlatformGetVideoMode(monitor, ¤t);
|
||||
if (_glfwCompareVideoModes(¤t, best) == 0)
|
||||
return;
|
||||
|
||||
sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output);
|
||||
XRRScreenResources* sr =
|
||||
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
XRROutputInfo* oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output);
|
||||
|
||||
for (i = 0; i < oi->nmode; i++)
|
||||
for (int i = 0; i < oi->nmode; i++)
|
||||
{
|
||||
const XRRModeInfo* mi = getModeInfo(sr, oi->modes[i]);
|
||||
if (!modeIsGood(mi))
|
||||
|
@ -279,14 +282,12 @@ void _glfwRestoreVideoModeX11(_GLFWmonitor* monitor)
|
|||
{
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||
{
|
||||
XRRScreenResources* sr;
|
||||
XRRCrtcInfo* ci;
|
||||
|
||||
if (monitor->x11.oldMode == None)
|
||||
return;
|
||||
|
||||
sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
XRRScreenResources* sr =
|
||||
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
|
||||
XRRSetCrtcConfig(_glfw.x11.display,
|
||||
sr, monitor->x11.crtc,
|
||||
|
@ -317,18 +318,20 @@ void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
|||
{
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||
{
|
||||
XRRScreenResources* sr;
|
||||
XRRCrtcInfo* ci;
|
||||
XRRScreenResources* sr =
|
||||
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
|
||||
sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
if (ci)
|
||||
{
|
||||
if (xpos)
|
||||
*xpos = ci->x;
|
||||
if (ypos)
|
||||
*ypos = ci->y;
|
||||
|
||||
if (xpos)
|
||||
*xpos = ci->x;
|
||||
if (ypos)
|
||||
*ypos = ci->y;
|
||||
XRRFreeCrtcInfo(ci);
|
||||
}
|
||||
|
||||
XRRFreeCrtcInfo(ci);
|
||||
XRRFreeScreenResources(sr);
|
||||
}
|
||||
}
|
||||
|
@ -348,11 +351,9 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos
|
|||
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||
{
|
||||
XRRScreenResources* sr;
|
||||
XRRCrtcInfo* ci;
|
||||
|
||||
sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
XRRScreenResources* sr =
|
||||
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
|
||||
areaX = ci->x;
|
||||
areaY = ci->y;
|
||||
|
@ -444,24 +445,21 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
|
|||
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||
{
|
||||
int i, j;
|
||||
XRRScreenResources* sr;
|
||||
XRRCrtcInfo* ci;
|
||||
XRROutputInfo* oi;
|
||||
|
||||
sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output);
|
||||
XRRScreenResources* sr =
|
||||
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
XRROutputInfo* oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output);
|
||||
|
||||
result = calloc(oi->nmode, sizeof(GLFWvidmode));
|
||||
|
||||
for (i = 0; i < oi->nmode; i++)
|
||||
for (int i = 0; i < oi->nmode; i++)
|
||||
{
|
||||
const XRRModeInfo* mi = getModeInfo(sr, oi->modes[i]);
|
||||
if (!modeIsGood(mi))
|
||||
continue;
|
||||
|
||||
const GLFWvidmode mode = vidmodeFromModeInfo(mi, ci);
|
||||
int j;
|
||||
|
||||
for (j = 0; j < *count; j++)
|
||||
{
|
||||
|
@ -495,15 +493,19 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
|||
{
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||
{
|
||||
XRRScreenResources* sr;
|
||||
XRRCrtcInfo* ci;
|
||||
XRRScreenResources* sr =
|
||||
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
|
||||
sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
if (ci)
|
||||
{
|
||||
const XRRModeInfo* mi = getModeInfo(sr, ci->mode);
|
||||
if (mi) // mi can be NULL if the monitor has been disconnected
|
||||
*mode = vidmodeFromModeInfo(mi, ci);
|
||||
|
||||
*mode = vidmodeFromModeInfo(getModeInfo(sr, ci->mode), ci);
|
||||
XRRFreeCrtcInfo(ci);
|
||||
}
|
||||
|
||||
XRRFreeCrtcInfo(ci);
|
||||
XRRFreeScreenResources(sr);
|
||||
}
|
||||
else
|
||||
|
|
31
raylib/external/glfw/src/x11_platform.h
vendored
31
raylib/external/glfw/src/x11_platform.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 X11 - www.glfw.org
|
||||
// GLFW 3.4 X11 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -85,9 +85,15 @@ typedef int (* PFN_XRRUpdateConfiguration)(XEvent*);
|
|||
typedef XcursorImage* (* PFN_XcursorImageCreate)(int,int);
|
||||
typedef void (* PFN_XcursorImageDestroy)(XcursorImage*);
|
||||
typedef Cursor (* PFN_XcursorImageLoadCursor)(Display*,const XcursorImage*);
|
||||
typedef char* (* PFN_XcursorGetTheme)(Display*);
|
||||
typedef int (* PFN_XcursorGetDefaultSize)(Display*);
|
||||
typedef XcursorImage* (* PFN_XcursorLibraryLoadImage)(const char*,const char*,int);
|
||||
#define XcursorImageCreate _glfw.x11.xcursor.ImageCreate
|
||||
#define XcursorImageDestroy _glfw.x11.xcursor.ImageDestroy
|
||||
#define XcursorImageLoadCursor _glfw.x11.xcursor.ImageLoadCursor
|
||||
#define XcursorGetTheme _glfw.x11.xcursor.GetTheme
|
||||
#define XcursorGetDefaultSize _glfw.x11.xcursor.GetDefaultSize
|
||||
#define XcursorLibraryLoadImage _glfw.x11.xcursor.LibraryLoadImage
|
||||
|
||||
typedef Bool (* PFN_XineramaIsActive)(Display*);
|
||||
typedef Bool (* PFN_XineramaQueryExtension)(Display*,int*,int*);
|
||||
|
@ -180,6 +186,7 @@ typedef struct _GLFWwindowX11
|
|||
{
|
||||
Colormap colormap;
|
||||
Window handle;
|
||||
Window parent;
|
||||
XIC ic;
|
||||
|
||||
GLFWbool overrideRedirect;
|
||||
|
@ -228,7 +235,7 @@ typedef struct _GLFWlibraryX11
|
|||
// Clipboard string (while the selection is owned)
|
||||
char* clipboardString;
|
||||
// Key name string
|
||||
char keyName[5];
|
||||
char keynames[GLFW_KEY_LAST + 1][5];
|
||||
// X11 keycode to GLFW key LUT
|
||||
short int keycodes[256];
|
||||
// GLFW key to X11 keycode LUT
|
||||
|
@ -239,6 +246,8 @@ typedef struct _GLFWlibraryX11
|
|||
_GLFWwindow* disabledCursorWindow;
|
||||
|
||||
// Window manager atoms
|
||||
Atom NET_SUPPORTED;
|
||||
Atom NET_SUPPORTING_WM_CHECK;
|
||||
Atom WM_PROTOCOLS;
|
||||
Atom WM_STATE;
|
||||
Atom WM_DELETE_WINDOW;
|
||||
|
@ -321,13 +330,14 @@ typedef struct _GLFWlibraryX11
|
|||
} randr;
|
||||
|
||||
struct {
|
||||
GLFWbool available;
|
||||
GLFWbool detectable;
|
||||
int majorOpcode;
|
||||
int eventBase;
|
||||
int errorBase;
|
||||
int major;
|
||||
int minor;
|
||||
GLFWbool available;
|
||||
GLFWbool detectable;
|
||||
int majorOpcode;
|
||||
int eventBase;
|
||||
int errorBase;
|
||||
int major;
|
||||
int minor;
|
||||
unsigned int group;
|
||||
} xkb;
|
||||
|
||||
struct {
|
||||
|
@ -349,6 +359,9 @@ typedef struct _GLFWlibraryX11
|
|||
PFN_XcursorImageCreate ImageCreate;
|
||||
PFN_XcursorImageDestroy ImageDestroy;
|
||||
PFN_XcursorImageLoadCursor ImageLoadCursor;
|
||||
PFN_XcursorGetTheme GetTheme;
|
||||
PFN_XcursorGetDefaultSize GetDefaultSize;
|
||||
PFN_XcursorLibraryLoadImage LibraryLoadImage;
|
||||
} xcursor;
|
||||
|
||||
struct {
|
||||
|
|
439
raylib/external/glfw/src/x11_window.c
vendored
439
raylib/external/glfw/src/x11_window.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 X11 - www.glfw.org
|
||||
// GLFW 3.4 X11 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -48,6 +50,10 @@
|
|||
#define Button6 6
|
||||
#define Button7 7
|
||||
|
||||
// Motif WM hints flags
|
||||
#define MWM_HINTS_DECORATIONS 2
|
||||
#define MWM_DECOR_ALL 1
|
||||
|
||||
#define _GLFW_XDND_VERSION 5
|
||||
|
||||
|
||||
|
@ -213,10 +219,7 @@ static int translateKey(int scancode)
|
|||
static void sendEventToWM(_GLFWwindow* window, Atom type,
|
||||
long a, long b, long c, long d, long e)
|
||||
{
|
||||
XEvent event;
|
||||
memset(&event, 0, sizeof(event));
|
||||
|
||||
event.type = ClientMessage;
|
||||
XEvent event = { ClientMessage };
|
||||
event.xclient.window = window->x11.handle;
|
||||
event.xclient.format = 32; // Data is 32-bit longs
|
||||
event.xclient.message_type = type;
|
||||
|
@ -610,46 +613,41 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
|||
|
||||
window->x11.transparent = _glfwIsVisualTransparentX11(visual);
|
||||
|
||||
// Create the actual window
|
||||
XSetWindowAttributes wa = { 0 };
|
||||
wa.colormap = window->x11.colormap;
|
||||
wa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask |
|
||||
PointerMotionMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ExposureMask | FocusChangeMask | VisibilityChangeMask |
|
||||
EnterWindowMask | LeaveWindowMask | PropertyChangeMask;
|
||||
|
||||
_glfwGrabErrorHandlerX11();
|
||||
|
||||
window->x11.parent = _glfw.x11.root;
|
||||
window->x11.handle = XCreateWindow(_glfw.x11.display,
|
||||
_glfw.x11.root,
|
||||
0, 0, // Position
|
||||
width, height,
|
||||
0, // Border width
|
||||
depth, // Color depth
|
||||
InputOutput,
|
||||
visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask,
|
||||
&wa);
|
||||
|
||||
_glfwReleaseErrorHandlerX11();
|
||||
|
||||
if (!window->x11.handle)
|
||||
{
|
||||
XSetWindowAttributes wa;
|
||||
const unsigned long wamask = CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
wa.colormap = window->x11.colormap;
|
||||
wa.border_pixel = 0;
|
||||
wa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask |
|
||||
PointerMotionMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ExposureMask | FocusChangeMask | VisibilityChangeMask |
|
||||
EnterWindowMask | LeaveWindowMask | PropertyChangeMask;
|
||||
|
||||
_glfwGrabErrorHandlerX11();
|
||||
|
||||
window->x11.handle = XCreateWindow(_glfw.x11.display,
|
||||
_glfw.x11.root,
|
||||
0, 0,
|
||||
width, height,
|
||||
0, // Border width
|
||||
depth, // Color depth
|
||||
InputOutput,
|
||||
visual,
|
||||
wamask,
|
||||
&wa);
|
||||
|
||||
_glfwReleaseErrorHandlerX11();
|
||||
|
||||
if (!window->x11.handle)
|
||||
{
|
||||
_glfwInputErrorX11(GLFW_PLATFORM_ERROR,
|
||||
"X11: Failed to create window");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
XSaveContext(_glfw.x11.display,
|
||||
window->x11.handle,
|
||||
_glfw.x11.context,
|
||||
(XPointer) window);
|
||||
_glfwInputErrorX11(GLFW_PLATFORM_ERROR,
|
||||
"X11: Failed to create window");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
XSaveContext(_glfw.x11.display,
|
||||
window->x11.handle,
|
||||
_glfw.x11.context,
|
||||
(XPointer) window);
|
||||
|
||||
if (!wndconfig->decorated)
|
||||
_glfwPlatformSetWindowDecorated(window, GLFW_FALSE);
|
||||
|
||||
|
@ -679,7 +677,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
|||
{
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char*) &states, count);
|
||||
PropModeReplace, (unsigned char*) states, count);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -784,6 +782,13 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
|||
NULL);
|
||||
}
|
||||
|
||||
if (window->x11.ic)
|
||||
{
|
||||
unsigned long filter = 0;
|
||||
if (XGetICValues(window->x11.ic, XNFilterEvents, &filter, NULL) == NULL)
|
||||
XSelectInput(_glfw.x11.display, window->x11.handle, wa.event_mask | filter);
|
||||
}
|
||||
|
||||
_glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos);
|
||||
_glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height);
|
||||
|
||||
|
@ -944,11 +949,8 @@ static void handleSelectionRequest(XEvent* event)
|
|||
{
|
||||
const XSelectionRequestEvent* request = &event->xselectionrequest;
|
||||
|
||||
XEvent reply;
|
||||
memset(&reply, 0, sizeof(reply));
|
||||
|
||||
XEvent reply = { SelectionNotify };
|
||||
reply.xselection.property = writeTargetToProperty(request);
|
||||
reply.xselection.type = SelectionNotify;
|
||||
reply.xselection.display = request->display;
|
||||
reply.xselection.requestor = request->requestor;
|
||||
reply.xselection.selection = request->selection;
|
||||
|
@ -960,7 +962,6 @@ static void handleSelectionRequest(XEvent* event)
|
|||
|
||||
static const char* getSelectionString(Atom selection)
|
||||
{
|
||||
size_t i;
|
||||
char** selectionString = NULL;
|
||||
const Atom targets[] = { _glfw.x11.UTF8_STRING, XA_STRING };
|
||||
const size_t targetCount = sizeof(targets) / sizeof(targets[0]);
|
||||
|
@ -981,7 +982,7 @@ static const char* getSelectionString(Atom selection)
|
|||
free(*selectionString);
|
||||
*selectionString = NULL;
|
||||
|
||||
for (i = 0; i < targetCount; i++)
|
||||
for (size_t i = 0; i < targetCount; i++)
|
||||
{
|
||||
char* data;
|
||||
Atom actualType;
|
||||
|
@ -1165,7 +1166,6 @@ static void releaseMonitor(_GLFWwindow* window)
|
|||
//
|
||||
static void processEvent(XEvent *event)
|
||||
{
|
||||
_GLFWwindow* window = NULL;
|
||||
int keycode = 0;
|
||||
Bool filtered = False;
|
||||
|
||||
|
@ -1186,6 +1186,18 @@ static void processEvent(XEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
if (_glfw.x11.xkb.available)
|
||||
{
|
||||
if (event->type == _glfw.x11.xkb.eventBase + XkbEventCode)
|
||||
{
|
||||
if (((XkbEvent*) event)->any.xkb_type == XkbStateNotify &&
|
||||
(((XkbEvent*) event)->state.changed & XkbGroupStateMask))
|
||||
{
|
||||
_glfw.x11.xkb.group = ((XkbEvent*) event)->state.group;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event->type == GenericEvent)
|
||||
{
|
||||
if (_glfw.x11.xi.available)
|
||||
|
@ -1235,6 +1247,7 @@ static void processEvent(XEvent *event)
|
|||
return;
|
||||
}
|
||||
|
||||
_GLFWwindow* window = NULL;
|
||||
if (XFindContext(_glfw.x11.display,
|
||||
event->xany.window,
|
||||
_glfw.x11.context,
|
||||
|
@ -1246,6 +1259,12 @@ static void processEvent(XEvent *event)
|
|||
|
||||
switch (event->type)
|
||||
{
|
||||
case ReparentNotify:
|
||||
{
|
||||
window->x11.parent = event->xreparent.parent;
|
||||
return;
|
||||
}
|
||||
|
||||
case KeyPress:
|
||||
{
|
||||
const int key = translateKey(keycode);
|
||||
|
@ -1530,18 +1549,28 @@ static void processEvent(XEvent *event)
|
|||
window->x11.height = event->xconfigure.height;
|
||||
}
|
||||
|
||||
if (event->xconfigure.x != window->x11.xpos ||
|
||||
event->xconfigure.y != window->x11.ypos)
|
||||
{
|
||||
if (window->x11.overrideRedirect || event->xany.send_event)
|
||||
{
|
||||
_glfwInputWindowPos(window,
|
||||
event->xconfigure.x,
|
||||
event->xconfigure.y);
|
||||
int xpos = event->xconfigure.x;
|
||||
int ypos = event->xconfigure.y;
|
||||
|
||||
window->x11.xpos = event->xconfigure.x;
|
||||
window->x11.ypos = event->xconfigure.y;
|
||||
}
|
||||
// NOTE: ConfigureNotify events from the server are in local
|
||||
// coordinates, so if we are reparented we need to translate
|
||||
// the position into root (screen) coordinates
|
||||
if (!event->xany.send_event && window->x11.parent != _glfw.x11.root)
|
||||
{
|
||||
Window dummy;
|
||||
XTranslateCoordinates(_glfw.x11.display,
|
||||
window->x11.parent,
|
||||
_glfw.x11.root,
|
||||
xpos, ypos,
|
||||
&xpos, &ypos,
|
||||
&dummy);
|
||||
}
|
||||
|
||||
if (xpos != window->x11.xpos || ypos != window->x11.ypos)
|
||||
{
|
||||
_glfwInputWindowPos(window, xpos, ypos);
|
||||
window->x11.xpos = xpos;
|
||||
window->x11.ypos = ypos;
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -1646,10 +1675,7 @@ static void processEvent(XEvent *event)
|
|||
}
|
||||
else if (_glfw.x11.xdnd.version >= 2)
|
||||
{
|
||||
XEvent reply;
|
||||
memset(&reply, 0, sizeof(reply));
|
||||
|
||||
reply.type = ClientMessage;
|
||||
XEvent reply = { ClientMessage };
|
||||
reply.xclient.window = _glfw.x11.xdnd.source;
|
||||
reply.xclient.message_type = _glfw.x11.XdndFinished;
|
||||
reply.xclient.format = 32;
|
||||
|
@ -1682,10 +1708,7 @@ static void processEvent(XEvent *event)
|
|||
|
||||
_glfwInputCursorPos(window, xpos, ypos);
|
||||
|
||||
XEvent reply;
|
||||
memset(&reply, 0, sizeof(reply));
|
||||
|
||||
reply.type = ClientMessage;
|
||||
XEvent reply = { ClientMessage };
|
||||
reply.xclient.window = _glfw.x11.xdnd.source;
|
||||
reply.xclient.message_type = _glfw.x11.XdndStatus;
|
||||
reply.xclient.format = 32;
|
||||
|
@ -1738,10 +1761,7 @@ static void processEvent(XEvent *event)
|
|||
|
||||
if (_glfw.x11.xdnd.version >= 2)
|
||||
{
|
||||
XEvent reply;
|
||||
memset(&reply, 0, sizeof(reply));
|
||||
|
||||
reply.type = ClientMessage;
|
||||
XEvent reply = { ClientMessage };
|
||||
reply.xclient.window = _glfw.x11.xdnd.source;
|
||||
reply.xclient.message_type = _glfw.x11.XdndFinished;
|
||||
reply.xclient.format = 32;
|
||||
|
@ -1760,9 +1780,6 @@ static void processEvent(XEvent *event)
|
|||
|
||||
case FocusIn:
|
||||
{
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
disableCursor(window);
|
||||
|
||||
if (event->xfocus.mode == NotifyGrab ||
|
||||
event->xfocus.mode == NotifyUngrab)
|
||||
{
|
||||
|
@ -1771,6 +1788,9 @@ static void processEvent(XEvent *event)
|
|||
return;
|
||||
}
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
disableCursor(window);
|
||||
|
||||
if (window->x11.ic)
|
||||
XSetICFocus(window->x11.ic);
|
||||
|
||||
|
@ -1780,9 +1800,6 @@ static void processEvent(XEvent *event)
|
|||
|
||||
case FocusOut:
|
||||
{
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
enableCursor(window);
|
||||
|
||||
if (event->xfocus.mode == NotifyGrab ||
|
||||
event->xfocus.mode == NotifyUngrab)
|
||||
{
|
||||
|
@ -1791,6 +1808,9 @@ static void processEvent(XEvent *event)
|
|||
return;
|
||||
}
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
enableCursor(window);
|
||||
|
||||
if (window->x11.ic)
|
||||
XUnsetICFocus(window->x11.ic);
|
||||
|
||||
|
@ -2338,18 +2358,67 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|||
|
||||
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
|
||||
{
|
||||
if (_glfw.x11.NET_WM_STATE &&
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT &&
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ)
|
||||
if (!_glfw.x11.NET_WM_STATE ||
|
||||
!_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT ||
|
||||
!_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_glfwPlatformWindowVisible(window))
|
||||
{
|
||||
sendEventToWM(window,
|
||||
_glfw.x11.NET_WM_STATE,
|
||||
_NET_WM_STATE_ADD,
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT,
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ,
|
||||
1, 0);
|
||||
XFlush(_glfw.x11.display);
|
||||
_glfw.x11.NET_WM_STATE,
|
||||
_NET_WM_STATE_ADD,
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT,
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ,
|
||||
1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Atom* states = NULL;
|
||||
unsigned long count =
|
||||
_glfwGetWindowPropertyX11(window->x11.handle,
|
||||
_glfw.x11.NET_WM_STATE,
|
||||
XA_ATOM,
|
||||
(unsigned char**) &states);
|
||||
|
||||
// NOTE: We don't check for failure as this property may not exist yet
|
||||
// and that's fine (and we'll create it implicitly with append)
|
||||
|
||||
Atom missing[2] =
|
||||
{
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT,
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ
|
||||
};
|
||||
unsigned long missingCount = 2;
|
||||
|
||||
for (unsigned long i = 0; i < count; i++)
|
||||
{
|
||||
for (unsigned long j = 0; j < missingCount; j++)
|
||||
{
|
||||
if (states[i] == missing[j])
|
||||
{
|
||||
missing[j] = missing[missingCount - 1];
|
||||
missingCount--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (states)
|
||||
XFree(states);
|
||||
|
||||
if (!missingCount)
|
||||
return;
|
||||
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
||||
PropModeAppend,
|
||||
(unsigned char*) missing,
|
||||
missingCount);
|
||||
}
|
||||
|
||||
XFlush(_glfw.x11.display);
|
||||
}
|
||||
|
||||
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
||||
|
@ -2369,6 +2438,9 @@ void _glfwPlatformHideWindow(_GLFWwindow* window)
|
|||
|
||||
void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
|
||||
{
|
||||
if (!_glfw.x11.NET_WM_STATE || !_glfw.x11.NET_WM_STATE_DEMANDS_ATTENTION)
|
||||
return;
|
||||
|
||||
sendEventToWM(window,
|
||||
_glfw.x11.NET_WM_STATE,
|
||||
_NET_WM_STATE_ADD,
|
||||
|
@ -2380,7 +2452,7 @@ void _glfwPlatformFocusWindow(_GLFWwindow* window)
|
|||
{
|
||||
if (_glfw.x11.NET_ACTIVE_WINDOW)
|
||||
sendEventToWM(window, _glfw.x11.NET_ACTIVE_WINDOW, 1, 0, 0, 0, 0);
|
||||
else
|
||||
else if (_glfwPlatformWindowVisible(window))
|
||||
{
|
||||
XRaiseWindow(_glfw.x11.display, window->x11.handle);
|
||||
XSetInputFocus(_glfw.x11.display, window->x11.handle,
|
||||
|
@ -2538,33 +2610,24 @@ void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
|
|||
|
||||
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
|
||||
{
|
||||
if (enabled)
|
||||
struct
|
||||
{
|
||||
XDeleteProperty(_glfw.x11.display,
|
||||
window->x11.handle,
|
||||
_glfw.x11.MOTIF_WM_HINTS);
|
||||
}
|
||||
else
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned long functions;
|
||||
unsigned long decorations;
|
||||
long input_mode;
|
||||
unsigned long status;
|
||||
} hints;
|
||||
unsigned long flags;
|
||||
unsigned long functions;
|
||||
unsigned long decorations;
|
||||
long input_mode;
|
||||
unsigned long status;
|
||||
} hints = {0};
|
||||
|
||||
hints.flags = 2; // Set decorations
|
||||
hints.decorations = 0; // No decorations
|
||||
hints.flags = MWM_HINTS_DECORATIONS;
|
||||
hints.decorations = enabled ? MWM_DECOR_ALL : 0;
|
||||
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.MOTIF_WM_HINTS,
|
||||
_glfw.x11.MOTIF_WM_HINTS, 32,
|
||||
PropModeReplace,
|
||||
(unsigned char*) &hints,
|
||||
sizeof(hints) / sizeof(long));
|
||||
}
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.MOTIF_WM_HINTS,
|
||||
_glfw.x11.MOTIF_WM_HINTS, 32,
|
||||
PropModeReplace,
|
||||
(unsigned char*) &hints,
|
||||
sizeof(hints) / sizeof(long));
|
||||
}
|
||||
|
||||
void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
||||
|
@ -2574,7 +2637,7 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
|||
|
||||
if (_glfwPlatformWindowVisible(window))
|
||||
{
|
||||
const Atom action = enabled ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
|
||||
const long action = enabled ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
|
||||
sendEventToWM(window,
|
||||
_glfw.x11.NET_WM_STATE,
|
||||
action,
|
||||
|
@ -2583,15 +2646,16 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
|||
}
|
||||
else
|
||||
{
|
||||
Atom* states;
|
||||
Atom* states = NULL;
|
||||
unsigned long i, count;
|
||||
|
||||
count = _glfwGetWindowPropertyX11(window->x11.handle,
|
||||
_glfw.x11.NET_WM_STATE,
|
||||
XA_ATOM,
|
||||
(unsigned char**) &states);
|
||||
if (!states)
|
||||
return;
|
||||
|
||||
// NOTE: We don't check for failure as this property may not exist yet
|
||||
// and that's fine (and we'll create it implicitly with append)
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
|
@ -2601,32 +2665,36 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
|||
break;
|
||||
}
|
||||
|
||||
if (i == count)
|
||||
{
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
||||
PropModeAppend,
|
||||
(unsigned char*) &_glfw.x11.NET_WM_STATE_ABOVE,
|
||||
1);
|
||||
}
|
||||
if (i < count)
|
||||
return;
|
||||
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
||||
PropModeAppend,
|
||||
(unsigned char*) &_glfw.x11.NET_WM_STATE_ABOVE,
|
||||
1);
|
||||
}
|
||||
else
|
||||
else if (states)
|
||||
{
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (states[i] == _glfw.x11.NET_WM_STATE_ABOVE)
|
||||
{
|
||||
states[i] = states[count - 1];
|
||||
count--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == count)
|
||||
return;
|
||||
|
||||
states[i] = states[count - 1];
|
||||
count--;
|
||||
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char*) &states, count);
|
||||
PropModeReplace, (unsigned char*) states, count);
|
||||
}
|
||||
|
||||
XFree(states);
|
||||
if (states)
|
||||
XFree(states);
|
||||
}
|
||||
|
||||
XFlush(_glfw.x11.display);
|
||||
|
@ -2737,10 +2805,7 @@ void _glfwPlatformWaitEventsTimeout(double timeout)
|
|||
|
||||
void _glfwPlatformPostEmptyEvent(void)
|
||||
{
|
||||
XEvent event;
|
||||
|
||||
memset(&event, 0, sizeof(event));
|
||||
event.type = ClientMessage;
|
||||
XEvent event = { ClientMessage };
|
||||
event.xclient.window = _glfw.x11.helperWindowHandle;
|
||||
event.xclient.format = 32; // Data is 32-bit longs
|
||||
event.xclient.message_type = _glfw.x11.NULL_;
|
||||
|
@ -2797,7 +2862,16 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||
if (!_glfw.x11.xkb.available)
|
||||
return NULL;
|
||||
|
||||
const KeySym keysym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, 0, 0);
|
||||
if (scancode < 0 || scancode > 0xff ||
|
||||
_glfw.x11.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const int key = _glfw.x11.keycodes[scancode];
|
||||
const KeySym keysym = XkbKeycodeToKeysym(_glfw.x11.display,
|
||||
scancode, _glfw.x11.xkb.group, 0);
|
||||
if (keysym == NoSymbol)
|
||||
return NULL;
|
||||
|
||||
|
@ -2805,12 +2879,12 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||
if (ch == -1)
|
||||
return NULL;
|
||||
|
||||
const size_t count = encodeUTF8(_glfw.x11.keyName, (unsigned int) ch);
|
||||
const size_t count = encodeUTF8(_glfw.x11.keynames[key], (unsigned int) ch);
|
||||
if (count == 0)
|
||||
return NULL;
|
||||
|
||||
_glfw.x11.keyName[count] = '\0';
|
||||
return _glfw.x11.keyName;
|
||||
_glfw.x11.keynames[key][count] = '\0';
|
||||
return _glfw.x11.keynames[key];
|
||||
}
|
||||
|
||||
int _glfwPlatformGetKeyScancode(int key)
|
||||
|
@ -2831,29 +2905,76 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
|||
|
||||
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
||||
{
|
||||
int native = 0;
|
||||
if (_glfw.x11.xcursor.handle)
|
||||
{
|
||||
char* theme = XcursorGetTheme(_glfw.x11.display);
|
||||
if (theme)
|
||||
{
|
||||
const int size = XcursorGetDefaultSize(_glfw.x11.display);
|
||||
const char* name = NULL;
|
||||
|
||||
if (shape == GLFW_ARROW_CURSOR)
|
||||
native = XC_left_ptr;
|
||||
else if (shape == GLFW_IBEAM_CURSOR)
|
||||
native = XC_xterm;
|
||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||
native = XC_crosshair;
|
||||
else if (shape == GLFW_HAND_CURSOR)
|
||||
native = XC_hand2;
|
||||
else if (shape == GLFW_HRESIZE_CURSOR)
|
||||
native = XC_sb_h_double_arrow;
|
||||
else if (shape == GLFW_VRESIZE_CURSOR)
|
||||
native = XC_sb_v_double_arrow;
|
||||
else
|
||||
return GLFW_FALSE;
|
||||
if (shape == GLFW_ARROW_CURSOR)
|
||||
name = "default";
|
||||
else if (shape == GLFW_IBEAM_CURSOR)
|
||||
name = "text";
|
||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||
name = "crosshair";
|
||||
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||
name = "pointer";
|
||||
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||
name = "ew-resize";
|
||||
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||
name = "ns-resize";
|
||||
else if (shape == GLFW_RESIZE_NWSE_CURSOR)
|
||||
name = "nwse-resize";
|
||||
else if (shape == GLFW_RESIZE_NESW_CURSOR)
|
||||
name = "nesw-resize";
|
||||
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||
name = "all-scroll";
|
||||
else if (shape == GLFW_NOT_ALLOWED_CURSOR)
|
||||
name = "not-allowed";
|
||||
|
||||
XcursorImage* image = XcursorLibraryLoadImage(name, theme, size);
|
||||
if (image)
|
||||
{
|
||||
cursor->x11.handle = XcursorImageLoadCursor(_glfw.x11.display, image);
|
||||
XcursorImageDestroy(image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cursor->x11.handle = XCreateFontCursor(_glfw.x11.display, native);
|
||||
if (!cursor->x11.handle)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"X11: Failed to create standard cursor");
|
||||
return GLFW_FALSE;
|
||||
unsigned int native = 0;
|
||||
|
||||
if (shape == GLFW_ARROW_CURSOR)
|
||||
native = XC_left_ptr;
|
||||
else if (shape == GLFW_IBEAM_CURSOR)
|
||||
native = XC_xterm;
|
||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||
native = XC_crosshair;
|
||||
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||
native = XC_hand2;
|
||||
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||
native = XC_sb_h_double_arrow;
|
||||
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||
native = XC_sb_v_double_arrow;
|
||||
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||
native = XC_fleur;
|
||||
else
|
||||
{
|
||||
_glfwInputError(GLFW_CURSOR_UNAVAILABLE,
|
||||
"X11: Standard cursor shape unavailable");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
cursor->x11.handle = XCreateFontCursor(_glfw.x11.display, native);
|
||||
if (!cursor->x11.handle)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"X11: Failed to create standard cursor");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return GLFW_TRUE;
|
||||
|
|
4
raylib/external/glfw/src/xkb_unicode.c
vendored
4
raylib/external/glfw/src/xkb_unicode.c
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 X11 - www.glfw.org
|
||||
// GLFW 3.4 X11 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
2
raylib/external/glfw/src/xkb_unicode.h
vendored
2
raylib/external/glfw/src/xkb_unicode.h
vendored
|
@ -1,5 +1,5 @@
|
|||
//========================================================================
|
||||
// GLFW 3.3 Linux - www.glfw.org
|
||||
// GLFW 3.4 Linux - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue