mirror of
https://github.com/glfw/glfw.git
synced 2025-07-12 18:50:04 +00:00
Compare commits
11 Commits
a02134bfcb
...
e06c8950a9
Author | SHA1 | Date | |
---|---|---|---|
|
e06c8950a9 | ||
|
d1b87143bc | ||
|
17d9c90d3f | ||
|
6e19d07de8 | ||
|
841cf79c5f | ||
|
4207999bb3 | ||
|
ecf1351ef0 | ||
|
549865a41a | ||
|
49e74fd593 | ||
|
9f5a4f672f | ||
|
7c93346221 |
@ -29,7 +29,7 @@ for:
|
||||
only:
|
||||
- GENERATOR: MinGW Makefiles
|
||||
build_script:
|
||||
- set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin%
|
||||
- set PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH:C:\Program Files\Git\usr\bin=%
|
||||
- cmake -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
|
||||
- cmake --build build
|
||||
-
|
||||
|
@ -41,12 +41,6 @@ indent_size = 2
|
||||
indent_style = tab
|
||||
indent_size = unset
|
||||
|
||||
[deps/mingw/*.h]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
tab_width = 8
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[deps/getopt.{c,h}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
@ -295,6 +295,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
|
||||
|
||||
|
@ -52,7 +52,7 @@ and window system. It does not need any additional headers for context creation
|
||||
APIs (WGL, GLX, EGL, NSGL, OSMesa) or rendering APIs (OpenGL, OpenGL ES, Vulkan)
|
||||
to enable support for them.
|
||||
|
||||
GLFW supports compilation on Windows with Visual C++ 2013 and later, MinGW and
|
||||
GLFW supports compilation on Windows with Visual C++ (2013 and later) and
|
||||
MinGW-w64, on macOS with Clang and on Linux and other Unix-like systems with GCC
|
||||
and Clang. It will likely compile in other environments as well, but this is
|
||||
not regularly tested.
|
||||
@ -124,6 +124,7 @@ information on what to include when reporting a bug.
|
||||
- Added `GLFW_UNLIMITED_MOUSE_BUTTONS` input mode that allows mouse buttons beyond
|
||||
the limit of the mouse button tokens to be reported (#2423)
|
||||
- Updated minimum CMake version to 3.16 (#2541)
|
||||
- Removed support for building with original MinGW (#2540)
|
||||
- [Cocoa] Added `QuartzCore` framework as link-time dependency
|
||||
- [Cocoa] Removed support for OS X 10.10 Yosemite and earlier (#2506)
|
||||
- [Wayland] Bugfix: The fractional scaling related objects were not destroyed
|
||||
@ -135,6 +136,8 @@ 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 & Wayland] Added `glfwSetTrackpadZoomCallback` and `glfwSetTrackpadRotateCallback`
|
||||
for trackpad zoom and rotate events (#90)
|
||||
|
||||
|
||||
## Contact
|
||||
|
117
deps/mingw/_mingw_dxhelper.h
vendored
117
deps/mingw/_mingw_dxhelper.h
vendored
@ -1,117 +0,0 @@
|
||||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the mingw-w64 runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
|
||||
#define NONAMELESSUNION 1
|
||||
#endif
|
||||
#if defined(NONAMELESSSTRUCT) && \
|
||||
!defined(NONAMELESSUNION)
|
||||
#define NONAMELESSUNION 1
|
||||
#endif
|
||||
#if defined(NONAMELESSUNION) && \
|
||||
!defined(NONAMELESSSTRUCT)
|
||||
#define NONAMELESSSTRUCT 1
|
||||
#endif
|
||||
#if !defined(__GNU_EXTENSION)
|
||||
#if defined(__GNUC__) || defined(__GNUG__)
|
||||
#define __GNU_EXTENSION __extension__
|
||||
#else
|
||||
#define __GNU_EXTENSION
|
||||
#endif
|
||||
#endif /* __extension__ */
|
||||
|
||||
#ifndef __ANONYMOUS_DEFINED
|
||||
#define __ANONYMOUS_DEFINED
|
||||
#if defined(__GNUC__) || defined(__GNUG__)
|
||||
#define _ANONYMOUS_UNION __extension__
|
||||
#define _ANONYMOUS_STRUCT __extension__
|
||||
#else
|
||||
#define _ANONYMOUS_UNION
|
||||
#define _ANONYMOUS_STRUCT
|
||||
#endif
|
||||
#ifndef NONAMELESSUNION
|
||||
#define _UNION_NAME(x)
|
||||
#define _STRUCT_NAME(x)
|
||||
#else /* NONAMELESSUNION */
|
||||
#define _UNION_NAME(x) x
|
||||
#define _STRUCT_NAME(x) x
|
||||
#endif
|
||||
#endif /* __ANONYMOUS_DEFINED */
|
||||
|
||||
#ifndef DUMMYUNIONNAME
|
||||
# ifdef NONAMELESSUNION
|
||||
# define DUMMYUNIONNAME u
|
||||
# define DUMMYUNIONNAME1 u1 /* Wine uses this variant */
|
||||
# define DUMMYUNIONNAME2 u2
|
||||
# define DUMMYUNIONNAME3 u3
|
||||
# define DUMMYUNIONNAME4 u4
|
||||
# define DUMMYUNIONNAME5 u5
|
||||
# define DUMMYUNIONNAME6 u6
|
||||
# define DUMMYUNIONNAME7 u7
|
||||
# define DUMMYUNIONNAME8 u8
|
||||
# define DUMMYUNIONNAME9 u9
|
||||
# else /* NONAMELESSUNION */
|
||||
# define DUMMYUNIONNAME
|
||||
# define DUMMYUNIONNAME1 /* Wine uses this variant */
|
||||
# define DUMMYUNIONNAME2
|
||||
# define DUMMYUNIONNAME3
|
||||
# define DUMMYUNIONNAME4
|
||||
# define DUMMYUNIONNAME5
|
||||
# define DUMMYUNIONNAME6
|
||||
# define DUMMYUNIONNAME7
|
||||
# define DUMMYUNIONNAME8
|
||||
# define DUMMYUNIONNAME9
|
||||
# endif
|
||||
#endif /* DUMMYUNIONNAME */
|
||||
|
||||
#if !defined(DUMMYUNIONNAME1) /* MinGW does not define this one */
|
||||
# ifdef NONAMELESSUNION
|
||||
# define DUMMYUNIONNAME1 u1 /* Wine uses this variant */
|
||||
# else
|
||||
# define DUMMYUNIONNAME1 /* Wine uses this variant */
|
||||
# endif
|
||||
#endif /* DUMMYUNIONNAME1 */
|
||||
|
||||
#ifndef DUMMYSTRUCTNAME
|
||||
# ifdef NONAMELESSUNION
|
||||
# define DUMMYSTRUCTNAME s
|
||||
# define DUMMYSTRUCTNAME1 s1 /* Wine uses this variant */
|
||||
# define DUMMYSTRUCTNAME2 s2
|
||||
# define DUMMYSTRUCTNAME3 s3
|
||||
# define DUMMYSTRUCTNAME4 s4
|
||||
# define DUMMYSTRUCTNAME5 s5
|
||||
# else
|
||||
# define DUMMYSTRUCTNAME
|
||||
# define DUMMYSTRUCTNAME1 /* Wine uses this variant */
|
||||
# define DUMMYSTRUCTNAME2
|
||||
# define DUMMYSTRUCTNAME3
|
||||
# define DUMMYSTRUCTNAME4
|
||||
# define DUMMYSTRUCTNAME5
|
||||
# endif
|
||||
#endif /* DUMMYSTRUCTNAME */
|
||||
|
||||
/* These are for compatibility with the Wine source tree */
|
||||
|
||||
#ifndef WINELIB_NAME_AW
|
||||
# ifdef __MINGW_NAME_AW
|
||||
# define WINELIB_NAME_AW __MINGW_NAME_AW
|
||||
# else
|
||||
# ifdef UNICODE
|
||||
# define WINELIB_NAME_AW(func) func##W
|
||||
# else
|
||||
# define WINELIB_NAME_AW(func) func##A
|
||||
# endif
|
||||
# endif
|
||||
#endif /* WINELIB_NAME_AW */
|
||||
|
||||
#ifndef DECL_WINELIB_TYPE_AW
|
||||
# ifdef __MINGW_TYPEDEF_AW
|
||||
# define DECL_WINELIB_TYPE_AW __MINGW_TYPEDEF_AW
|
||||
# else
|
||||
# define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
|
||||
# endif
|
||||
#endif /* DECL_WINELIB_TYPE_AW */
|
||||
|
2467
deps/mingw/dinput.h
vendored
2467
deps/mingw/dinput.h
vendored
File diff suppressed because it is too large
Load Diff
239
deps/mingw/xinput.h
vendored
239
deps/mingw/xinput.h
vendored
@ -1,239 +0,0 @@
|
||||
/*
|
||||
* The Wine project - Xinput Joystick Library
|
||||
* Copyright 2008 Andrew Fenn
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __WINE_XINPUT_H
|
||||
#define __WINE_XINPUT_H
|
||||
|
||||
#include <windef.h>
|
||||
|
||||
/*
|
||||
* Bitmasks for the joysticks buttons, determines what has
|
||||
* been pressed on the joystick, these need to be mapped
|
||||
* to whatever device you're using instead of an xbox 360
|
||||
* joystick
|
||||
*/
|
||||
|
||||
#define XINPUT_GAMEPAD_DPAD_UP 0x0001
|
||||
#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
|
||||
#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
|
||||
#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
|
||||
#define XINPUT_GAMEPAD_START 0x0010
|
||||
#define XINPUT_GAMEPAD_BACK 0x0020
|
||||
#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
|
||||
#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
|
||||
#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
|
||||
#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
|
||||
#define XINPUT_GAMEPAD_A 0x1000
|
||||
#define XINPUT_GAMEPAD_B 0x2000
|
||||
#define XINPUT_GAMEPAD_X 0x4000
|
||||
#define XINPUT_GAMEPAD_Y 0x8000
|
||||
|
||||
/*
|
||||
* Defines the flags used to determine if the user is pushing
|
||||
* down on a button, not holding a button, etc
|
||||
*/
|
||||
|
||||
#define XINPUT_KEYSTROKE_KEYDOWN 0x0001
|
||||
#define XINPUT_KEYSTROKE_KEYUP 0x0002
|
||||
#define XINPUT_KEYSTROKE_REPEAT 0x0004
|
||||
|
||||
/*
|
||||
* Defines the codes which are returned by XInputGetKeystroke
|
||||
*/
|
||||
|
||||
#define VK_PAD_A 0x5800
|
||||
#define VK_PAD_B 0x5801
|
||||
#define VK_PAD_X 0x5802
|
||||
#define VK_PAD_Y 0x5803
|
||||
#define VK_PAD_RSHOULDER 0x5804
|
||||
#define VK_PAD_LSHOULDER 0x5805
|
||||
#define VK_PAD_LTRIGGER 0x5806
|
||||
#define VK_PAD_RTRIGGER 0x5807
|
||||
#define VK_PAD_DPAD_UP 0x5810
|
||||
#define VK_PAD_DPAD_DOWN 0x5811
|
||||
#define VK_PAD_DPAD_LEFT 0x5812
|
||||
#define VK_PAD_DPAD_RIGHT 0x5813
|
||||
#define VK_PAD_START 0x5814
|
||||
#define VK_PAD_BACK 0x5815
|
||||
#define VK_PAD_LTHUMB_PRESS 0x5816
|
||||
#define VK_PAD_RTHUMB_PRESS 0x5817
|
||||
#define VK_PAD_LTHUMB_UP 0x5820
|
||||
#define VK_PAD_LTHUMB_DOWN 0x5821
|
||||
#define VK_PAD_LTHUMB_RIGHT 0x5822
|
||||
#define VK_PAD_LTHUMB_LEFT 0x5823
|
||||
#define VK_PAD_LTHUMB_UPLEFT 0x5824
|
||||
#define VK_PAD_LTHUMB_UPRIGHT 0x5825
|
||||
#define VK_PAD_LTHUMB_DOWNRIGHT 0x5826
|
||||
#define VK_PAD_LTHUMB_DOWNLEFT 0x5827
|
||||
#define VK_PAD_RTHUMB_UP 0x5830
|
||||
#define VK_PAD_RTHUMB_DOWN 0x5831
|
||||
#define VK_PAD_RTHUMB_RIGHT 0x5832
|
||||
#define VK_PAD_RTHUMB_LEFT 0x5833
|
||||
#define VK_PAD_RTHUMB_UPLEFT 0x5834
|
||||
#define VK_PAD_RTHUMB_UPRIGHT 0x5835
|
||||
#define VK_PAD_RTHUMB_DOWNRIGHT 0x5836
|
||||
#define VK_PAD_RTHUMB_DOWNLEFT 0x5837
|
||||
|
||||
/*
|
||||
* Deadzones are for analogue joystick controls on the joypad
|
||||
* which determine when input should be assumed to be in the
|
||||
* middle of the pad. This is a threshold to stop a joypad
|
||||
* controlling the game when the player isn't touching the
|
||||
* controls.
|
||||
*/
|
||||
|
||||
#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
|
||||
#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
|
||||
#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30
|
||||
|
||||
|
||||
/*
|
||||
* Defines what type of abilities the type of joystick has
|
||||
* DEVTYPE_GAMEPAD is available for all joysticks, however
|
||||
* there may be more specific identifiers for other joysticks
|
||||
* which are being used.
|
||||
*/
|
||||
|
||||
#define XINPUT_DEVTYPE_GAMEPAD 0x01
|
||||
#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01
|
||||
#define XINPUT_DEVSUBTYPE_WHEEL 0x02
|
||||
#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03
|
||||
#define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04
|
||||
#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05
|
||||
#define XINPUT_DEVSUBTYPE_GUITAR 0x06
|
||||
#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08
|
||||
|
||||
/*
|
||||
* These are used with the XInputGetCapabilities function to
|
||||
* determine the abilities to the joystick which has been
|
||||
* plugged in.
|
||||
*/
|
||||
|
||||
#define XINPUT_CAPS_VOICE_SUPPORTED 0x0004
|
||||
#define XINPUT_FLAG_GAMEPAD 0x00000001
|
||||
|
||||
/*
|
||||
* Defines the status of the battery if one is used in the
|
||||
* attached joystick. The first two define if the joystick
|
||||
* supports a battery. Disconnected means that the joystick
|
||||
* isn't connected. Wired shows that the joystick is a wired
|
||||
* joystick.
|
||||
*/
|
||||
|
||||
#define BATTERY_DEVTYPE_GAMEPAD 0x00
|
||||
#define BATTERY_DEVTYPE_HEADSET 0x01
|
||||
#define BATTERY_TYPE_DISCONNECTED 0x00
|
||||
#define BATTERY_TYPE_WIRED 0x01
|
||||
#define BATTERY_TYPE_ALKALINE 0x02
|
||||
#define BATTERY_TYPE_NIMH 0x03
|
||||
#define BATTERY_TYPE_UNKNOWN 0xFF
|
||||
#define BATTERY_LEVEL_EMPTY 0x00
|
||||
#define BATTERY_LEVEL_LOW 0x01
|
||||
#define BATTERY_LEVEL_MEDIUM 0x02
|
||||
#define BATTERY_LEVEL_FULL 0x03
|
||||
|
||||
/*
|
||||
* How many joysticks can be used with this library. Games that
|
||||
* use the xinput library will not go over this number.
|
||||
*/
|
||||
|
||||
#define XUSER_MAX_COUNT 4
|
||||
#define XUSER_INDEX_ANY 0x000000FF
|
||||
|
||||
/*
|
||||
* Defines the structure of an xbox 360 joystick.
|
||||
*/
|
||||
|
||||
typedef struct _XINPUT_GAMEPAD {
|
||||
WORD wButtons;
|
||||
BYTE bLeftTrigger;
|
||||
BYTE bRightTrigger;
|
||||
SHORT sThumbLX;
|
||||
SHORT sThumbLY;
|
||||
SHORT sThumbRX;
|
||||
SHORT sThumbRY;
|
||||
} XINPUT_GAMEPAD, *PXINPUT_GAMEPAD;
|
||||
|
||||
typedef struct _XINPUT_STATE {
|
||||
DWORD dwPacketNumber;
|
||||
XINPUT_GAMEPAD Gamepad;
|
||||
} XINPUT_STATE, *PXINPUT_STATE;
|
||||
|
||||
/*
|
||||
* Defines the structure of how much vibration is set on both the
|
||||
* right and left motors in a joystick. If you're not using a 360
|
||||
* joystick you will have to map these to your device.
|
||||
*/
|
||||
|
||||
typedef struct _XINPUT_VIBRATION {
|
||||
WORD wLeftMotorSpeed;
|
||||
WORD wRightMotorSpeed;
|
||||
} XINPUT_VIBRATION, *PXINPUT_VIBRATION;
|
||||
|
||||
/*
|
||||
* Defines the structure for what kind of abilities the joystick has
|
||||
* such abilities are things such as if the joystick has the ability
|
||||
* to send and receive audio, if the joystick is in fact a driving
|
||||
* wheel or perhaps if the joystick is some kind of dance pad or
|
||||
* guitar.
|
||||
*/
|
||||
|
||||
typedef struct _XINPUT_CAPABILITIES {
|
||||
BYTE Type;
|
||||
BYTE SubType;
|
||||
WORD Flags;
|
||||
XINPUT_GAMEPAD Gamepad;
|
||||
XINPUT_VIBRATION Vibration;
|
||||
} XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES;
|
||||
|
||||
/*
|
||||
* Defines the structure for a joystick input event which is
|
||||
* retrieved using the function XInputGetKeystroke
|
||||
*/
|
||||
typedef struct _XINPUT_KEYSTROKE {
|
||||
WORD VirtualKey;
|
||||
WCHAR Unicode;
|
||||
WORD Flags;
|
||||
BYTE UserIndex;
|
||||
BYTE HidCode;
|
||||
} XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE;
|
||||
|
||||
typedef struct _XINPUT_BATTERY_INFORMATION
|
||||
{
|
||||
BYTE BatteryType;
|
||||
BYTE BatteryLevel;
|
||||
} XINPUT_BATTERY_INFORMATION, *PXINPUT_BATTERY_INFORMATION;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void WINAPI XInputEnable(WINBOOL);
|
||||
DWORD WINAPI XInputSetState(DWORD, XINPUT_VIBRATION*);
|
||||
DWORD WINAPI XInputGetState(DWORD, XINPUT_STATE*);
|
||||
DWORD WINAPI XInputGetKeystroke(DWORD, DWORD, PXINPUT_KEYSTROKE);
|
||||
DWORD WINAPI XInputGetCapabilities(DWORD, DWORD, XINPUT_CAPABILITIES*);
|
||||
DWORD WINAPI XInputGetDSoundAudioDeviceGuids(DWORD, GUID*, GUID*);
|
||||
DWORD WINAPI XInputGetBatteryInformation(DWORD, BYTE, XINPUT_BATTERY_INFORMATION*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __WINE_XINPUT_H */
|
253
deps/wayland/pointer-gestures-unstable-v1.xml
vendored
Normal file
253
deps/wayland/pointer-gestures-unstable-v1.xml
vendored
Normal file
@ -0,0 +1,253 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="pointer_gestures_unstable_v1">
|
||||
|
||||
<interface name="zwp_pointer_gestures_v1" version="3">
|
||||
<description summary="touchpad gestures">
|
||||
A global interface to provide semantic touchpad gestures for a given
|
||||
pointer.
|
||||
|
||||
Three gestures are currently supported: swipe, pinch, and hold.
|
||||
Pinch and swipe gestures follow a three-stage cycle: begin, update,
|
||||
end, hold gestures follow a two-stage cycle: begin and end. All
|
||||
gestures are identified by a unique id.
|
||||
|
||||
Warning! The protocol described in this file is experimental and
|
||||
backward incompatible changes may be made. Backward compatible changes
|
||||
may be added together with the corresponding interface version bump.
|
||||
Backward incompatible changes are done by bumping the version number in
|
||||
the protocol and interface names and resetting the interface version.
|
||||
Once the protocol is to be declared stable, the 'z' prefix and the
|
||||
version number in the protocol and interface names are removed and the
|
||||
interface version number is reset.
|
||||
</description>
|
||||
|
||||
<request name="get_swipe_gesture">
|
||||
<description summary="get swipe gesture">
|
||||
Create a swipe gesture object. See the
|
||||
wl_pointer_gesture_swipe interface for details.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwp_pointer_gesture_swipe_v1"/>
|
||||
<arg name="pointer" type="object" interface="wl_pointer"/>
|
||||
</request>
|
||||
|
||||
<request name="get_pinch_gesture">
|
||||
<description summary="get pinch gesture">
|
||||
Create a pinch gesture object. See the
|
||||
wl_pointer_gesture_pinch interface for details.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwp_pointer_gesture_pinch_v1"/>
|
||||
<arg name="pointer" type="object" interface="wl_pointer"/>
|
||||
</request>
|
||||
|
||||
<!-- Version 2 additions -->
|
||||
|
||||
<request name="release" type="destructor" since="2">
|
||||
<description summary="destroy the pointer gesture object">
|
||||
Destroy the pointer gesture object. Swipe, pinch and hold objects
|
||||
created via this gesture object remain valid.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<!-- Version 3 additions -->
|
||||
|
||||
<request name="get_hold_gesture" since="3">
|
||||
<description summary="get hold gesture">
|
||||
Create a hold gesture object. See the
|
||||
wl_pointer_gesture_hold interface for details.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwp_pointer_gesture_hold_v1"/>
|
||||
<arg name="pointer" type="object" interface="wl_pointer"/>
|
||||
</request>
|
||||
|
||||
</interface>
|
||||
|
||||
<interface name="zwp_pointer_gesture_swipe_v1" version="2">
|
||||
<description summary="a swipe gesture object">
|
||||
A swipe gesture object notifies a client about a multi-finger swipe
|
||||
gesture detected on an indirect input device such as a touchpad.
|
||||
The gesture is usually initiated by multiple fingers moving in the
|
||||
same direction but once initiated the direction may change.
|
||||
The precise conditions of when such a gesture is detected are
|
||||
implementation-dependent.
|
||||
|
||||
A gesture consists of three stages: begin, update (optional) and end.
|
||||
There cannot be multiple simultaneous hold, pinch or swipe gestures on a
|
||||
same pointer/seat, how compositors prevent these situations is
|
||||
implementation-dependent.
|
||||
|
||||
A gesture may be cancelled by the compositor or the hardware.
|
||||
Clients should not consider performing permanent or irreversible
|
||||
actions until the end of a gesture has been received.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the pointer swipe gesture object"/>
|
||||
</request>
|
||||
|
||||
<event name="begin">
|
||||
<description summary="multi-finger swipe begin">
|
||||
This event is sent when a multi-finger swipe gesture is detected
|
||||
on the device.
|
||||
</description>
|
||||
<arg name="serial" type="uint"/>
|
||||
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
|
||||
<arg name="surface" type="object" interface="wl_surface"/>
|
||||
<arg name="fingers" type="uint" summary="number of fingers"/>
|
||||
</event>
|
||||
|
||||
<event name="update">
|
||||
<description summary="multi-finger swipe motion">
|
||||
This event is sent when a multi-finger swipe gesture changes the
|
||||
position of the logical center.
|
||||
|
||||
The dx and dy coordinates are relative coordinates of the logical
|
||||
center of the gesture compared to the previous event.
|
||||
</description>
|
||||
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
|
||||
<arg name="dx" type="fixed" summary="delta x coordinate in surface coordinate space"/>
|
||||
<arg name="dy" type="fixed" summary="delta y coordinate in surface coordinate space"/>
|
||||
</event>
|
||||
|
||||
<event name="end">
|
||||
<description summary="multi-finger swipe end">
|
||||
This event is sent when a multi-finger swipe gesture ceases to
|
||||
be valid. This may happen when one or more fingers are lifted or
|
||||
the gesture is cancelled.
|
||||
|
||||
When a gesture is cancelled, the client should undo state changes
|
||||
caused by this gesture. What causes a gesture to be cancelled is
|
||||
implementation-dependent.
|
||||
</description>
|
||||
<arg name="serial" type="uint"/>
|
||||
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
|
||||
<arg name="cancelled" type="int" summary="1 if the gesture was cancelled, 0 otherwise"/>
|
||||
</event>
|
||||
</interface>
|
||||
|
||||
<interface name="zwp_pointer_gesture_pinch_v1" version="2">
|
||||
<description summary="a pinch gesture object">
|
||||
A pinch gesture object notifies a client about a multi-finger pinch
|
||||
gesture detected on an indirect input device such as a touchpad.
|
||||
The gesture is usually initiated by multiple fingers moving towards
|
||||
each other or away from each other, or by two or more fingers rotating
|
||||
around a logical center of gravity. The precise conditions of when
|
||||
such a gesture is detected are implementation-dependent.
|
||||
|
||||
A gesture consists of three stages: begin, update (optional) and end.
|
||||
There cannot be multiple simultaneous hold, pinch or swipe gestures on a
|
||||
same pointer/seat, how compositors prevent these situations is
|
||||
implementation-dependent.
|
||||
|
||||
A gesture may be cancelled by the compositor or the hardware.
|
||||
Clients should not consider performing permanent or irreversible
|
||||
actions until the end of a gesture has been received.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the pinch gesture object"/>
|
||||
</request>
|
||||
|
||||
<event name="begin">
|
||||
<description summary="multi-finger pinch begin">
|
||||
This event is sent when a multi-finger pinch gesture is detected
|
||||
on the device.
|
||||
</description>
|
||||
<arg name="serial" type="uint"/>
|
||||
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
|
||||
<arg name="surface" type="object" interface="wl_surface"/>
|
||||
<arg name="fingers" type="uint" summary="number of fingers"/>
|
||||
</event>
|
||||
|
||||
<event name="update">
|
||||
<description summary="multi-finger pinch motion">
|
||||
This event is sent when a multi-finger pinch gesture changes the
|
||||
position of the logical center, the rotation or the relative scale.
|
||||
|
||||
The dx and dy coordinates are relative coordinates in the
|
||||
surface coordinate space of the logical center of the gesture.
|
||||
|
||||
The scale factor is an absolute scale compared to the
|
||||
pointer_gesture_pinch.begin event, e.g. a scale of 2 means the fingers
|
||||
are now twice as far apart as on pointer_gesture_pinch.begin.
|
||||
|
||||
The rotation is the relative angle in degrees clockwise compared to the previous
|
||||
pointer_gesture_pinch.begin or pointer_gesture_pinch.update event.
|
||||
</description>
|
||||
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
|
||||
<arg name="dx" type="fixed" summary="delta x coordinate in surface coordinate space"/>
|
||||
<arg name="dy" type="fixed" summary="delta y coordinate in surface coordinate space"/>
|
||||
<arg name="scale" type="fixed" summary="scale relative to the initial finger position"/>
|
||||
<arg name="rotation" type="fixed" summary="angle in degrees cw relative to the previous event"/>
|
||||
</event>
|
||||
|
||||
<event name="end">
|
||||
<description summary="multi-finger pinch end">
|
||||
This event is sent when a multi-finger pinch gesture ceases to
|
||||
be valid. This may happen when one or more fingers are lifted or
|
||||
the gesture is cancelled.
|
||||
|
||||
When a gesture is cancelled, the client should undo state changes
|
||||
caused by this gesture. What causes a gesture to be cancelled is
|
||||
implementation-dependent.
|
||||
</description>
|
||||
<arg name="serial" type="uint"/>
|
||||
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
|
||||
<arg name="cancelled" type="int" summary="1 if the gesture was cancelled, 0 otherwise"/>
|
||||
</event>
|
||||
|
||||
</interface>
|
||||
|
||||
<interface name="zwp_pointer_gesture_hold_v1" version="3">
|
||||
<description summary="a hold gesture object">
|
||||
A hold gesture object notifies a client about a single- or
|
||||
multi-finger hold gesture detected on an indirect input device such as
|
||||
a touchpad. The gesture is usually initiated by one or more fingers
|
||||
being held down without significant movement. The precise conditions
|
||||
of when such a gesture is detected are implementation-dependent.
|
||||
|
||||
In particular, this gesture may be used to cancel kinetic scrolling.
|
||||
|
||||
A hold gesture consists of two stages: begin and end. Unlike pinch and
|
||||
swipe there is no update stage.
|
||||
There cannot be multiple simultaneous hold, pinch or swipe gestures on a
|
||||
same pointer/seat, how compositors prevent these situations is
|
||||
implementation-dependent.
|
||||
|
||||
A gesture may be cancelled by the compositor or the hardware.
|
||||
Clients should not consider performing permanent or irreversible
|
||||
actions until the end of a gesture has been received.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor" since="3">
|
||||
<description summary="destroy the hold gesture object"/>
|
||||
</request>
|
||||
|
||||
<event name="begin" since="3">
|
||||
<description summary="multi-finger hold begin">
|
||||
This event is sent when a hold gesture is detected on the device.
|
||||
</description>
|
||||
<arg name="serial" type="uint"/>
|
||||
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
|
||||
<arg name="surface" type="object" interface="wl_surface"/>
|
||||
<arg name="fingers" type="uint" summary="number of fingers"/>
|
||||
</event>
|
||||
|
||||
<event name="end" since="3">
|
||||
<description summary="multi-finger hold end">
|
||||
This event is sent when a hold gesture ceases to
|
||||
be valid. This may happen when the holding fingers are lifted or
|
||||
the gesture is cancelled, for example if the fingers move past an
|
||||
implementation-defined threshold, the finger count changes or the hold
|
||||
gesture changes into a different type of gesture.
|
||||
|
||||
When a gesture is cancelled, the client may need to undo state changes
|
||||
caused by this gesture. What causes a gesture to be cancelled is
|
||||
implementation-dependent.
|
||||
</description>
|
||||
<arg name="serial" type="uint"/>
|
||||
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
|
||||
<arg name="cancelled" type="int" summary="1 if the gesture was cancelled, 0 otherwise"/>
|
||||
</event>
|
||||
|
||||
</interface>
|
||||
</protocol>
|
@ -158,6 +158,12 @@ less than the actual scale.
|
||||
|
||||
[fractional-scale-v1]: https://wayland.app/protocols/fractional-scale-v1
|
||||
|
||||
GLFW uses the [pointer-gestures-unstable-v1][] protocol to handle trackpad
|
||||
pinch and rotate gestures. If the running compositor does not support this
|
||||
protocol, trackpad pinch and rotate gestures will not be emitted.
|
||||
|
||||
[pointer-gestures-unstable-v1]: https://wayland.app/protocols/pointer-gestures-unstable-v1
|
||||
|
||||
|
||||
## GLX extensions {#compat_glx}
|
||||
|
||||
|
@ -36,9 +36,9 @@ specific to GLFW. It may be a useful companion to this one.
|
||||
|
||||
### Installing dependencies {#compile_deps}
|
||||
|
||||
The C/C++ development environments in Visual Studio, Xcode and MinGW come with
|
||||
all necessary dependencies for compiling GLFW, but on Unix-like systems like
|
||||
Linux and FreeBSD you will need a few extra packages.
|
||||
The C/C++ development environments in Visual Studio, Xcode and MinGW-w64 come
|
||||
with all necessary dependencies for compiling GLFW, but on Unix-like systems
|
||||
like Linux and FreeBSD you will need a few extra packages.
|
||||
|
||||
|
||||
#### Dependencies for Wayland and X11 {#compile_deps_wayland}
|
||||
@ -180,7 +180,7 @@ cd path/to/build
|
||||
make
|
||||
```
|
||||
|
||||
With MinGW, it is `mingw32-make`.
|
||||
With MinGW-w64, it is `mingw32-make`.
|
||||
|
||||
```sh
|
||||
cd path/to/build
|
||||
@ -299,12 +299,12 @@ library. This option is only available when compiling for Linux and other Unix-
|
||||
systems other than macOS. This is enabled by default.
|
||||
|
||||
|
||||
## Cross-compilation with CMake and MinGW {#compile_mingw_cross}
|
||||
## Cross-compilation with CMake and MinGW-w64 {#compile_mingw_cross}
|
||||
|
||||
Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages. For
|
||||
example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages
|
||||
for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives
|
||||
like Ubuntu have the `mingw-w64` package for both.
|
||||
Both Cygwin and many Linux distributions have MinGW-w64 packages. For example,
|
||||
Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages for 32- and
|
||||
64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives like Ubuntu
|
||||
have the `mingw-w64` package for both.
|
||||
|
||||
GLFW has CMake toolchain files in the `CMake` subdirectory that set up
|
||||
cross-compilation of Windows binaries. To use these files you set the
|
||||
@ -315,9 +315,9 @@ configuring and generating the build files.
|
||||
cmake -S path/to/glfw -B path/to/build -D CMAKE_TOOLCHAIN_FILE=path/to/file
|
||||
```
|
||||
|
||||
The exact toolchain file to use depends on the prefix used by the MinGW or
|
||||
MinGW-w64 binaries on your system. You can usually see this in the /usr
|
||||
directory. For example, both the Ubuntu and Cygwin MinGW-w64 packages have
|
||||
The exact toolchain file to use depends on the prefix used by the MinGW-w64
|
||||
binaries on your system. You can usually see this in the /usr directory. For
|
||||
example, both the Ubuntu and Cygwin MinGW-w64 packages have
|
||||
`/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct invocation
|
||||
would be:
|
||||
|
||||
|
@ -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}
|
||||
|
||||
|
@ -621,11 +621,11 @@ The format of the string is as follows:
|
||||
- The names of the always supported context creation APIs EGL and OSMesa
|
||||
- Any additional compile-time options, APIs and (on Windows) what compiler was used
|
||||
|
||||
For example, compiling GLFW 3.5 with MinGW as a DLL for Windows, may result in a version string
|
||||
like this:
|
||||
For example, compiling GLFW 3.5 with MinGW-64 as a DLL for Windows, may result
|
||||
in a version string like this:
|
||||
|
||||
```c
|
||||
3.5.0 Win32 WGL Null EGL OSMesa MinGW DLL
|
||||
3.5.0 Win32 WGL Null EGL OSMesa MinGW-w64 DLL
|
||||
```
|
||||
|
||||
Compiling GLFW as a static library for Linux, with both Wayland and X11 enabled, may
|
||||
|
15
docs/news.md
15
docs/news.md
@ -14,12 +14,27 @@ values over 8. For compatibility with older versions, the
|
||||
@ref GLFW_UNLIMITED_MOUSE_BUTTONS input mode needs to be set to make use of
|
||||
this.
|
||||
|
||||
### Support for trackpad zoom and rotate on macOS and Wayland
|
||||
|
||||
Trackpad zoom and rotate events are now supported on macOS and Wayland using
|
||||
[glfwSetTrackpadZoomCallback](@ref glfwSetTrackpadZoomCallback) and [glfwSetTrackpadRotateCallback](@ref glfwSetTrackpadRotateCallback). These
|
||||
events will not yet emit anything on Windows or X11.
|
||||
|
||||
## Caveats {#caveats}
|
||||
|
||||
## Deprecations {#deprecations}
|
||||
|
||||
## Removals {#removals}
|
||||
|
||||
### Original MinGW support has been removed {#original_mingw}
|
||||
|
||||
Support for the now unmaintained original MinGW distribution has been removed.
|
||||
|
||||
This does not apply to the much more capable [MinGW-w64](https://www.mingw-w64.org/),
|
||||
which remains fully supported. MinGW-w64 can build both 32- and 64-bit binaries, is
|
||||
actively maintained and available on many platforms.
|
||||
|
||||
|
||||
## New symbols {#new_symbols}
|
||||
|
||||
### New functions {#new_functions}
|
||||
|
@ -1871,6 +1871,41 @@ typedef void (* GLFWcursorenterfun)(GLFWwindow* window, int entered);
|
||||
*/
|
||||
typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffset);
|
||||
|
||||
/*! @brief The function pointer type for trackpad zoom callbacks.
|
||||
*
|
||||
* This is the function pointer type for trackpad zoom callbacks. A zoom
|
||||
* callback function has the following signature:
|
||||
* @code
|
||||
* void function_name(GLFWwindow* window, double scale)
|
||||
* @endcode
|
||||
*
|
||||
* @param[in] window The window that received the event.
|
||||
* @param[in] scale The manigification amount, to be multiplied by the current
|
||||
* scale factor to get the new scale factor.
|
||||
*
|
||||
* @sa @ref glfwSetTrackpadZoomCallback
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
typedef void (* GLFWtrackpadzoomfun)(GLFWwindow* window, double scale);
|
||||
|
||||
/*! @brief The function pointer type for trackpad rotate callbacks.
|
||||
*
|
||||
* This is the function pointer type for trackpad rotate callbacks. A rotate
|
||||
* callback function has the following signature:
|
||||
* @code
|
||||
* void function_name(GLFWwindow* window, double angle)
|
||||
* @endcode
|
||||
*
|
||||
* @param[in] window The window that received the event.
|
||||
* @param[in] angle The rotation amount, in degrees
|
||||
*
|
||||
* @sa @ref glfwSetTrackpadRotateCallback
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
typedef void (* GLFWtrackpadrotatefun)(GLFWwindow* window, double angle);
|
||||
|
||||
/*! @brief The function pointer type for keyboard key callbacks.
|
||||
*
|
||||
* This is the function pointer type for keyboard key callbacks. A keyboard
|
||||
@ -5430,6 +5465,66 @@ GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcu
|
||||
*/
|
||||
GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun callback);
|
||||
|
||||
/*! @brief Sets the trackpad zoom callback.
|
||||
*
|
||||
* This function sets the trackpad zoom of the specified window, which is
|
||||
* called when a trackpad magnification gesture is used on macOS.
|
||||
*
|
||||
* @param[in] window The window whose callback to set.
|
||||
* @param[in] callback The new trackpad zoom callback, or `NULL` to remove the
|
||||
* currently set callback.
|
||||
* @return The previously set callback, or `NULL` if no callback was set or the
|
||||
* library had not been [initialized](@ref intro_init).
|
||||
*
|
||||
* @callback_signature
|
||||
* @code
|
||||
* void function_name(GLFWwindow* window, double scale)
|
||||
* @endcode
|
||||
* For more information about the callback parameters, see the
|
||||
* [function pointer type](@ref GLFWtrackpadzoomfun).
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @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);
|
||||
|
||||
/*! @brief Sets the trackpad rotate callback.
|
||||
*
|
||||
* This function sets the trackpad rotate of the specified window, which is
|
||||
* called when a trackpad rotation gesture is used on macOS.
|
||||
*
|
||||
* @param[in] window The window whose callback to set.
|
||||
* @param[in] callback The new trackpad rotate callback, or `NULL` to remove the
|
||||
* currently set callback.
|
||||
* @return The previously set callback, or `NULL` if no callback was set or the
|
||||
* library had not been [initialized](@ref intro_init).
|
||||
*
|
||||
* @callback_signature
|
||||
* @code
|
||||
* void function_name(GLFWwindow* window, double angle)
|
||||
* @endcode
|
||||
* For more information about the callback parameters, see the
|
||||
* [function pointer type](@ref GLFWtrackpadrotatefun).
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @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);
|
||||
|
||||
/*! @brief Sets the path drop callback.
|
||||
*
|
||||
* This function sets the path drop callback of the specified window, which is
|
||||
|
@ -105,6 +105,7 @@ if (GLFW_BUILD_WAYLAND)
|
||||
generate_wayland_protocol("fractional-scale-v1.xml")
|
||||
generate_wayland_protocol("xdg-activation-v1.xml")
|
||||
generate_wayland_protocol("xdg-decoration-unstable-v1.xml")
|
||||
generate_wayland_protocol("pointer-gestures-unstable-v1.xml")
|
||||
endif()
|
||||
|
||||
if (WIN32 AND GLFW_BUILD_SHARED_LIBRARY)
|
||||
@ -255,24 +256,6 @@ if (GLFW_BUILD_WIN32)
|
||||
target_compile_definitions(glfw PRIVATE UNICODE _UNICODE)
|
||||
endif()
|
||||
|
||||
# HACK: When building on MinGW, WINVER and UNICODE need to be defined before
|
||||
# the inclusion of stddef.h (by glfw3.h), which is itself included before
|
||||
# win32_platform.h. We define them here until a saner solution can be found
|
||||
# NOTE: MinGW-w64 and Visual C++ do /not/ need this hack.
|
||||
if (MINGW)
|
||||
target_compile_definitions(glfw PRIVATE WINVER=0x0501)
|
||||
endif()
|
||||
|
||||
# Workaround for legacy MinGW not providing XInput and DirectInput
|
||||
if (MINGW)
|
||||
include(CheckIncludeFile)
|
||||
check_include_file(dinput.h DINPUT_H_FOUND)
|
||||
check_include_file(xinput.h XINPUT_H_FOUND)
|
||||
if (NOT DINPUT_H_FOUND OR NOT XINPUT_H_FOUND)
|
||||
target_include_directories(glfw PRIVATE "${GLFW_SOURCE_DIR}/deps/mingw")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Workaround for the MS CRT deprecating parts of the standard library
|
||||
if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
|
||||
target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
@ -286,10 +269,6 @@ endif()
|
||||
if (GLFW_BUILD_SHARED_LIBRARY)
|
||||
if (WIN32)
|
||||
if (MINGW)
|
||||
# Remove the dependency on the shared version of libgcc
|
||||
# NOTE: MinGW-w64 has the correct default but MinGW needs this
|
||||
target_link_libraries(glfw PRIVATE "-static-libgcc")
|
||||
|
||||
# Remove the lib prefix on the DLL (but not the import library)
|
||||
set_target_properties(glfw PROPERTIES PREFIX "")
|
||||
|
||||
|
@ -614,6 +614,24 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
||||
_glfwInputScroll(window, deltaX, deltaY);
|
||||
}
|
||||
|
||||
- (void)magnifyWithEvent:(NSEvent *)event
|
||||
{
|
||||
double magnification = [event magnification];
|
||||
|
||||
// 1.0 is added to convert the magnification value to a scale factor,
|
||||
// as suggested in apple documentation
|
||||
if (fabs(magnification) > 0.0)
|
||||
_glfwInputTrackpadZoom(window, magnification + 1.0);
|
||||
}
|
||||
|
||||
- (void)rotateWithEvent:(NSEvent *)event
|
||||
{
|
||||
double rotation = [event rotation];
|
||||
|
||||
if (fabs(rotation) > 0.0)
|
||||
_glfwInputTrackpadRotate(window, rotation);
|
||||
}
|
||||
|
||||
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
|
||||
{
|
||||
// HACK: We don't know what to say here because we don't know what the
|
||||
|
46
src/input.c
46
src/input.c
@ -342,6 +342,30 @@ void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)
|
||||
window->callbacks.scroll((GLFWwindow*) window, xoffset, yoffset);
|
||||
}
|
||||
|
||||
// Notifies shared code of a trackpad zoom event
|
||||
//
|
||||
void _glfwInputTrackpadZoom(_GLFWwindow* window, double scale)
|
||||
{
|
||||
assert(window != NULL);
|
||||
assert(scale > -FLT_MAX);
|
||||
assert(scale < FLT_MAX);
|
||||
|
||||
if (window->callbacks.trackpadZoom)
|
||||
window->callbacks.trackpadZoom((GLFWwindow*) window, scale);
|
||||
}
|
||||
|
||||
// Notifies shared code of a trackpad rotate event
|
||||
//
|
||||
void _glfwInputTrackpadRotate(_GLFWwindow* window, double angle)
|
||||
{
|
||||
assert(window != NULL);
|
||||
assert(angle > -FLT_MAX);
|
||||
assert(angle < FLT_MAX);
|
||||
|
||||
if (window->callbacks.trackpadRotate)
|
||||
window->callbacks.trackpadRotate((GLFWwindow*) window, angle);
|
||||
}
|
||||
|
||||
// Notifies shared code of a mouse button click event
|
||||
//
|
||||
void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
|
||||
@ -1034,6 +1058,28 @@ GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* handle,
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI GLFWtrackpadzoomfun glfwSetTrackpadZoomCallback(GLFWwindow* handle,
|
||||
GLFWtrackpadzoomfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
_GLFW_SWAP(GLFWtrackpadzoomfun, window->callbacks.trackpadZoom, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI GLFWtrackpadrotatefun glfwSetTrackpadRotateCallback(GLFWwindow* handle,
|
||||
GLFWtrackpadrotatefun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
_GLFW_SWAP(GLFWtrackpadrotatefun, window->callbacks.trackpadRotate, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* handle, GLFWdropfun cbfun)
|
||||
{
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
@ -577,6 +577,8 @@ struct _GLFWwindow
|
||||
GLFWcursorposfun cursorPos;
|
||||
GLFWcursorenterfun cursorEnter;
|
||||
GLFWscrollfun scroll;
|
||||
GLFWtrackpadzoomfun trackpadZoom;
|
||||
GLFWtrackpadrotatefun trackpadRotate;
|
||||
GLFWkeyfun key;
|
||||
GLFWcharfun character;
|
||||
GLFWcharmodsfun charmods;
|
||||
@ -935,6 +937,8 @@ void _glfwInputKey(_GLFWwindow* window,
|
||||
void _glfwInputChar(_GLFWwindow* window,
|
||||
uint32_t codepoint, int mods, GLFWbool plain);
|
||||
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset);
|
||||
void _glfwInputTrackpadZoom(_GLFWwindow* window, double scale);
|
||||
void _glfwInputTrackpadRotate(_GLFWwindow* window, double angle);
|
||||
void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods);
|
||||
void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos);
|
||||
void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered);
|
||||
|
@ -187,8 +187,6 @@ GLFWAPI const char* glfwGetVersionString(void)
|
||||
" OSMesa"
|
||||
#if defined(__MINGW64_VERSION_MAJOR)
|
||||
" MinGW-w64"
|
||||
#elif defined(__MINGW32__)
|
||||
" MinGW"
|
||||
#elif defined(_MSC_VER)
|
||||
" VisualC"
|
||||
#endif
|
||||
|
@ -83,24 +83,12 @@
|
||||
#ifndef WM_COPYGLOBALDATA
|
||||
#define WM_COPYGLOBALDATA 0x0049
|
||||
#endif
|
||||
#ifndef WM_UNICHAR
|
||||
#define WM_UNICHAR 0x0109
|
||||
#endif
|
||||
#ifndef UNICODE_NOCHAR
|
||||
#define UNICODE_NOCHAR 0xFFFF
|
||||
#endif
|
||||
#ifndef WM_DPICHANGED
|
||||
#define WM_DPICHANGED 0x02E0
|
||||
#endif
|
||||
#ifndef GET_XBUTTON_WPARAM
|
||||
#define GET_XBUTTON_WPARAM(w) (HIWORD(w))
|
||||
#endif
|
||||
#ifndef EDS_ROTATEDMODE
|
||||
#define EDS_ROTATEDMODE 0x00000004
|
||||
#endif
|
||||
#ifndef DISPLAY_DEVICE_ACTIVE
|
||||
#define DISPLAY_DEVICE_ACTIVE 0x00000001
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT_WINBLUE
|
||||
#define _WIN32_WINNT_WINBLUE 0x0603
|
||||
#endif
|
||||
@ -113,9 +101,6 @@
|
||||
#ifndef USER_DEFAULT_SCREEN_DPI
|
||||
#define USER_DEFAULT_SCREEN_DPI 96
|
||||
#endif
|
||||
#ifndef OCR_HAND
|
||||
#define OCR_HAND 32649
|
||||
#endif
|
||||
|
||||
#if WINVER < 0x0601
|
||||
typedef struct
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "fractional-scale-v1-client-protocol.h"
|
||||
#include "xdg-activation-v1-client-protocol.h"
|
||||
#include "idle-inhibit-unstable-v1-client-protocol.h"
|
||||
#include "pointer-gestures-unstable-v1-client-protocol.h"
|
||||
|
||||
// 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
|
||||
@ -91,6 +92,10 @@
|
||||
#include "idle-inhibit-unstable-v1-client-protocol-code.h"
|
||||
#undef types
|
||||
|
||||
#define types _glfw_pointer_gestures_types
|
||||
#include "pointer-gestures-unstable-v1-client-protocol-code.h"
|
||||
#undef types
|
||||
|
||||
static void wmBaseHandlePing(void* userData,
|
||||
struct xdg_wm_base* wmBase,
|
||||
uint32_t serial)
|
||||
@ -208,6 +213,14 @@ static void registryHandleGlobal(void* userData,
|
||||
&wp_fractional_scale_manager_v1_interface,
|
||||
1);
|
||||
}
|
||||
else if (strcmp(interface, "zwp_pointer_gestures_v1") == 0)
|
||||
{
|
||||
_glfw.wl.pointerGestures =
|
||||
wl_registry_bind(registry, name,
|
||||
&zwp_pointer_gestures_v1_interface,
|
||||
1);
|
||||
_glfwAddPointerGesturesListeners(_glfw.wl.pointerGestures);
|
||||
}
|
||||
}
|
||||
|
||||
static void registryHandleGlobalRemove(void* userData,
|
||||
@ -988,6 +1001,10 @@ void _glfwTerminateWayland(void)
|
||||
xdg_activation_v1_destroy(_glfw.wl.activationManager);
|
||||
if (_glfw.wl.fractionalScaleManager)
|
||||
wp_fractional_scale_manager_v1_destroy(_glfw.wl.fractionalScaleManager);
|
||||
if (_glfw.wl.pinchGesture)
|
||||
zwp_pointer_gesture_pinch_v1_destroy(_glfw.wl.pinchGesture);
|
||||
if (_glfw.wl.pointerGestures)
|
||||
zwp_pointer_gestures_v1_destroy(_glfw.wl.pointerGestures);
|
||||
if (_glfw.wl.registry)
|
||||
wl_registry_destroy(_glfw.wl.registry);
|
||||
if (_glfw.wl.display)
|
||||
|
@ -116,6 +116,7 @@ struct wl_output;
|
||||
#define zwp_pointer_constraints_v1_interface _glfw_zwp_pointer_constraints_v1_interface
|
||||
#define zwp_relative_pointer_v1_interface _glfw_zwp_relative_pointer_v1_interface
|
||||
#define zwp_relative_pointer_manager_v1_interface _glfw_zwp_relative_pointer_manager_v1_interface
|
||||
#define zwp_pointer_gestures_v1_interface _glfw_zwp_pointer_gestures_v1_interface
|
||||
#define wp_viewport_interface _glfw_wp_viewport_interface
|
||||
#define wp_viewporter_interface _glfw_wp_viewporter_interface
|
||||
#define xdg_toplevel_interface _glfw_xdg_toplevel_interface
|
||||
@ -438,6 +439,8 @@ typedef struct _GLFWlibraryWayland
|
||||
struct zwp_idle_inhibit_manager_v1* idleInhibitManager;
|
||||
struct xdg_activation_v1* activationManager;
|
||||
struct wp_fractional_scale_manager_v1* fractionalScaleManager;
|
||||
struct zwp_pointer_gestures_v1* pointerGestures;
|
||||
struct zwp_pointer_gesture_pinch_v1* pinchGesture;
|
||||
|
||||
_GLFWofferWayland* offers;
|
||||
unsigned int offerCount;
|
||||
@ -469,6 +472,8 @@ typedef struct _GLFWlibraryWayland
|
||||
short int scancodes[GLFW_KEY_LAST + 1];
|
||||
char keynames[GLFW_KEY_LAST + 1][5];
|
||||
|
||||
double pinchGesturePreviousScale;
|
||||
|
||||
struct {
|
||||
void* handle;
|
||||
struct xkb_context* context;
|
||||
@ -691,4 +696,5 @@ void _glfwUpdateBufferScaleFromOutputsWayland(_GLFWwindow* window);
|
||||
|
||||
void _glfwAddSeatListenerWayland(struct wl_seat* seat);
|
||||
void _glfwAddDataDeviceListenerWayland(struct wl_data_device* device);
|
||||
void _glfwAddPointerGesturesListeners(struct zwp_pointer_gestures_v1* pointer_gestures);
|
||||
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "xdg-activation-v1-client-protocol.h"
|
||||
#include "idle-inhibit-unstable-v1-client-protocol.h"
|
||||
#include "fractional-scale-v1-client-protocol.h"
|
||||
#include "pointer-gestures-unstable-v1-client-protocol.h"
|
||||
|
||||
#define GLFW_BORDER_SIZE 4
|
||||
#define GLFW_CAPTION_HEIGHT 24
|
||||
@ -1635,6 +1636,53 @@ static const struct wl_pointer_listener pointerListener =
|
||||
pointerHandleAxis,
|
||||
};
|
||||
|
||||
static void pointerGesturesHandlePinchBegin(void *userData,
|
||||
struct zwp_pointer_gesture_pinch_v1 *zwp_pointer_gesture_pinch_v1,
|
||||
uint32_t serial,
|
||||
uint32_t time,
|
||||
struct wl_surface *surface,
|
||||
uint32_t fingers)
|
||||
{
|
||||
_glfw.wl.pinchGesturePreviousScale = 1.0;
|
||||
}
|
||||
|
||||
static void pointerGesturesHandlePinchMotion(void *userData,
|
||||
struct zwp_pointer_gesture_pinch_v1 *zwp_pointer_gesture_pinch_v1,
|
||||
uint32_t time,
|
||||
wl_fixed_t dx,
|
||||
wl_fixed_t dy,
|
||||
wl_fixed_t scale,
|
||||
wl_fixed_t rotation)
|
||||
{
|
||||
_GLFWwindow* window = _glfw.wl.pointerFocus;
|
||||
|
||||
double zoom_value = wl_fixed_to_double(scale);
|
||||
double prev_zoom_value = _glfw.wl.pinchGesturePreviousScale;
|
||||
double zoom_delta = zoom_value / prev_zoom_value;
|
||||
_glfw.wl.pinchGesturePreviousScale = zoom_value;
|
||||
|
||||
double rotation_value = wl_fixed_to_double(rotation);
|
||||
|
||||
_glfwInputTrackpadZoom(window, zoom_delta);
|
||||
_glfwInputTrackpadRotate(window, rotation_value);
|
||||
}
|
||||
|
||||
static void pointerGesturesHandlePinchEnd(void *userData,
|
||||
struct zwp_pointer_gesture_pinch_v1 *zwp_pointer_gesture_pinch_v1,
|
||||
uint32_t serial,
|
||||
uint32_t time,
|
||||
int32_t cancelled)
|
||||
{
|
||||
_glfw.wl.pinchGesturePreviousScale = 1.0;
|
||||
}
|
||||
|
||||
static const struct zwp_pointer_gesture_pinch_v1_listener pinchGestureListener =
|
||||
{
|
||||
pointerGesturesHandlePinchBegin,
|
||||
pointerGesturesHandlePinchMotion,
|
||||
pointerGesturesHandlePinchEnd,
|
||||
};
|
||||
|
||||
static void keyboardHandleKeymap(void* userData,
|
||||
struct wl_keyboard* keyboard,
|
||||
uint32_t format,
|
||||
@ -1889,6 +1937,8 @@ static void seatHandleCapabilities(void* userData,
|
||||
{
|
||||
_glfw.wl.pointer = wl_seat_get_pointer(seat);
|
||||
wl_pointer_add_listener(_glfw.wl.pointer, &pointerListener, NULL);
|
||||
|
||||
_glfwAddPointerGesturesListeners(_glfw.wl.pointerGestures);
|
||||
}
|
||||
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && _glfw.wl.pointer)
|
||||
{
|
||||
@ -2124,6 +2174,21 @@ void _glfwAddDataDeviceListenerWayland(struct wl_data_device* device)
|
||||
wl_data_device_add_listener(device, &dataDeviceListener, NULL);
|
||||
}
|
||||
|
||||
void _glfwAddPointerGesturesListeners(struct zwp_pointer_gestures_v1* pointer_gestures)
|
||||
{
|
||||
if (_glfw.wl.pinchGesture) return;
|
||||
if (!_glfw.wl.pointer) return;
|
||||
|
||||
_glfw.wl.pinchGesture =
|
||||
zwp_pointer_gestures_v1_get_pinch_gesture(
|
||||
pointer_gestures,
|
||||
_glfw.wl.pointer);
|
||||
zwp_pointer_gesture_pinch_v1_add_listener(_glfw.wl.pinchGesture,
|
||||
&pinchGestureListener,
|
||||
NULL);
|
||||
// zwp_pointer_gestures_v1
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW platform API //////
|
||||
|
@ -397,6 +397,20 @@ static void scroll_callback(GLFWwindow* window, double x, double y)
|
||||
counter++, slot->number, glfwGetTime(), x, y);
|
||||
}
|
||||
|
||||
static void trackpad_zoom_callback(GLFWwindow* window, double scale)
|
||||
{
|
||||
Slot* slot = glfwGetWindowUserPointer(window);
|
||||
printf("%08x to %i at %0.3f: Trackpad Zoom: %0.3f\n",
|
||||
counter++, slot->number, glfwGetTime(), scale);
|
||||
}
|
||||
|
||||
static void trackpad_rotate_callback(GLFWwindow* window, double angle)
|
||||
{
|
||||
Slot* slot = glfwGetWindowUserPointer(window);
|
||||
printf("%08x to %i at %0.3f: Trackpad Rotate: %0.3f\n",
|
||||
counter++, slot->number, glfwGetTime(), angle);
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
Slot* slot = glfwGetWindowUserPointer(window);
|
||||
@ -647,6 +661,8 @@ int main(int argc, char** argv)
|
||||
glfwSetCursorPosCallback(slots[i].window, cursor_position_callback);
|
||||
glfwSetCursorEnterCallback(slots[i].window, cursor_enter_callback);
|
||||
glfwSetScrollCallback(slots[i].window, scroll_callback);
|
||||
glfwSetTrackpadZoomCallback(slots[i].window, trackpad_zoom_callback);
|
||||
glfwSetTrackpadRotateCallback(slots[i].window, trackpad_rotate_callback);
|
||||
glfwSetKeyCallback(slots[i].window, key_callback);
|
||||
glfwSetCharCallback(slots[i].window, char_callback);
|
||||
glfwSetDropCallback(slots[i].window, drop_callback);
|
||||
|
Loading…
Reference in New Issue
Block a user