mirror of
https://github.com/glfw/glfw.git
synced 2025-12-19 13:41:54 +00:00
Compare commits
11 Commits
c549b83d1e
...
3dc0c977be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3dc0c977be | ||
|
|
dbadda2683 | ||
|
|
08449b7183 | ||
|
|
1ce855b0b1 | ||
|
|
ebff6606ee | ||
|
|
162896e5b9 | ||
|
|
cdcd9c194a | ||
|
|
596cabbe58 | ||
|
|
a02b287b1d | ||
|
|
7c2e8c7c5a | ||
|
|
58f2aab759 |
@ -38,11 +38,7 @@ set(GLFW_LIBRARY_TYPE "${GLFW_LIBRARY_TYPE}" CACHE STRING
|
||||
"Library type override for GLFW (SHARED, STATIC, OBJECT, or empty to follow BUILD_SHARED_LIBS)")
|
||||
|
||||
if (GLFW_LIBRARY_TYPE)
|
||||
if (GLFW_LIBRARY_TYPE STREQUAL "SHARED")
|
||||
set(GLFW_BUILD_SHARED_LIBRARY TRUE)
|
||||
else()
|
||||
set(GLFW_BUILD_SHARED_LIBRARY FALSE)
|
||||
endif()
|
||||
string(COMPARE EQUAL "${GLFW_LIBRARY_TYPE}" "SHARED" GLFW_BUILD_SHARED_LIBRARY)
|
||||
else()
|
||||
set(GLFW_BUILD_SHARED_LIBRARY ${BUILD_SHARED_LIBS})
|
||||
endif()
|
||||
|
||||
@ -162,6 +162,7 @@ video tutorials.
|
||||
- Marcel Metz
|
||||
- Liam Middlebrook
|
||||
- mightgoyardstill
|
||||
- Mihail
|
||||
- Ave Milia
|
||||
- Icyllis Milica
|
||||
- Jonathan Miller
|
||||
|
||||
@ -144,11 +144,16 @@ information on what to include when reporting a bug.
|
||||
a modal to a fallback decoration
|
||||
- [Wayland] Bugfix: The cursor position was not updated when clicking through
|
||||
from a modal to the content area
|
||||
- [Wayland] Bugfix: free modules at end of terminate function to resolve
|
||||
potential segmentation fault (#2744)
|
||||
- [Wayland] Bugfix: Confining or disabling the cursor could segfault on
|
||||
compositors without `pointer-constraints-unstable-v1`
|
||||
- [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631)
|
||||
- [X11] Bugfix: Occasional crash when an idle display awakes (#2766)
|
||||
- [X11] Bugfix: Prevent BadWindow when creating small windows with a content scale
|
||||
less than 1 (#2754)
|
||||
- [X11] Bugfix: Clamp width and height to >= 1 to prevent BadValue error and app exit
|
||||
- [Linux] Bugfix: The header for `ioctl` was only implicitly included (#2778)
|
||||
- [Null] Added Vulkan 'window' surface creation via `VK_EXT_headless_surface`
|
||||
- [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless`
|
||||
- [EGL] Allowed native access on Wayland with `GLFW_CONTEXT_CREATION_API` set to
|
||||
|
||||
@ -1180,7 +1180,7 @@ extern "C" {
|
||||
#define GLFW_WAYLAND_PREFER_LIBDECOR 0x00038001
|
||||
#define GLFW_WAYLAND_DISABLE_LIBDECOR 0x00038002
|
||||
|
||||
#define GLFW_ANY_POSITION 0x80000000
|
||||
#define GLFW_ANY_POSITION 0x7FFFFFFF
|
||||
|
||||
/*! @defgroup shapes Standard cursor shapes
|
||||
* @brief Standard system cursor shapes.
|
||||
|
||||
@ -272,7 +272,7 @@ EGLenum _glfwGetEGLPlatformCocoa(EGLint** attribs);
|
||||
EGLNativeDisplayType _glfwGetEGLNativeDisplayCocoa(void);
|
||||
EGLNativeWindowType _glfwGetEGLNativeWindowCocoa(_GLFWwindow* window);
|
||||
|
||||
void _glfwGetRequiredInstanceExtensionsCocoa(char** extensions);
|
||||
void _glfwGetRequiredInstanceExtensionsCocoa(const char** extensions);
|
||||
GLFWbool _glfwGetPhysicalDevicePresentationSupportCocoa(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
|
||||
VkResult _glfwCreateWindowSurfaceCocoa(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
||||
|
||||
|
||||
@ -1922,7 +1922,7 @@ EGLNativeWindowType _glfwGetEGLNativeWindowCocoa(_GLFWwindow* window)
|
||||
return window->ns.layer;
|
||||
}
|
||||
|
||||
void _glfwGetRequiredInstanceExtensionsCocoa(char** extensions)
|
||||
void _glfwGetRequiredInstanceExtensionsCocoa(const char** extensions)
|
||||
{
|
||||
if (_glfw.vk.KHR_surface && _glfw.vk.EXT_metal_surface)
|
||||
{
|
||||
|
||||
@ -555,7 +555,8 @@ void _glfwTerminateEGL(void)
|
||||
_glfw.egl.display = EGL_NO_DISPLAY;
|
||||
}
|
||||
|
||||
if (_glfw.egl.handle)
|
||||
// Free modules only after all wayland termination functions are called
|
||||
if (_glfw.egl.handle && _glfw.platform.platformID != GLFW_PLATFORM_WAYLAND)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.egl.handle);
|
||||
_glfw.egl.handle = NULL;
|
||||
|
||||
@ -1289,7 +1289,7 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string)
|
||||
const size_t length = strcspn(c, "\r\n");
|
||||
if (length < sizeof(line))
|
||||
{
|
||||
_GLFWmapping mapping = {{0}};
|
||||
_GLFWmapping mapping = { .name = {0} };
|
||||
|
||||
memcpy(line, c, length);
|
||||
line[length] = '\0';
|
||||
|
||||
@ -755,7 +755,7 @@ struct _GLFWplatform
|
||||
EGLNativeDisplayType (*getEGLNativeDisplay)(void);
|
||||
EGLNativeWindowType (*getEGLNativeWindow)(_GLFWwindow*);
|
||||
// vulkan
|
||||
void (*getRequiredInstanceExtensions)(char**);
|
||||
void (*getRequiredInstanceExtensions)(const char**);
|
||||
GLFWbool (*getPhysicalDevicePresentationSupport)(VkInstance,VkPhysicalDevice,uint32_t);
|
||||
VkResult (*createWindowSurface)(VkInstance,_GLFWwindow*,const VkAllocationCallbacks*,VkSurfaceKHR*);
|
||||
};
|
||||
@ -862,7 +862,7 @@ struct _GLFWlibrary
|
||||
struct {
|
||||
GLFWbool available;
|
||||
void* handle;
|
||||
char* extensions[2];
|
||||
const char* extensions[2];
|
||||
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
|
||||
GLFWbool KHR_surface;
|
||||
GLFWbool KHR_win32_surface;
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/inotify.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
|
||||
@ -274,7 +274,7 @@ EGLenum _glfwGetEGLPlatformNull(EGLint** attribs);
|
||||
EGLNativeDisplayType _glfwGetEGLNativeDisplayNull(void);
|
||||
EGLNativeWindowType _glfwGetEGLNativeWindowNull(_GLFWwindow* window);
|
||||
|
||||
void _glfwGetRequiredInstanceExtensionsNull(char** extensions);
|
||||
void _glfwGetRequiredInstanceExtensionsNull(const char** extensions);
|
||||
GLFWbool _glfwGetPhysicalDevicePresentationSupportNull(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
|
||||
VkResult _glfwCreateWindowSurfaceNull(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
||||
|
||||
|
||||
@ -701,7 +701,7 @@ int _glfwGetKeyScancodeNull(int key)
|
||||
return _glfw.null.scancodes[key];
|
||||
}
|
||||
|
||||
void _glfwGetRequiredInstanceExtensionsNull(char** extensions)
|
||||
void _glfwGetRequiredInstanceExtensionsNull(const char** extensions)
|
||||
{
|
||||
if (!_glfw.vk.KHR_surface || !_glfw.vk.EXT_headless_surface)
|
||||
return;
|
||||
|
||||
@ -44,10 +44,17 @@ void _glfwPlatformFreeModule(void* module)
|
||||
dlclose(module);
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name)
|
||||
{
|
||||
return dlsym(module, name);
|
||||
return (GLFWproc)dlsym(module, name);
|
||||
}
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // GLFW_BUILD_POSIX_MODULE
|
||||
|
||||
|
||||
@ -150,7 +150,7 @@ GLFWbool _glfwInitVulkan(int mode)
|
||||
|
||||
_glfw.vk.available = GLFW_TRUE;
|
||||
|
||||
_glfw.platform.getRequiredInstanceExtensions(_glfw.vk.extensions);
|
||||
_glfw.platform.getRequiredInstanceExtensions((const char **)_glfw.vk.extensions);
|
||||
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
@ -528,7 +528,8 @@ void _glfwUpdateKeyNamesWin32(void)
|
||||
|
||||
if (key >= GLFW_KEY_KP_0 && key <= GLFW_KEY_KP_ADD)
|
||||
{
|
||||
const UINT vks[] = {
|
||||
const UINT vks[] =
|
||||
{
|
||||
VK_NUMPAD0, VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3,
|
||||
VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7,
|
||||
VK_NUMPAD8, VK_NUMPAD9, VK_DECIMAL, VK_DIVIDE,
|
||||
|
||||
@ -540,7 +540,7 @@ EGLenum _glfwGetEGLPlatformWin32(EGLint** attribs);
|
||||
EGLNativeDisplayType _glfwGetEGLNativeDisplayWin32(void);
|
||||
EGLNativeWindowType _glfwGetEGLNativeWindowWin32(_GLFWwindow* window);
|
||||
|
||||
void _glfwGetRequiredInstanceExtensionsWin32(char** extensions);
|
||||
void _glfwGetRequiredInstanceExtensionsWin32(const char** extensions);
|
||||
GLFWbool _glfwGetPhysicalDevicePresentationSupportWin32(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
|
||||
VkResult _glfwCreateWindowSurfaceWin32(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
||||
|
||||
|
||||
@ -2501,7 +2501,7 @@ EGLNativeWindowType _glfwGetEGLNativeWindowWin32(_GLFWwindow* window)
|
||||
return window->win32.handle;
|
||||
}
|
||||
|
||||
void _glfwGetRequiredInstanceExtensionsWin32(char** extensions)
|
||||
void _glfwGetRequiredInstanceExtensionsWin32(const char** extensions)
|
||||
{
|
||||
if (!_glfw.vk.KHR_surface || !_glfw.vk.KHR_win32_surface)
|
||||
return;
|
||||
|
||||
@ -243,7 +243,7 @@ void libdecorHandleError(struct libdecor* context,
|
||||
|
||||
static const struct libdecor_interface libdecorInterface =
|
||||
{
|
||||
libdecorHandleError
|
||||
.error = libdecorHandleError
|
||||
};
|
||||
|
||||
static void libdecorReadyCallback(void* userData,
|
||||
@ -907,18 +907,6 @@ void _glfwTerminateWayland(void)
|
||||
libdecor_unref(_glfw.wl.libdecor.context);
|
||||
}
|
||||
|
||||
if (_glfw.wl.libdecor.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.libdecor.handle);
|
||||
_glfw.wl.libdecor.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.egl.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.egl.handle);
|
||||
_glfw.wl.egl.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.xkb.composeState)
|
||||
xkb_compose_state_unref(_glfw.wl.xkb.composeState);
|
||||
if (_glfw.wl.xkb.keymap)
|
||||
@ -927,21 +915,11 @@ void _glfwTerminateWayland(void)
|
||||
xkb_state_unref(_glfw.wl.xkb.state);
|
||||
if (_glfw.wl.xkb.context)
|
||||
xkb_context_unref(_glfw.wl.xkb.context);
|
||||
if (_glfw.wl.xkb.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.xkb.handle);
|
||||
_glfw.wl.xkb.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.cursorTheme)
|
||||
wl_cursor_theme_destroy(_glfw.wl.cursorTheme);
|
||||
if (_glfw.wl.cursorThemeHiDPI)
|
||||
wl_cursor_theme_destroy(_glfw.wl.cursorThemeHiDPI);
|
||||
if (_glfw.wl.cursor.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.cursor.handle);
|
||||
_glfw.wl.cursor.handle = NULL;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < _glfw.wl.offerCount; i++)
|
||||
wl_data_offer_destroy(_glfw.wl.offers[i].offer);
|
||||
@ -1001,6 +979,38 @@ void _glfwTerminateWayland(void)
|
||||
if (_glfw.wl.cursorTimerfd >= 0)
|
||||
close(_glfw.wl.cursorTimerfd);
|
||||
|
||||
// Free modules only after all Wayland termination functions are called
|
||||
|
||||
if (_glfw.egl.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.egl.handle);
|
||||
_glfw.egl.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.libdecor.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.libdecor.handle);
|
||||
_glfw.wl.libdecor.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.egl.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.egl.handle);
|
||||
_glfw.wl.egl.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.xkb.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.xkb.handle);
|
||||
_glfw.wl.xkb.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.cursor.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.cursor.handle);
|
||||
_glfw.wl.cursor.handle = NULL;
|
||||
}
|
||||
|
||||
_glfw_free(_glfw.wl.clipboardString);
|
||||
}
|
||||
|
||||
|
||||
@ -136,18 +136,22 @@ struct wl_output;
|
||||
#define GLFW_WAYLAND_MONITOR_STATE _GLFWmonitorWayland wl;
|
||||
#define GLFW_WAYLAND_CURSOR_STATE _GLFWcursorWayland wl;
|
||||
|
||||
struct wl_cursor_image {
|
||||
struct wl_cursor_image
|
||||
{
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t hotspot_x;
|
||||
uint32_t hotspot_y;
|
||||
uint32_t delay;
|
||||
};
|
||||
struct wl_cursor {
|
||||
|
||||
struct wl_cursor
|
||||
{
|
||||
unsigned int image_count;
|
||||
struct wl_cursor_image** images;
|
||||
char* name;
|
||||
};
|
||||
|
||||
typedef struct wl_cursor_theme* (* PFN_wl_cursor_theme_load)(const char*, int, struct wl_shm*);
|
||||
typedef void (* PFN_wl_cursor_theme_destroy)(struct wl_cursor_theme*);
|
||||
typedef struct wl_cursor* (* PFN_wl_cursor_theme_get_cursor)(struct wl_cursor_theme*, const char*);
|
||||
@ -674,7 +678,7 @@ EGLenum _glfwGetEGLPlatformWayland(EGLint** attribs);
|
||||
EGLNativeDisplayType _glfwGetEGLNativeDisplayWayland(void);
|
||||
EGLNativeWindowType _glfwGetEGLNativeWindowWayland(_GLFWwindow* window);
|
||||
|
||||
void _glfwGetRequiredInstanceExtensionsWayland(char** extensions);
|
||||
void _glfwGetRequiredInstanceExtensionsWayland(const char** extensions);
|
||||
GLFWbool _glfwGetPhysicalDevicePresentationSupportWayland(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
|
||||
VkResult _glfwCreateWindowSurfaceWayland(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
||||
|
||||
|
||||
@ -620,8 +620,8 @@ static void surfaceHandleLeave(void* userData,
|
||||
|
||||
static const struct wl_surface_listener surfaceListener =
|
||||
{
|
||||
surfaceHandleEnter,
|
||||
surfaceHandleLeave
|
||||
.enter = surfaceHandleEnter,
|
||||
.leave = surfaceHandleLeave
|
||||
};
|
||||
|
||||
static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable)
|
||||
@ -762,8 +762,8 @@ static void xdgToplevelHandleClose(void* userData,
|
||||
|
||||
static const struct xdg_toplevel_listener xdgToplevelListener =
|
||||
{
|
||||
xdgToplevelHandleConfigure,
|
||||
xdgToplevelHandleClose
|
||||
.configure = xdgToplevelHandleConfigure,
|
||||
.close = xdgToplevelHandleClose
|
||||
};
|
||||
|
||||
static void xdgSurfaceHandleConfigure(void* userData,
|
||||
@ -937,10 +937,10 @@ void libdecorFrameHandleDismissPopup(struct libdecor_frame* frame,
|
||||
|
||||
static const struct libdecor_frame_interface libdecorFrameInterface =
|
||||
{
|
||||
libdecorFrameHandleConfigure,
|
||||
libdecorFrameHandleClose,
|
||||
libdecorFrameHandleCommit,
|
||||
libdecorFrameHandleDismissPopup
|
||||
.configure = libdecorFrameHandleConfigure,
|
||||
.close = libdecorFrameHandleClose,
|
||||
.commit = libdecorFrameHandleCommit,
|
||||
.dismiss_popup = libdecorFrameHandleDismissPopup
|
||||
};
|
||||
|
||||
static GLFWbool createLibdecorFrame(_GLFWwindow* window)
|
||||
@ -1290,7 +1290,7 @@ static GLFWbool flushDisplay(void)
|
||||
if (errno != EAGAIN)
|
||||
return GLFW_FALSE;
|
||||
|
||||
struct pollfd fd = { wl_display_get_fd(_glfw.wl.display), POLLOUT };
|
||||
struct pollfd fd = { .fd = wl_display_get_fd(_glfw.wl.display), POLLOUT };
|
||||
|
||||
while (poll(&fd, 1, -1) == -1)
|
||||
{
|
||||
@ -1413,7 +1413,7 @@ static void handleEvents(double* timeout)
|
||||
|
||||
if (read(_glfw.wl.keyRepeatTimerfd, &repeats, sizeof(repeats)) == 8)
|
||||
{
|
||||
if(_glfw.wl.keyboardFocus)
|
||||
if (_glfw.wl.keyboardFocus)
|
||||
{
|
||||
for (uint64_t i = 0; i < repeats; i++)
|
||||
{
|
||||
@ -1664,11 +1664,11 @@ static void pointerHandleAxis(void* userData,
|
||||
|
||||
static const struct wl_pointer_listener pointerListener =
|
||||
{
|
||||
pointerHandleEnter,
|
||||
pointerHandleLeave,
|
||||
pointerHandleMotion,
|
||||
pointerHandleButton,
|
||||
pointerHandleAxis,
|
||||
.enter = pointerHandleEnter,
|
||||
.leave = pointerHandleLeave,
|
||||
.motion = pointerHandleMotion,
|
||||
.button = pointerHandleButton,
|
||||
.axis = pointerHandleAxis,
|
||||
};
|
||||
|
||||
static void keyboardHandleKeymap(void* userData,
|
||||
@ -1692,7 +1692,8 @@ static void keyboardHandleKeymap(void* userData,
|
||||
}
|
||||
|
||||
mapStr = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
|
||||
if (mapStr == MAP_FAILED) {
|
||||
if (mapStr == MAP_FAILED)
|
||||
{
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
@ -1838,7 +1839,9 @@ static void keyboardHandleKey(void* userData,
|
||||
timer.it_value.tv_nsec = (_glfw.wl.keyRepeatDelay % 1000) * 1000000;
|
||||
timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL);
|
||||
}
|
||||
} else if (scancode == _glfw.wl.keyRepeatScancode) {
|
||||
}
|
||||
else if (scancode == _glfw.wl.keyRepeatScancode)
|
||||
{
|
||||
timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL);
|
||||
}
|
||||
|
||||
@ -1977,7 +1980,7 @@ static void dataOfferHandleOffer(void* userData,
|
||||
|
||||
static const struct wl_data_offer_listener dataOfferListener =
|
||||
{
|
||||
dataOfferHandleOffer
|
||||
.offer = dataOfferHandleOffer
|
||||
};
|
||||
|
||||
static void dataDeviceHandleDataOffer(void* userData,
|
||||
@ -1996,7 +1999,7 @@ static void dataDeviceHandleDataOffer(void* userData,
|
||||
_glfw.wl.offers = offers;
|
||||
_glfw.wl.offerCount++;
|
||||
|
||||
_glfw.wl.offers[_glfw.wl.offerCount - 1] = (_GLFWofferWayland) { offer };
|
||||
_glfw.wl.offers[_glfw.wl.offerCount - 1] = (_GLFWofferWayland) { .offer = offer };
|
||||
wl_data_offer_add_listener(offer, &dataOfferListener, NULL);
|
||||
}
|
||||
|
||||
@ -2974,10 +2977,16 @@ static void lockPointer(_GLFWwindow* window)
|
||||
if (!_glfw.wl.relativePointerManager)
|
||||
{
|
||||
_glfwInputError(GLFW_FEATURE_UNAVAILABLE,
|
||||
"Wayland: The compositor does not support pointer locking");
|
||||
"Wayland: The compositor does not support relative pointer motion");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_glfw.wl.pointerConstraints)
|
||||
{
|
||||
_glfwInputError(GLFW_FEATURE_UNAVAILABLE,
|
||||
"Wayland: The compositor does not support locking the pointer");
|
||||
}
|
||||
|
||||
window->wl.relativePointer =
|
||||
zwp_relative_pointer_manager_v1_get_relative_pointer(
|
||||
_glfw.wl.relativePointerManager,
|
||||
@ -3025,6 +3034,12 @@ static const struct zwp_confined_pointer_v1_listener confinedPointerListener =
|
||||
|
||||
static void confinePointer(_GLFWwindow* window)
|
||||
{
|
||||
if (!_glfw.wl.pointerConstraints)
|
||||
{
|
||||
_glfwInputError(GLFW_FEATURE_UNAVAILABLE,
|
||||
"Wayland: The compositor does not support confining the pointer");
|
||||
}
|
||||
|
||||
window->wl.confinedPointer =
|
||||
zwp_pointer_constraints_v1_confine_pointer(
|
||||
_glfw.wl.pointerConstraints,
|
||||
@ -3185,9 +3200,9 @@ static void dataSourceHandleCancelled(void* userData,
|
||||
|
||||
static const struct wl_data_source_listener dataSourceListener =
|
||||
{
|
||||
dataSourceHandleTarget,
|
||||
dataSourceHandleSend,
|
||||
dataSourceHandleCancelled,
|
||||
.target = dataSourceHandleTarget,
|
||||
.send = dataSourceHandleSend,
|
||||
.cancelled = dataSourceHandleCancelled,
|
||||
};
|
||||
|
||||
void _glfwSetClipboardStringWayland(const char* string)
|
||||
@ -3261,7 +3276,7 @@ EGLNativeWindowType _glfwGetEGLNativeWindowWayland(_GLFWwindow* window)
|
||||
return window->wl.egl.window;
|
||||
}
|
||||
|
||||
void _glfwGetRequiredInstanceExtensionsWayland(char** extensions)
|
||||
void _glfwGetRequiredInstanceExtensionsWayland(const char** extensions)
|
||||
{
|
||||
if (!_glfw.vk.KHR_surface || !_glfw.vk.KHR_wayland_surface)
|
||||
return;
|
||||
|
||||
@ -231,7 +231,7 @@ static void createKeyTables(void)
|
||||
const struct
|
||||
{
|
||||
int key;
|
||||
char* name;
|
||||
const char* name;
|
||||
} keymap[] =
|
||||
{
|
||||
{ GLFW_KEY_GRAVE_ACCENT, "TLDE" },
|
||||
@ -366,7 +366,7 @@ static void createKeyTables(void)
|
||||
// keyboard layout. Because function keys aren't mapped correctly
|
||||
// when using traditional KeySym translations, they are mapped
|
||||
// here instead.
|
||||
for (int i = 0; i < sizeof(keymap) / sizeof(keymap[0]); i++)
|
||||
for (size_t i = 0; i < sizeof(keymap) / sizeof(keymap[0]); i++)
|
||||
{
|
||||
if (strncmp(desc->names->keys[scancode].name,
|
||||
keymap[i].name,
|
||||
@ -390,7 +390,7 @@ static void createKeyTables(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int j = 0; j < sizeof(keymap) / sizeof(keymap[0]); j++)
|
||||
for (size_t j = 0; j < sizeof(keymap) / sizeof(keymap[0]); j++)
|
||||
{
|
||||
if (strncmp(desc->names->key_aliases[i].alias,
|
||||
keymap[j].name,
|
||||
|
||||
@ -151,7 +151,8 @@ void _glfwPollMonitorsX11(void)
|
||||
}
|
||||
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, oi->crtc);
|
||||
if (!ci) {
|
||||
if (!ci)
|
||||
{
|
||||
XRRFreeOutputInfo(oi);
|
||||
continue;
|
||||
}
|
||||
@ -185,8 +186,8 @@ void _glfwPollMonitorsX11(void)
|
||||
{
|
||||
if (screens[j].x_org == ci->x &&
|
||||
screens[j].y_org == ci->y &&
|
||||
screens[j].width == ci->width &&
|
||||
screens[j].height == ci->height)
|
||||
screens[j].width == (int)ci->width &&
|
||||
screens[j].height == (int)ci->height)
|
||||
{
|
||||
monitor->x11.index = j;
|
||||
break;
|
||||
@ -578,7 +579,7 @@ void _glfwSetGammaRampX11(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||
{
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.gammaBroken)
|
||||
{
|
||||
if (XRRGetCrtcGammaSize(_glfw.x11.display, monitor->x11.crtc) != ramp->size)
|
||||
if (XRRGetCrtcGammaSize(_glfw.x11.display, monitor->x11.crtc) != (int)ramp->size)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"X11: Gamma ramp size must match current ramp size");
|
||||
|
||||
@ -960,7 +960,7 @@ EGLenum _glfwGetEGLPlatformX11(EGLint** attribs);
|
||||
EGLNativeDisplayType _glfwGetEGLNativeDisplayX11(void);
|
||||
EGLNativeWindowType _glfwGetEGLNativeWindowX11(_GLFWwindow* window);
|
||||
|
||||
void _glfwGetRequiredInstanceExtensionsX11(char** extensions);
|
||||
void _glfwGetRequiredInstanceExtensionsX11(const char** extensions);
|
||||
GLFWbool _glfwGetPhysicalDevicePresentationSupportX11(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
|
||||
VkResult _glfwCreateWindowSurfaceX11(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@
|
||||
//
|
||||
static GLFWbool waitForX11Event(double* timeout)
|
||||
{
|
||||
struct pollfd fd = { ConnectionNumber(_glfw.x11.display), POLLIN };
|
||||
struct pollfd fd = { .fd = ConnectionNumber(_glfw.x11.display), .events = POLLIN };
|
||||
|
||||
while (!XPending(_glfw.x11.display))
|
||||
{
|
||||
@ -97,7 +97,7 @@ static GLFWbool waitForAnyEvent(double* timeout)
|
||||
if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), timeout))
|
||||
return GLFW_FALSE;
|
||||
|
||||
for (int i = 1; i < sizeof(fds) / sizeof(fds[0]); i++)
|
||||
for (size_t i = 1; i < sizeof(fds) / sizeof(fds[0]); i++)
|
||||
{
|
||||
if (fds[i].revents & POLLIN)
|
||||
return GLFW_TRUE;
|
||||
@ -235,10 +235,10 @@ static int translateState(int state)
|
||||
|
||||
// Translates an X11 key code to a GLFW key token
|
||||
//
|
||||
static int translateKey(int scancode)
|
||||
static int translateKey(unsigned int scancode)
|
||||
{
|
||||
// Use the pre-filled LUT (see createKeyTables() in x11_init.c)
|
||||
if (scancode < 0 || scancode > 255)
|
||||
if (scancode > 255)
|
||||
return GLFW_KEY_UNKNOWN;
|
||||
|
||||
return _glfw.x11.keycodes[scancode];
|
||||
@ -1149,7 +1149,7 @@ static void releaseMonitor(_GLFWwindow* window)
|
||||
//
|
||||
static void processEvent(XEvent *event)
|
||||
{
|
||||
int keycode = 0;
|
||||
unsigned int keycode = 0;
|
||||
Bool filtered = False;
|
||||
|
||||
// HACK: Save scancode as some IMs clear the field in XFilterEvent
|
||||
@ -2207,7 +2207,7 @@ void _glfwGetWindowSizeX11(_GLFWwindow* window, int* width, int* height)
|
||||
|
||||
void _glfwSetWindowSizeX11(_GLFWwindow* window, int width, int height)
|
||||
{
|
||||
// The dimensions must be nonzero, or a BadValue error results.
|
||||
// The dimensions must be nonzero, or a BadValue error results
|
||||
width = _glfw_max(1, width);
|
||||
height = _glfw_max(1, height);
|
||||
|
||||
@ -3141,7 +3141,7 @@ EGLNativeWindowType _glfwGetEGLNativeWindowX11(_GLFWwindow* window)
|
||||
return (EGLNativeWindowType) window->x11.handle;
|
||||
}
|
||||
|
||||
void _glfwGetRequiredInstanceExtensionsX11(char** extensions)
|
||||
void _glfwGetRequiredInstanceExtensionsX11(const char** extensions)
|
||||
{
|
||||
if (!_glfw.vk.KHR_surface)
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user