mirror of
https://github.com/glfw/glfw.git
synced 2025-12-20 14:11:55 +00:00
Compare commits
7 Commits
571990885b
...
13d306db8c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13d306db8c | ||
|
|
dbadda2683 | ||
|
|
08449b7183 | ||
|
|
1ce855b0b1 | ||
|
|
ebff6606ee | ||
|
|
adcb0bda78 | ||
|
|
69cc9fe0a8 |
@ -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)")
|
"Library type override for GLFW (SHARED, STATIC, OBJECT, or empty to follow BUILD_SHARED_LIBS)")
|
||||||
|
|
||||||
if (GLFW_LIBRARY_TYPE)
|
if (GLFW_LIBRARY_TYPE)
|
||||||
if (GLFW_LIBRARY_TYPE STREQUAL "SHARED")
|
string(COMPARE EQUAL "${GLFW_LIBRARY_TYPE}" "SHARED" GLFW_BUILD_SHARED_LIBRARY)
|
||||||
set(GLFW_BUILD_SHARED_LIBRARY TRUE)
|
|
||||||
else()
|
|
||||||
set(GLFW_BUILD_SHARED_LIBRARY FALSE)
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
set(GLFW_BUILD_SHARED_LIBRARY ${BUILD_SHARED_LIBS})
|
set(GLFW_BUILD_SHARED_LIBRARY ${BUILD_SHARED_LIBS})
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -162,6 +162,7 @@ video tutorials.
|
|||||||
- Marcel Metz
|
- Marcel Metz
|
||||||
- Liam Middlebrook
|
- Liam Middlebrook
|
||||||
- mightgoyardstill
|
- mightgoyardstill
|
||||||
|
- Mihail
|
||||||
- Ave Milia
|
- Ave Milia
|
||||||
- Icyllis Milica
|
- Icyllis Milica
|
||||||
- Jonathan Miller
|
- Jonathan Miller
|
||||||
|
|||||||
@ -146,11 +146,14 @@ information on what to include when reporting a bug.
|
|||||||
from a modal to the content area
|
from a modal to the content area
|
||||||
- [Wayland] Bugfix: free modules at end of terminate function to resolve
|
- [Wayland] Bugfix: free modules at end of terminate function to resolve
|
||||||
potential segmentation fault (#2744)
|
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: Running without a WM could trigger an assert (#2593,#2601,#2631)
|
||||||
- [X11] Bugfix: Occasional crash when an idle display awakes (#2766)
|
- [X11] Bugfix: Occasional crash when an idle display awakes (#2766)
|
||||||
- [X11] Bugfix: Prevent BadWindow when creating small windows with a content scale
|
- [X11] Bugfix: Prevent BadWindow when creating small windows with a content scale
|
||||||
less than 1 (#2754)
|
less than 1 (#2754)
|
||||||
- [X11] Bugfix: Clamp width and height to >= 1 to prevent BadValue error and app exit
|
- [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 Vulkan 'window' surface creation via `VK_EXT_headless_surface`
|
||||||
- [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless`
|
- [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
|
- [EGL] Allowed native access on Wayland with `GLFW_CONTEXT_CREATION_API` set to
|
||||||
|
|||||||
152
deps/wayland/cursor-shape-v1.xml
vendored
Normal file
152
deps/wayland/cursor-shape-v1.xml
vendored
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="cursor_shape_v1">
|
||||||
|
<copyright>
|
||||||
|
Copyright 2018 The Chromium Authors
|
||||||
|
Copyright 2023 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.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<interface name="wp_cursor_shape_manager_v1" version="1">
|
||||||
|
<description summary="cursor shape manager">
|
||||||
|
This global offers an alternative, optional way to set cursor images. This
|
||||||
|
new way uses enumerated cursors instead of a wl_surface like
|
||||||
|
wl_pointer.set_cursor does.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is currently in the testing
|
||||||
|
phase. Backward compatible changes may be added together with the
|
||||||
|
corresponding interface version bump. Backward incompatible changes can
|
||||||
|
only be done by creating a new major version of the extension.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the manager">
|
||||||
|
Destroy the cursor shape manager.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_pointer">
|
||||||
|
<description summary="manage the cursor shape of a pointer device">
|
||||||
|
Obtain a wp_cursor_shape_device_v1 for a wl_pointer object.
|
||||||
|
|
||||||
|
When the pointer capability is removed from the wl_seat, the
|
||||||
|
wp_cursor_shape_device_v1 object becomes inert.
|
||||||
|
</description>
|
||||||
|
<arg name="cursor_shape_device" type="new_id" interface="wp_cursor_shape_device_v1"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_tablet_tool_v2">
|
||||||
|
<description summary="manage the cursor shape of a tablet tool device">
|
||||||
|
Obtain a wp_cursor_shape_device_v1 for a zwp_tablet_tool_v2 object.
|
||||||
|
|
||||||
|
When the zwp_tablet_tool_v2 is removed, the wp_cursor_shape_device_v1
|
||||||
|
object becomes inert.
|
||||||
|
</description>
|
||||||
|
<arg name="cursor_shape_device" type="new_id" interface="wp_cursor_shape_device_v1"/>
|
||||||
|
<arg name="tablet_tool" type="object" interface="zwp_tablet_tool_v2"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="wp_cursor_shape_device_v1" version="1">
|
||||||
|
<description summary="cursor shape for a device">
|
||||||
|
This interface allows clients to set the cursor shape.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<enum name="shape">
|
||||||
|
<description summary="cursor shapes">
|
||||||
|
This enum describes cursor shapes.
|
||||||
|
|
||||||
|
The names are taken from the CSS W3C specification:
|
||||||
|
https://w3c.github.io/csswg-drafts/css-ui/#cursor
|
||||||
|
</description>
|
||||||
|
<entry name="default" value="1" summary="default cursor"/>
|
||||||
|
<entry name="context_menu" value="2" summary="a context menu is available for the object under the cursor"/>
|
||||||
|
<entry name="help" value="3" summary="help is available for the object under the cursor"/>
|
||||||
|
<entry name="pointer" value="4" summary="pointer that indicates a link or another interactive element"/>
|
||||||
|
<entry name="progress" value="5" summary="progress indicator"/>
|
||||||
|
<entry name="wait" value="6" summary="program is busy, user should wait"/>
|
||||||
|
<entry name="cell" value="7" summary="a cell or set of cells may be selected"/>
|
||||||
|
<entry name="crosshair" value="8" summary="simple crosshair"/>
|
||||||
|
<entry name="text" value="9" summary="text may be selected"/>
|
||||||
|
<entry name="vertical_text" value="10" summary="vertical text may be selected"/>
|
||||||
|
<entry name="alias" value="11" summary="drag-and-drop: alias of/shortcut to something is to be created"/>
|
||||||
|
<entry name="copy" value="12" summary="drag-and-drop: something is to be copied"/>
|
||||||
|
<entry name="move" value="13" summary="drag-and-drop: something is to be moved"/>
|
||||||
|
<entry name="no_drop" value="14" summary="drag-and-drop: the dragged item cannot be dropped at the current cursor location"/>
|
||||||
|
<entry name="not_allowed" value="15" summary="drag-and-drop: the requested action will not be carried out"/>
|
||||||
|
<entry name="grab" value="16" summary="drag-and-drop: something can be grabbed"/>
|
||||||
|
<entry name="grabbing" value="17" summary="drag-and-drop: something is being grabbed"/>
|
||||||
|
<entry name="e_resize" value="18" summary="resizing: the east border is to be moved"/>
|
||||||
|
<entry name="n_resize" value="19" summary="resizing: the north border is to be moved"/>
|
||||||
|
<entry name="ne_resize" value="20" summary="resizing: the north-east corner is to be moved"/>
|
||||||
|
<entry name="nw_resize" value="21" summary="resizing: the north-west corner is to be moved"/>
|
||||||
|
<entry name="s_resize" value="22" summary="resizing: the south border is to be moved"/>
|
||||||
|
<entry name="se_resize" value="23" summary="resizing: the south-east corner is to be moved"/>
|
||||||
|
<entry name="sw_resize" value="24" summary="resizing: the south-west corner is to be moved"/>
|
||||||
|
<entry name="w_resize" value="25" summary="resizing: the west border is to be moved"/>
|
||||||
|
<entry name="ew_resize" value="26" summary="resizing: the east and west borders are to be moved"/>
|
||||||
|
<entry name="ns_resize" value="27" summary="resizing: the north and south borders are to be moved"/>
|
||||||
|
<entry name="nesw_resize" value="28" summary="resizing: the north-east and south-west corners are to be moved"/>
|
||||||
|
<entry name="nwse_resize" value="29" summary="resizing: the north-west and south-east corners are to be moved"/>
|
||||||
|
<entry name="col_resize" value="30" summary="resizing: that the item/column can be resized horizontally"/>
|
||||||
|
<entry name="row_resize" value="31" summary="resizing: that the item/row can be resized vertically"/>
|
||||||
|
<entry name="all_scroll" value="32" summary="something can be scrolled in any direction"/>
|
||||||
|
<entry name="zoom_in" value="33" summary="something can be zoomed in"/>
|
||||||
|
<entry name="zoom_out" value="34" summary="something can be zoomed out"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<entry name="invalid_shape" value="1"
|
||||||
|
summary="the specified shape value is invalid"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the cursor shape device">
|
||||||
|
Destroy the cursor shape device.
|
||||||
|
|
||||||
|
The device cursor shape remains unchanged.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_shape">
|
||||||
|
<description summary="set device cursor to the shape">
|
||||||
|
Sets the device cursor to the specified shape. The compositor will
|
||||||
|
change the cursor image based on the specified shape.
|
||||||
|
|
||||||
|
The cursor actually changes only if the input device focus is one of
|
||||||
|
the requesting client's surfaces. If any, the previous cursor image
|
||||||
|
(surface or shape) is replaced.
|
||||||
|
|
||||||
|
The "shape" argument must be a valid enum entry, otherwise the
|
||||||
|
invalid_shape protocol error is raised.
|
||||||
|
|
||||||
|
This is similar to the wl_pointer.set_cursor and
|
||||||
|
zwp_tablet_tool_v2.set_cursor requests, but this request accepts a
|
||||||
|
shape instead of contents in the form of a surface. Clients can mix
|
||||||
|
set_cursor and set_shape requests.
|
||||||
|
|
||||||
|
The serial parameter must match the latest wl_pointer.enter or
|
||||||
|
zwp_tablet_tool_v2.proximity_in serial number sent to the client.
|
||||||
|
Otherwise the request will be ignored.
|
||||||
|
</description>
|
||||||
|
<arg name="serial" type="uint" summary="serial number of the enter event"/>
|
||||||
|
<arg name="shape" type="uint" enum="shape"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
||||||
1182
deps/wayland/tablet-unstable-v2.xml
vendored
Normal file
1182
deps/wayland/tablet-unstable-v2.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -105,6 +105,8 @@ if (GLFW_BUILD_WAYLAND)
|
|||||||
generate_wayland_protocol("fractional-scale-v1.xml")
|
generate_wayland_protocol("fractional-scale-v1.xml")
|
||||||
generate_wayland_protocol("xdg-activation-v1.xml")
|
generate_wayland_protocol("xdg-activation-v1.xml")
|
||||||
generate_wayland_protocol("xdg-decoration-unstable-v1.xml")
|
generate_wayland_protocol("xdg-decoration-unstable-v1.xml")
|
||||||
|
generate_wayland_protocol("tablet-unstable-v2.xml")
|
||||||
|
generate_wayland_protocol("cursor-shape-v1.xml")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32 AND GLFW_BUILD_SHARED_LIBRARY)
|
if (WIN32 AND GLFW_BUILD_SHARED_LIBRARY)
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/inotify.h>
|
#include <sys/inotify.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|||||||
@ -528,7 +528,8 @@ void _glfwUpdateKeyNamesWin32(void)
|
|||||||
|
|
||||||
if (key >= GLFW_KEY_KP_0 && key <= GLFW_KEY_KP_ADD)
|
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_NUMPAD0, VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3,
|
||||||
VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7,
|
VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7,
|
||||||
VK_NUMPAD8, VK_NUMPAD9, VK_DECIMAL, VK_DIVIDE,
|
VK_NUMPAD8, VK_NUMPAD9, VK_DECIMAL, VK_DIVIDE,
|
||||||
|
|||||||
@ -49,6 +49,8 @@
|
|||||||
#include "fractional-scale-v1-client-protocol.h"
|
#include "fractional-scale-v1-client-protocol.h"
|
||||||
#include "xdg-activation-v1-client-protocol.h"
|
#include "xdg-activation-v1-client-protocol.h"
|
||||||
#include "idle-inhibit-unstable-v1-client-protocol.h"
|
#include "idle-inhibit-unstable-v1-client-protocol.h"
|
||||||
|
#include "tablet-unstable-v2-client-protocol.h"
|
||||||
|
#include "cursor-shape-v1-client-protocol.h"
|
||||||
|
|
||||||
// NOTE: Versions of wayland-scanner prior to 1.17.91 named every global array of
|
// NOTE: Versions of wayland-scanner prior to 1.17.91 named every global array of
|
||||||
// wl_interface pointers 'types', making it impossible to combine several unmodified
|
// wl_interface pointers 'types', making it impossible to combine several unmodified
|
||||||
@ -91,6 +93,14 @@
|
|||||||
#include "idle-inhibit-unstable-v1-client-protocol-code.h"
|
#include "idle-inhibit-unstable-v1-client-protocol-code.h"
|
||||||
#undef types
|
#undef types
|
||||||
|
|
||||||
|
#define types _glfw_tablet_types
|
||||||
|
#include "tablet-unstable-v2-client-protocol-code.h"
|
||||||
|
#undef types
|
||||||
|
|
||||||
|
#define types _glfw_cursor_shape_types
|
||||||
|
#include "cursor-shape-v1-client-protocol-code.h"
|
||||||
|
#undef types
|
||||||
|
|
||||||
static void wmBaseHandlePing(void* userData,
|
static void wmBaseHandlePing(void* userData,
|
||||||
struct xdg_wm_base* wmBase,
|
struct xdg_wm_base* wmBase,
|
||||||
uint32_t serial)
|
uint32_t serial)
|
||||||
@ -208,6 +218,13 @@ static void registryHandleGlobal(void* userData,
|
|||||||
&wp_fractional_scale_manager_v1_interface,
|
&wp_fractional_scale_manager_v1_interface,
|
||||||
1);
|
1);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(interface, wp_cursor_shape_manager_v1_interface.name) == 0)
|
||||||
|
{
|
||||||
|
_glfw.wl.cursorShapeManager =
|
||||||
|
wl_registry_bind(registry, name,
|
||||||
|
&wp_cursor_shape_manager_v1_interface,
|
||||||
|
1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void registryHandleGlobalRemove(void* userData,
|
static void registryHandleGlobalRemove(void* userData,
|
||||||
@ -966,6 +983,10 @@ void _glfwTerminateWayland(void)
|
|||||||
xdg_activation_v1_destroy(_glfw.wl.activationManager);
|
xdg_activation_v1_destroy(_glfw.wl.activationManager);
|
||||||
if (_glfw.wl.fractionalScaleManager)
|
if (_glfw.wl.fractionalScaleManager)
|
||||||
wp_fractional_scale_manager_v1_destroy(_glfw.wl.fractionalScaleManager);
|
wp_fractional_scale_manager_v1_destroy(_glfw.wl.fractionalScaleManager);
|
||||||
|
if (_glfw.wl.cursorShapeManager)
|
||||||
|
wp_cursor_shape_manager_v1_destroy(_glfw.wl.cursorShapeManager);
|
||||||
|
if (_glfw.wl.cursorShapeDevice)
|
||||||
|
wp_cursor_shape_device_v1_destroy(_glfw.wl.cursorShapeDevice);
|
||||||
if (_glfw.wl.registry)
|
if (_glfw.wl.registry)
|
||||||
wl_registry_destroy(_glfw.wl.registry);
|
wl_registry_destroy(_glfw.wl.registry);
|
||||||
if (_glfw.wl.display)
|
if (_glfw.wl.display)
|
||||||
@ -979,7 +1000,8 @@ void _glfwTerminateWayland(void)
|
|||||||
if (_glfw.wl.cursorTimerfd >= 0)
|
if (_glfw.wl.cursorTimerfd >= 0)
|
||||||
close(_glfw.wl.cursorTimerfd);
|
close(_glfw.wl.cursorTimerfd);
|
||||||
|
|
||||||
// Free modules only after all wayland termination functions are called
|
// Free modules only after all Wayland termination functions are called
|
||||||
|
|
||||||
if (_glfw.egl.handle)
|
if (_glfw.egl.handle)
|
||||||
{
|
{
|
||||||
_glfwPlatformFreeModule(_glfw.egl.handle);
|
_glfwPlatformFreeModule(_glfw.egl.handle);
|
||||||
@ -1003,6 +1025,7 @@ void _glfwTerminateWayland(void)
|
|||||||
_glfwPlatformFreeModule(_glfw.wl.xkb.handle);
|
_glfwPlatformFreeModule(_glfw.wl.xkb.handle);
|
||||||
_glfw.wl.xkb.handle = NULL;
|
_glfw.wl.xkb.handle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_glfw.wl.cursor.handle)
|
if (_glfw.wl.cursor.handle)
|
||||||
{
|
{
|
||||||
_glfwPlatformFreeModule(_glfw.wl.cursor.handle);
|
_glfwPlatformFreeModule(_glfw.wl.cursor.handle);
|
||||||
|
|||||||
@ -136,18 +136,22 @@ struct wl_output;
|
|||||||
#define GLFW_WAYLAND_MONITOR_STATE _GLFWmonitorWayland wl;
|
#define GLFW_WAYLAND_MONITOR_STATE _GLFWmonitorWayland wl;
|
||||||
#define GLFW_WAYLAND_CURSOR_STATE _GLFWcursorWayland wl;
|
#define GLFW_WAYLAND_CURSOR_STATE _GLFWcursorWayland wl;
|
||||||
|
|
||||||
struct wl_cursor_image {
|
struct wl_cursor_image
|
||||||
|
{
|
||||||
uint32_t width;
|
uint32_t width;
|
||||||
uint32_t height;
|
uint32_t height;
|
||||||
uint32_t hotspot_x;
|
uint32_t hotspot_x;
|
||||||
uint32_t hotspot_y;
|
uint32_t hotspot_y;
|
||||||
uint32_t delay;
|
uint32_t delay;
|
||||||
};
|
};
|
||||||
struct wl_cursor {
|
|
||||||
|
struct wl_cursor
|
||||||
|
{
|
||||||
unsigned int image_count;
|
unsigned int image_count;
|
||||||
struct wl_cursor_image** images;
|
struct wl_cursor_image** images;
|
||||||
char* name;
|
char* name;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct wl_cursor_theme* (* PFN_wl_cursor_theme_load)(const char*, int, struct wl_shm*);
|
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 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*);
|
typedef struct wl_cursor* (* PFN_wl_cursor_theme_get_cursor)(struct wl_cursor_theme*, const char*);
|
||||||
@ -440,6 +444,8 @@ typedef struct _GLFWlibraryWayland
|
|||||||
struct zwp_idle_inhibit_manager_v1* idleInhibitManager;
|
struct zwp_idle_inhibit_manager_v1* idleInhibitManager;
|
||||||
struct xdg_activation_v1* activationManager;
|
struct xdg_activation_v1* activationManager;
|
||||||
struct wp_fractional_scale_manager_v1* fractionalScaleManager;
|
struct wp_fractional_scale_manager_v1* fractionalScaleManager;
|
||||||
|
struct wp_cursor_shape_manager_v1* cursorShapeManager;
|
||||||
|
struct wp_cursor_shape_device_v1* cursorShapeDevice;
|
||||||
|
|
||||||
_GLFWofferWayland* offers;
|
_GLFWofferWayland* offers;
|
||||||
unsigned int offerCount;
|
unsigned int offerCount;
|
||||||
@ -610,6 +616,7 @@ typedef struct _GLFWcursorWayland
|
|||||||
int width, height;
|
int width, height;
|
||||||
int xhot, yhot;
|
int xhot, yhot;
|
||||||
int currentImage;
|
int currentImage;
|
||||||
|
int shape;
|
||||||
} _GLFWcursorWayland;
|
} _GLFWcursorWayland;
|
||||||
|
|
||||||
GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform);
|
GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform);
|
||||||
|
|||||||
@ -51,6 +51,7 @@
|
|||||||
#include "xdg-activation-v1-client-protocol.h"
|
#include "xdg-activation-v1-client-protocol.h"
|
||||||
#include "idle-inhibit-unstable-v1-client-protocol.h"
|
#include "idle-inhibit-unstable-v1-client-protocol.h"
|
||||||
#include "fractional-scale-v1-client-protocol.h"
|
#include "fractional-scale-v1-client-protocol.h"
|
||||||
|
#include "cursor-shape-v1-client-protocol.h"
|
||||||
|
|
||||||
#define GLFW_BORDER_SIZE 4
|
#define GLFW_BORDER_SIZE 4
|
||||||
#define GLFW_CAPTION_HEIGHT 24
|
#define GLFW_CAPTION_HEIGHT 24
|
||||||
@ -1221,9 +1222,67 @@ static GLFWbool createNativeSurface(_GLFWwindow* window,
|
|||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLFWbool setCursorShape(int shape) {
|
||||||
|
int xdgShape = -1;
|
||||||
|
|
||||||
|
switch (shape)
|
||||||
|
{
|
||||||
|
case GLFW_ARROW_CURSOR:
|
||||||
|
xdgShape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT;
|
||||||
|
break;
|
||||||
|
case GLFW_IBEAM_CURSOR:
|
||||||
|
xdgShape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_TEXT;
|
||||||
|
break;
|
||||||
|
case GLFW_CROSSHAIR_CURSOR:
|
||||||
|
xdgShape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_CROSSHAIR;
|
||||||
|
break;
|
||||||
|
case GLFW_POINTING_HAND_CURSOR:
|
||||||
|
xdgShape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_POINTER;
|
||||||
|
break;
|
||||||
|
case GLFW_RESIZE_EW_CURSOR:
|
||||||
|
xdgShape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_EW_RESIZE;
|
||||||
|
break;
|
||||||
|
case GLFW_RESIZE_NS_CURSOR:
|
||||||
|
xdgShape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NS_RESIZE;
|
||||||
|
break;
|
||||||
|
case GLFW_RESIZE_NWSE_CURSOR:
|
||||||
|
xdgShape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NWSE_RESIZE;
|
||||||
|
break;
|
||||||
|
case GLFW_RESIZE_NESW_CURSOR:
|
||||||
|
xdgShape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NESW_RESIZE;
|
||||||
|
break;
|
||||||
|
case GLFW_RESIZE_ALL_CURSOR:
|
||||||
|
xdgShape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_ALL_SCROLL;
|
||||||
|
break;
|
||||||
|
case GLFW_NOT_ALLOWED_CURSOR:
|
||||||
|
xdgShape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NOT_ALLOWED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xdgShape == -1)
|
||||||
|
{
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_cursor_shape_device_v1_set_shape(_glfw.wl.cursorShapeDevice,
|
||||||
|
_glfw.wl.pointerEnterSerial,
|
||||||
|
xdgShape);
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void setCursorImage(_GLFWwindow* window,
|
static void setCursorImage(_GLFWwindow* window,
|
||||||
_GLFWcursorWayland* cursorWayland)
|
_GLFWcursorWayland* cursorWayland)
|
||||||
{
|
{
|
||||||
|
if (_glfw.wl.cursorShapeDevice && cursorWayland->shape != 0)
|
||||||
|
{
|
||||||
|
GLFWbool ok = setCursorShape(cursorWayland->shape);
|
||||||
|
if (ok == GLFW_TRUE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct itimerspec timer = {0};
|
struct itimerspec timer = {0};
|
||||||
struct wl_cursor* wlCursor = cursorWayland->cursor;
|
struct wl_cursor* wlCursor = cursorWayland->cursor;
|
||||||
struct wl_cursor_image* image;
|
struct wl_cursor_image* image;
|
||||||
@ -1413,7 +1472,7 @@ static void handleEvents(double* timeout)
|
|||||||
|
|
||||||
if (read(_glfw.wl.keyRepeatTimerfd, &repeats, sizeof(repeats)) == 8)
|
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++)
|
for (uint64_t i = 0; i < repeats; i++)
|
||||||
{
|
{
|
||||||
@ -1692,7 +1751,8 @@ static void keyboardHandleKeymap(void* userData,
|
|||||||
}
|
}
|
||||||
|
|
||||||
mapStr = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
|
mapStr = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
|
||||||
if (mapStr == MAP_FAILED) {
|
if (mapStr == MAP_FAILED)
|
||||||
|
{
|
||||||
close(fd);
|
close(fd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1838,7 +1898,9 @@ static void keyboardHandleKey(void* userData,
|
|||||||
timer.it_value.tv_nsec = (_glfw.wl.keyRepeatDelay % 1000) * 1000000;
|
timer.it_value.tv_nsec = (_glfw.wl.keyRepeatDelay % 1000) * 1000000;
|
||||||
timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL);
|
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);
|
timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1926,6 +1988,10 @@ static void seatHandleCapabilities(void* userData,
|
|||||||
{
|
{
|
||||||
_glfw.wl.pointer = wl_seat_get_pointer(seat);
|
_glfw.wl.pointer = wl_seat_get_pointer(seat);
|
||||||
wl_pointer_add_listener(_glfw.wl.pointer, &pointerListener, NULL);
|
wl_pointer_add_listener(_glfw.wl.pointer, &pointerListener, NULL);
|
||||||
|
if (_glfw.wl.cursorShapeManager)
|
||||||
|
{
|
||||||
|
_glfw.wl.cursorShapeDevice = wp_cursor_shape_manager_v1_get_pointer(_glfw.wl.cursorShapeManager, _glfw.wl.pointer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && _glfw.wl.pointer)
|
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && _glfw.wl.pointer)
|
||||||
{
|
{
|
||||||
@ -2809,6 +2875,8 @@ GLFWbool _glfwCreateCursorWayland(_GLFWcursor* cursor,
|
|||||||
|
|
||||||
GLFWbool _glfwCreateStandardCursorWayland(_GLFWcursor* cursor, int shape)
|
GLFWbool _glfwCreateStandardCursorWayland(_GLFWcursor* cursor, int shape)
|
||||||
{
|
{
|
||||||
|
cursor->wl.shape = shape;
|
||||||
|
|
||||||
const char* name = NULL;
|
const char* name = NULL;
|
||||||
|
|
||||||
// Try the XDG names first
|
// Try the XDG names first
|
||||||
@ -2974,10 +3042,16 @@ static void lockPointer(_GLFWwindow* window)
|
|||||||
if (!_glfw.wl.relativePointerManager)
|
if (!_glfw.wl.relativePointerManager)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_FEATURE_UNAVAILABLE,
|
_glfwInputError(GLFW_FEATURE_UNAVAILABLE,
|
||||||
"Wayland: The compositor does not support pointer locking");
|
"Wayland: The compositor does not support relative pointer motion");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_glfw.wl.pointerConstraints)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_FEATURE_UNAVAILABLE,
|
||||||
|
"Wayland: The compositor does not support locking the pointer");
|
||||||
|
}
|
||||||
|
|
||||||
window->wl.relativePointer =
|
window->wl.relativePointer =
|
||||||
zwp_relative_pointer_manager_v1_get_relative_pointer(
|
zwp_relative_pointer_manager_v1_get_relative_pointer(
|
||||||
_glfw.wl.relativePointerManager,
|
_glfw.wl.relativePointerManager,
|
||||||
@ -3025,6 +3099,12 @@ static const struct zwp_confined_pointer_v1_listener confinedPointerListener =
|
|||||||
|
|
||||||
static void confinePointer(_GLFWwindow* window)
|
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 =
|
window->wl.confinedPointer =
|
||||||
zwp_pointer_constraints_v1_confine_pointer(
|
zwp_pointer_constraints_v1_confine_pointer(
|
||||||
_glfw.wl.pointerConstraints,
|
_glfw.wl.pointerConstraints,
|
||||||
@ -3110,7 +3190,8 @@ void _glfwSetCursorWayland(_GLFWwindow* window, _GLFWcursor* cursor)
|
|||||||
NULL,
|
NULL,
|
||||||
0, 0,
|
0, 0,
|
||||||
0, 0,
|
0, 0,
|
||||||
0
|
0,
|
||||||
|
GLFW_ARROW_CURSOR
|
||||||
};
|
};
|
||||||
|
|
||||||
setCursorImage(window, &cursorWayland);
|
setCursorImage(window, &cursorWayland);
|
||||||
|
|||||||
@ -151,7 +151,8 @@ void _glfwPollMonitorsX11(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, oi->crtc);
|
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, oi->crtc);
|
||||||
if (!ci) {
|
if (!ci)
|
||||||
|
{
|
||||||
XRRFreeOutputInfo(oi);
|
XRRFreeOutputInfo(oi);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2207,7 +2207,7 @@ void _glfwGetWindowSizeX11(_GLFWwindow* window, int* width, int* height)
|
|||||||
|
|
||||||
void _glfwSetWindowSizeX11(_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);
|
width = _glfw_max(1, width);
|
||||||
height = _glfw_max(1, height);
|
height = _glfw_max(1, height);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user