1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-22 10:18:51 -05:00

Add conditional compilation for platform units

This is a step towards being able to compile GLFW manually without
needing to duplicate a lot of platform- or OS-specific logic.
This commit is contained in:
Camilla Löwy 2021-11-09 19:44:00 +01:00
parent 8a72918bcd
commit c812b9d87c
34 changed files with 167 additions and 25 deletions

View File

@ -243,6 +243,7 @@ video tutorials.
- Torsten Walluhn
- Patrick Walton
- Xo Wang
- Andre Weissflog
- Jay Weisskopf
- Frank Wille
- Andy Williams

View File

@ -27,6 +27,9 @@
//========================================================================
#include "internal.h"
#if defined(_GLFW_COCOA)
#include <sys/param.h> // For MAXPATHLEN
// Needed for _NSGetProgname
@ -690,3 +693,5 @@ void _glfwTerminateCocoa(void)
} // autoreleasepool
}
#endif // _GLFW_COCOA

View File

@ -31,8 +31,6 @@
#define GLFW_COCOA_JOYSTICK_STATE _GLFWjoystickNS ns;
#define GLFW_COCOA_LIBRARY_JOYSTICK_STATE
#define GLFW_BUILD_COCOA_MAPPINGS
// Cocoa-specific per-joystick data
//
typedef struct _GLFWjoystickNS

View File

@ -29,6 +29,8 @@
#include "internal.h"
#if defined(_GLFW_COCOA)
#include <unistd.h>
#include <ctype.h>
#include <string.h>
@ -476,3 +478,5 @@ void _glfwUpdateGamepadGUIDCocoa(char* guid)
}
}
#endif // _GLFW_COCOA

View File

@ -29,6 +29,8 @@
#include "internal.h"
#if defined(_GLFW_COCOA)
#include <stdlib.h>
#include <limits.h>
#include <math.h>
@ -625,3 +627,5 @@ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* handle)
return monitor->ns.displayID;
}
#endif // _GLFW_COCOA

View File

@ -28,6 +28,8 @@
#include "internal.h"
#if defined(GLFW_BUILD_COCOA_TIMER)
#include <mach/mach_time.h>
@ -53,3 +55,5 @@ uint64_t _glfwPlatformGetTimerFrequency(void)
return _glfw.timer.ns.frequency;
}
#endif // GLFW_BUILD_COCOA_TIMER

View File

@ -28,6 +28,8 @@
#include "internal.h"
#if defined(_GLFW_COCOA)
#include <float.h>
#include <string.h>
@ -2047,3 +2049,5 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* handle)
return window->ns.object;
}
#endif // _GLFW_COCOA

View File

@ -29,6 +29,8 @@
#include "internal.h"
#if defined(_GLFW_X11)
#include <string.h>
#include <stdlib.h>
#include <assert.h>
@ -714,3 +716,5 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle)
return window->context.glx.window;
}
#endif // _GLFW_X11

View File

@ -29,6 +29,8 @@
#include "internal.h"
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/inotify.h>
@ -429,3 +431,5 @@ void _glfwUpdateGamepadGUIDLinux(char* guid)
{
}
#endif // GLFW_BUILD_LINUX_JOYSTICK

View File

@ -31,8 +31,6 @@
#define GLFW_LINUX_JOYSTICK_STATE _GLFWjoystickLinux linjs;
#define GLFW_LINUX_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux linjs;
#define GLFW_BUILD_LINUX_MAPPINGS
// Linux-specific joystick data
//
typedef struct _GLFWjoystickLinux

View File

@ -60,7 +60,7 @@
const char* _glfwDefaultMappings[] =
{
#if defined(GLFW_BUILD_WIN32_MAPPINGS)
#if defined(_GLFW_WIN32)
"03000000fa2d00000100000000000000,3DRUDDER,leftx:a0,lefty:a1,rightx:a5,righty:a2,platform:Windows,",
"03000000c82d00002038000000000000,8bitdo,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,",
"03000000c82d00000951000000000000,8BitDo Dogbone Modkit,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,start:b11,platform:Windows,",
@ -426,9 +426,9 @@ const char* _glfwDefaultMappings[] =
"78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
"78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
"78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
#endif // GLFW_BUILD_WIN32_MAPPINGS
#endif // _GLFW_WIN32
#if defined(GLFW_BUILD_COCOA_MAPPINGS)
#if defined(_GLFW_COCOA)
"030000008f0e00000300000009010000,2In1 USB Joystick,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:a3,start:b9,x:b3,y:b0,platform:Mac OS X,",
"03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,",
"03000000c82d00001038000000010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,",
@ -598,9 +598,9 @@ const char* _glfwDefaultMappings[] =
"03000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Mac OS X,",
"03000000120c0000100e000000010000,ZEROPLUS P4 Gamepad,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:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,",
"03000000120c0000101e000000010000,ZEROPLUS P4 Wired Gamepad,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:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,",
#endif // GLFW_BUILD_COCOA_MAPPINGS
#endif // _GLFW_COCOA
#if defined(GLFW_BUILD_LINUX_MAPPINGS)
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
"03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,",
"05000000c82d00001038000000010000,8Bitdo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,",
"05000000c82d00005106000000010000,8BitDo M30,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,start:b11,x:b3,y:b4,platform:Linux,",
@ -996,6 +996,6 @@ const char* _glfwDefaultMappings[] =
"03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,platform:Linux,",
"03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,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:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,",
"03000000120c0000101e000011010000,ZEROPLUS P4 Wired Gamepad,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:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,",
#endif // GLFW_BUILD_LINUX_MAPPINGS
#endif // GLFW_BUILD_LINUX_JOYSTICK
};

View File

@ -60,7 +60,7 @@
const char* _glfwDefaultMappings[] =
{
#if defined(GLFW_BUILD_WIN32_MAPPINGS)
#if defined(_GLFW_WIN32)
@GLFW_WIN32_MAPPINGS@
"78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
"78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
@ -69,14 +69,14 @@ const char* _glfwDefaultMappings[] =
"78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
"78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
"78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
#endif // GLFW_BUILD_WIN32_MAPPINGS
#endif // _GLFW_WIN32
#if defined(GLFW_BUILD_COCOA_MAPPINGS)
#if defined(_GLFW_COCOA)
@GLFW_COCOA_MAPPINGS@
#endif // GLFW_BUILD_COCOA_MAPPINGS
#endif // _GLFW_COCOA
#if defined(GLFW_BUILD_LINUX_MAPPINGS)
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
@GLFW_LINUX_MAPPINGS@
#endif // GLFW_BUILD_LINUX_MAPPINGS
#endif // GLFW_BUILD_LINUX_JOYSTICK
};

View File

@ -28,6 +28,8 @@
#include "internal.h"
#if defined(_GLFW_COCOA)
#include <unistd.h>
#include <math.h>
@ -374,3 +376,5 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle)
return window->context.nsgl.object;
}
#endif // _GLFW_COCOA

View File

@ -25,6 +25,18 @@
//
//========================================================================
#if defined(GLFW_BUILD_WIN32_TIMER) || \
defined(GLFW_BUILD_WIN32_MODULE) || \
defined(GLFW_BUILD_WIN32_THREAD) || \
defined(GLFW_BUILD_COCOA_TIMER) || \
defined(GLFW_BUILD_POSIX_TIMER) || \
defined(GLFW_BUILD_POSIX_MODULE) || \
defined(GLFW_BUILD_POSIX_THREAD) || \
defined(GLFW_BUILD_POSIX_POLL) || \
defined(GLFW_BUILD_LINUX_JOYSTICK)
#error "You must not define these; define zero or more _GLFW_<platform> macros instead"
#endif
#include "null_platform.h"
#if defined(_GLFW_WIN32)
@ -86,6 +98,10 @@
#endif
#if (defined(_GLFW_X11) || defined(_GLFW_WAYLAND)) && defined(__linux__)
#define GLFW_BUILD_LINUX_JOYSTICK
#endif
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
#include "linux_joystick.h"
#else
#define GLFW_LINUX_JOYSTICK_STATE
@ -141,23 +157,47 @@
GLFW_GLX_LIBRARY_CONTEXT_STATE
#if defined(_WIN32)
#define GLFW_BUILD_WIN32_THREAD
#else
#define GLFW_BUILD_POSIX_THREAD
#endif
#if defined(GLFW_BUILD_WIN32_THREAD)
#include "win32_thread.h"
#define GLFW_PLATFORM_TLS_STATE GLFW_WIN32_TLS_STATE
#define GLFW_PLATFORM_MUTEX_STATE GLFW_WIN32_MUTEX_STATE
#else
#elif defined(GLFW_BUILD_POSIX_THREAD)
#include "posix_thread.h"
#define GLFW_PLATFORM_TLS_STATE GLFW_POSIX_TLS_STATE
#define GLFW_PLATFORM_MUTEX_STATE GLFW_POSIX_MUTEX_STATE
#endif
#if defined(_WIN32)
#define GLFW_BUILD_WIN32_TIMER
#elif defined(__APPLE__)
#define GLFW_BUILD_COCOA_TIMER
#else
#define GLFW_BUILD_POSIX_TIMER
#endif
#if defined(GLFW_BUILD_WIN32_TIMER)
#include "win32_time.h"
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_WIN32_LIBRARY_TIMER_STATE
#elif defined(__APPLE__)
#elif defined(GLFW_BUILD_COCOA_TIMER)
#include "cocoa_time.h"
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_COCOA_LIBRARY_TIMER_STATE
#else
#elif defined(GLFW_BUILD_POSIX_TIMER)
#include "posix_time.h"
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_POSIX_LIBRARY_TIMER_STATE
#endif
#if defined(_WIN32)
#define GLFW_BUILD_WIN32_MODULE
#else
#define GLFW_BUILD_POSIX_MODULE
#endif
#if defined(_GLFW_WAYLAND) || defined(_GLFW_X11)
#define GLFW_BUILD_POSIX_POLL
#endif

View File

@ -28,6 +28,8 @@
#include "internal.h"
#if defined(GLFW_BUILD_POSIX_MODULE)
#include <dlfcn.h>
//////////////////////////////////////////////////////////////////////////
@ -49,3 +51,5 @@ GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name)
return dlsym(module, name);
}
#endif // GLFW_BUILD_POSIX_MODULE

View File

@ -30,6 +30,8 @@
#include "internal.h"
#if defined(GLFW_BUILD_POSIX_POLL)
#include <signal.h>
#include <time.h>
#include <errno.h>
@ -79,3 +81,5 @@ GLFWbool _glfwPollPOSIX(struct pollfd* fds, nfds_t count, double* timeout)
}
}
#endif // GLFW_BUILD_POSIX_POLL

View File

@ -29,6 +29,8 @@
#include "internal.h"
#if defined(GLFW_BUILD_POSIX_THREAD)
#include <assert.h>
#include <string.h>
@ -103,3 +105,5 @@ void _glfwPlatformUnlockMutex(_GLFWmutex* mutex)
pthread_mutex_unlock(&mutex->posix.handle);
}
#endif // GLFW_BUILD_POSIX_THREAD

View File

@ -29,6 +29,8 @@
#include "internal.h"
#if defined(GLFW_BUILD_POSIX_TIMER)
#include <unistd.h>
#include <sys/time.h>
@ -61,3 +63,5 @@ uint64_t _glfwPlatformGetTimerFrequency(void)
return _glfw.timer.posix.frequency;
}
#endif // GLFW_BUILD_POSIX_TIMER

View File

@ -29,6 +29,8 @@
#include "internal.h"
#if defined(_GLFW_WIN32)
#include <stdlib.h>
#include <assert.h>
@ -776,3 +778,5 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* handle)
return window->context.wgl.handle;
}
#endif // _GLFW_WIN32

View File

@ -29,6 +29,8 @@
#include "internal.h"
#if defined(_GLFW_WIN32)
#include <stdlib.h>
static const GUID _glfw_GUID_DEVINTERFACE_HID =
@ -725,3 +727,5 @@ void _glfwTerminateWin32(void)
freeLibraries();
}
#endif // _GLFW_WIN32

View File

@ -29,6 +29,8 @@
#include "internal.h"
#if defined(_GLFW_WIN32)
#include <stdio.h>
#include <math.h>
@ -756,3 +758,5 @@ void _glfwUpdateGamepadGUIDWin32(char* guid)
}
}
#endif // _GLFW_WIN32

View File

@ -27,8 +27,6 @@
#define GLFW_WIN32_JOYSTICK_STATE _GLFWjoystickWin32 win32;
#define GLFW_WIN32_LIBRARY_JOYSTICK_STATE
#define GLFW_BUILD_WIN32_MAPPINGS
// Joystick element (axis, button or slider)
//
typedef struct _GLFWjoyobjectWin32

View File

@ -28,6 +28,8 @@
#include "internal.h"
#if defined(GLFW_BUILD_WIN32_MODULE)
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
@ -47,3 +49,5 @@ GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name)
return (GLFWproc) GetProcAddress((HMODULE) module, name);
}
#endif // GLFW_BUILD_WIN32_MODULE

View File

@ -29,6 +29,8 @@
#include "internal.h"
#if defined(_GLFW_WIN32)
#include <stdlib.h>
#include <string.h>
#include <limits.h>
@ -545,3 +547,5 @@ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* handle)
return monitor->win32.publicDisplayName;
}
#endif // _GLFW_WIN32

View File

@ -29,6 +29,8 @@
#include "internal.h"
#if defined(GLFW_BUILD_WIN32_THREAD)
#include <assert.h>
@ -96,3 +98,5 @@ void _glfwPlatformUnlockMutex(_GLFWmutex* mutex)
LeaveCriticalSection(&mutex->win32.section);
}
#endif // GLFW_BUILD_WIN32_THREAD

View File

@ -29,6 +29,7 @@
#include "internal.h"
#if defined(GLFW_BUILD_WIN32_TIMER)
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
@ -51,3 +52,5 @@ uint64_t _glfwPlatformGetTimerFrequency(void)
return _glfw.timer.win32.frequency;
}
#endif // GLFW_BUILD_WIN32_TIMER

View File

@ -29,6 +29,8 @@
#include "internal.h"
#if defined(_GLFW_WIN32)
#include <limits.h>
#include <stdlib.h>
#include <string.h>
@ -2510,3 +2512,5 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* handle)
return window->win32.handle;
}
#endif // _GLFW_WIN32

View File

@ -28,6 +28,8 @@
#include "internal.h"
#if defined(_GLFW_WAYLAND)
#include <errno.h>
#include <limits.h>
#include <linux/input.h>
@ -392,7 +394,7 @@ GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform)
_glfwGetKeyScancodeWayland,
_glfwSetClipboardStringWayland,
_glfwGetClipboardStringWayland,
#if defined(__linux__)
#if defined(_GLFW_LINUX_JOYSTICK)
_glfwInitJoysticksLinux,
_glfwTerminateJoysticksLinux,
_glfwPollJoystickLinux,
@ -791,3 +793,5 @@ void _glfwTerminateWayland(void)
_glfw_free(_glfw.wl.clipboardString);
}
#endif // _GLFW_WAYLAND

View File

@ -28,6 +28,8 @@
#include "internal.h"
#if defined(_GLFW_WAYLAND)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -270,3 +272,5 @@ GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* handle)
return monitor->wl.output;
}
#endif // _GLFW_WAYLAND

View File

@ -30,6 +30,8 @@
#include "internal.h"
#if defined(_GLFW_WAYLAND)
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@ -2887,3 +2889,5 @@ GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* handle)
return window->wl.surface;
}
#endif // _GLFW_WAYLAND

View File

@ -29,6 +29,8 @@
#include "internal.h"
#if defined(_GLFW_X11)
#include <stdlib.h>
#include <string.h>
#include <limits.h>
@ -1182,7 +1184,7 @@ GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform)
_glfwGetKeyScancodeX11,
_glfwSetClipboardStringX11,
_glfwGetClipboardStringX11,
#if defined(__linux__)
#if defined(_GLFW_LINUX_JOYSTICK)
_glfwInitJoysticksLinux,
_glfwTerminateJoysticksLinux,
_glfwPollJoystickLinux,
@ -1652,3 +1654,5 @@ void _glfwTerminateX11(void)
}
}
#endif // _GLFW_X11

View File

@ -29,6 +29,8 @@
#include "internal.h"
#if defined(_GLFW_X11)
#include <limits.h>
#include <stdlib.h>
#include <string.h>
@ -614,3 +616,5 @@ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* handle)
return monitor->x11.output;
}
#endif // _GLFW_X11

View File

@ -29,6 +29,8 @@
#include "internal.h"
#if defined(_GLFW_X11)
#include <X11/cursorfont.h>
#include <X11/Xmd.h>
@ -86,7 +88,7 @@ static GLFWbool waitForAnyEvent(double* timeout)
{ _glfw.x11.emptyEventPipe[0], POLLIN }
};
#if defined(__linux__)
#if defined(_GLFW_LINUX_JOYSTICK)
if (_glfw.joysticksInitialized)
fds[count++] = (struct pollfd) { _glfw.linjs.inotify, POLLIN };
#endif
@ -2781,7 +2783,7 @@ void _glfwPollEventsX11(void)
{
drainEmptyEvents();
#if defined(__linux__)
#if defined(_GLFW_LINUX_JOYSTICK)
if (_glfw.joysticksInitialized)
_glfwDetectJoystickConnectionLinux();
#endif
@ -3349,3 +3351,5 @@ GLFWAPI const char* glfwGetX11SelectionString(void)
return getSelectionString(_glfw.x11.PRIMARY);
}
#endif // _GLFW_X11

View File

@ -29,6 +29,7 @@
#include "internal.h"
#if defined(_GLFW_X11) || defined(_GLFW_WAYLAND)
/*
* Marcus: This code was originally written by Markus G. Kuhn.
@ -940,3 +941,5 @@ uint32_t _glfwKeySym2Unicode(unsigned int keysym)
return GLFW_INVALID_CODEPOINT;
}
#endif // _GLFW_WAYLAND or _GLFW_X11