Compare commits

..

10 Commits

Author SHA1 Message Date
pfg
d8b96e5e6a
Merge 17d9c90d3f into b35641f4a3 2024-09-19 19:07:42 -04:00
pfg
17d9c90d3f Finish checklist 2024-09-19 18:07:37 -05:00
pfg
6e19d07de8 Add guide documentation & fixes 2024-09-19 18:03:05 -05:00
pfg
841cf79c5f Fix incorrect header file name 2024-09-19 17:32:15 -05:00
pfg
4207999bb3 Fix build after rebase 2024-09-19 17:32:15 -05:00
pfg
ecf1351ef0 Add protocol usage note 2024-09-19 17:32:15 -05:00
pfg
549865a41a wayland support, needs review 2024-09-19 17:32:15 -05:00
pfg
49e74fd593 Add news entry for trackpad events 2024-09-19 17:32:15 -05:00
pfg
9f5a4f672f Add changelog entry for trackpad zoom/rotate 2024-09-19 17:32:15 -05:00
pfg
7c93346221 Add macOS events trackpadZoom and trackpadRotate 2024-09-19 17:32:15 -05:00
6 changed files with 50 additions and 4 deletions

View File

@ -294,6 +294,7 @@ video tutorials.
- Jonas Ådahl
- Lasse Öörni
- Leonard König
- pfgithub
- All the unmentioned and anonymous contributors in the GLFW community, for bug
reports, patches, feedback, testing and encouragement

View File

@ -132,7 +132,7 @@ information on what to include when reporting a bug.
- [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
`GLFW_NATIVE_CONTEXT_API` (#2518)
- [Cocoa] Added `glfwSetTrackpadZoomCallback` and `glfwSetTrackpadRotateCallback`
- [Cocoa & Wayland] Added `glfwSetTrackpadZoomCallback` and `glfwSetTrackpadRotateCallback`
for trackpad zoom and rotate events (#90)

View File

@ -581,6 +581,42 @@ void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
A normal mouse wheel, being vertical, provides offsets along the Y-axis.
### Trackpad zoom and rotate {#input_mouse_trackpad_gestures}
Trackpad events are currently only available on macOS and Wayland (Linux).
If you wish to be notified when a zoom gesture is performed on a trackpad,
set the trackpadZoom callback.
```c
glfwSetTrackpadZoomCallback(window, trackpad_zoom_callback);
```
The callback function receives the scale of the zoom, which is a ratio that
should be multiplied by the current zoom level to get the new zoom level.
```c
static void trackpad_zoom_callback(GLFWwindow* window, double scale)
{
my_app->zoom_level *= scale;
}
```
For trackpad rotate gestures, set the trackpadRotateCallback.
```c
glfwSetTrackpadRotateCallback(window, trackpad_rotate_callback);
```
The callback function recieves the angle, in degrees, to rotate by.
```c
static void trackpad_rotate_callback(GLFWwindow* window, double angle)
{
my_app->rotation_angle_degrees += angle;
}
```
## Joystick input {#joystick}

View File

@ -1880,7 +1880,8 @@ typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffse
* @endcode
*
* @param[in] window The window that received the event.
* @param[in] scale The manigification amount, as a scale factor
* @param[in] scale The manigification amount, to be multiplied by the current
* scale factor to get the new scale factor.
*
* @sa @ref glfwSetTrackpadZoomCallback
*
@ -5486,6 +5487,10 @@ GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun ca
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref input_mouse_trackpad_gestures
*
* @since Added in version 3.5.
*
* @ingroup input
*/
GLFWAPI GLFWtrackpadzoomfun glfwSetTrackpadZoomCallback(GLFWwindow* window, GLFWtrackpadzoomfun callback);
@ -5512,6 +5517,10 @@ GLFWAPI GLFWtrackpadzoomfun glfwSetTrackpadZoomCallback(GLFWwindow* window, GLFW
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref input_mouse_trackpad_gestures
*
* @since Added in version 3.5.
*
* @ingroup input
*/
GLFWAPI GLFWtrackpadrotatefun glfwSetTrackpadRotateCallback(GLFWwindow* window, GLFWtrackpadrotatefun callback);

View File

@ -1069,7 +1069,7 @@ GLFWAPI GLFWtrackpadzoomfun glfwSetTrackpadZoomCallback(GLFWwindow* handle,
return cbfun;
}
GLFWAPI GLFWtrackpadzoomfun glfwSetTrackpadRotateCallback(GLFWwindow* handle,
GLFWAPI GLFWtrackpadrotatefun glfwSetTrackpadRotateCallback(GLFWwindow* handle,
GLFWtrackpadrotatefun cbfun)
{
_GLFWwindow* window = (_GLFWwindow*) handle;

View File

@ -93,7 +93,7 @@
#undef types
#define types _glfw_pointer_gestures_types
#include "wayland-pointer-gestures-unstable-v1-client-protocol-code.h"
#include "pointer-gestures-unstable-v1-client-protocol-code.h"
#undef types
static void wmBaseHandlePing(void* userData,