mirror of
https://github.com/glfw/glfw.git
synced 2024-11-11 04:53:50 +00:00
Compare commits
10 Commits
bb7f604fd9
...
d8b96e5e6a
Author | SHA1 | Date | |
---|---|---|---|
|
d8b96e5e6a | ||
|
17d9c90d3f | ||
|
6e19d07de8 | ||
|
841cf79c5f | ||
|
4207999bb3 | ||
|
ecf1351ef0 | ||
|
549865a41a | ||
|
49e74fd593 | ||
|
9f5a4f672f | ||
|
7c93346221 |
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
||||
|
@ -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}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user