mirror of
https://github.com/glfw/glfw.git
synced 2025-12-20 06:01:56 +00:00
Compare commits
3 Commits
7da9e0c1ff
...
03dcd8a251
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03dcd8a251 | ||
|
|
d1b87143bc | ||
|
|
11d96a4ab4 |
@ -29,7 +29,7 @@ for:
|
|||||||
only:
|
only:
|
||||||
- GENERATOR: MinGW Makefiles
|
- GENERATOR: MinGW Makefiles
|
||||||
build_script:
|
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 -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
|
||||||
- cmake --build build
|
- cmake --build build
|
||||||
-
|
-
|
||||||
|
|||||||
@ -41,12 +41,6 @@ indent_size = 2
|
|||||||
indent_style = tab
|
indent_style = tab
|
||||||
indent_size = unset
|
indent_size = unset
|
||||||
|
|
||||||
[deps/mingw/*.h]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 4
|
|
||||||
tab_width = 8
|
|
||||||
trim_trailing_whitespace = false
|
|
||||||
|
|
||||||
[deps/getopt.{c,h}]
|
[deps/getopt.{c,h}]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|||||||
@ -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)
|
APIs (WGL, GLX, EGL, NSGL, OSMesa) or rendering APIs (OpenGL, OpenGL ES, Vulkan)
|
||||||
to enable support for them.
|
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
|
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
|
and Clang. It will likely compile in other environments as well, but this is
|
||||||
not regularly tested.
|
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
|
- Added `GLFW_UNLIMITED_MOUSE_BUTTONS` input mode that allows mouse buttons beyond
|
||||||
the limit of the mouse button tokens to be reported (#2423)
|
the limit of the mouse button tokens to be reported (#2423)
|
||||||
- Updated minimum CMake version to 3.16 (#2541)
|
- 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] Added `QuartzCore` framework as link-time dependency
|
||||||
- [Cocoa] Removed support for OS X 10.10 Yosemite and earlier (#2506)
|
- [Cocoa] Removed support for OS X 10.10 Yosemite and earlier (#2506)
|
||||||
- [Wayland] Bugfix: The fractional scaling related objects were not destroyed
|
- [Wayland] Bugfix: The fractional scaling related objects were not destroyed
|
||||||
|
|||||||
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 */
|
|
||||||
@ -36,9 +36,9 @@ specific to GLFW. It may be a useful companion to this one.
|
|||||||
|
|
||||||
### Installing dependencies {#compile_deps}
|
### Installing dependencies {#compile_deps}
|
||||||
|
|
||||||
The C/C++ development environments in Visual Studio, Xcode and MinGW come with
|
The C/C++ development environments in Visual Studio, Xcode and MinGW-w64 come
|
||||||
all necessary dependencies for compiling GLFW, but on Unix-like systems like
|
with all necessary dependencies for compiling GLFW, but on Unix-like systems
|
||||||
Linux and FreeBSD you will need a few extra packages.
|
like Linux and FreeBSD you will need a few extra packages.
|
||||||
|
|
||||||
|
|
||||||
#### Dependencies for Wayland and X11 {#compile_deps_wayland}
|
#### Dependencies for Wayland and X11 {#compile_deps_wayland}
|
||||||
@ -180,7 +180,7 @@ cd path/to/build
|
|||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
With MinGW, it is `mingw32-make`.
|
With MinGW-w64, it is `mingw32-make`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd path/to/build
|
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.
|
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
|
Both Cygwin and many Linux distributions have MinGW-w64 packages. For example,
|
||||||
example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages
|
Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages for 32- and
|
||||||
for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives
|
64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives like Ubuntu
|
||||||
like Ubuntu have the `mingw-w64` package for both.
|
have the `mingw-w64` package for both.
|
||||||
|
|
||||||
GLFW has CMake toolchain files in the `CMake` subdirectory that set up
|
GLFW has CMake toolchain files in the `CMake` subdirectory that set up
|
||||||
cross-compilation of Windows binaries. To use these files you set the
|
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
|
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
|
The exact toolchain file to use depends on the prefix used by the MinGW-w64
|
||||||
MinGW-w64 binaries on your system. You can usually see this in the /usr
|
binaries on your system. You can usually see this in the /usr directory. For
|
||||||
directory. For example, both the Ubuntu and Cygwin MinGW-w64 packages have
|
example, both the Ubuntu and Cygwin MinGW-w64 packages have
|
||||||
`/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct invocation
|
`/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct invocation
|
||||||
would be:
|
would be:
|
||||||
|
|
||||||
|
|||||||
@ -153,17 +153,31 @@ the `VK_KHR_xlib_surface` extension. Possible values are `GLFW_TRUE` and
|
|||||||
`GLFW_FALSE`. This is ignored on other platforms.
|
`GLFW_FALSE`. This is ignored on other platforms.
|
||||||
|
|
||||||
|
|
||||||
|
#### Windows specific init hints {#init_hints_windows}
|
||||||
|
|
||||||
|
@anchor GLFW_WIN32_MESSAGES_IN_FIBER_hint
|
||||||
|
__GLFW_WIN32_MESSAGES_IN_FIBER__ specifies whether to use separate fiber for
|
||||||
|
processing Windows message, and not the main thread. This allows to unblock
|
||||||
|
window move and resize operations, and application can do updates and rendering
|
||||||
|
in its main loop. __Warning__ - setting this hint is not safe for environments
|
||||||
|
or frameworks where stack inspection is required (for example, moving garbage
|
||||||
|
collected languages such as Java or C#). Set this with @ref glfwInitHint.
|
||||||
|
|
||||||
|
|
||||||
#### Supported and default values {#init_hints_values}
|
#### Supported and default values {#init_hints_values}
|
||||||
|
|
||||||
Initialization hint | Default value | Supported values
|
Initialization hint | Default value | Supported values
|
||||||
-------------------------------- | ------------------------------- | ----------------
|
--------------------------------- | ------------------------------- | ----------------
|
||||||
@ref GLFW_PLATFORM | `GLFW_ANY_PLATFORM` | `GLFW_ANY_PLATFORM`, `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`, `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` or `GLFW_PLATFORM_NULL`
|
|
||||||
@ref GLFW_JOYSTICK_HAT_BUTTONS | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
--------------------------------- | ------------------------------- | ----------------
|
||||||
@ref GLFW_ANGLE_PLATFORM_TYPE | `GLFW_ANGLE_PLATFORM_TYPE_NONE` | `GLFW_ANGLE_PLATFORM_TYPE_NONE`, `GLFW_ANGLE_PLATFORM_TYPE_OPENGL`, `GLFW_ANGLE_PLATFORM_TYPE_OPENGLES`, `GLFW_ANGLE_PLATFORM_TYPE_D3D9`, `GLFW_ANGLE_PLATFORM_TYPE_D3D11`, `GLFW_ANGLE_PLATFORM_TYPE_VULKAN` or `GLFW_ANGLE_PLATFORM_TYPE_METAL`
|
@ref GLFW_PLATFORM | `GLFW_ANY_PLATFORM` | `GLFW_ANY_PLATFORM`, `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`, `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` or `GLFW_PLATFORM_NULL`
|
||||||
@ref GLFW_COCOA_CHDIR_RESOURCES | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
@ref GLFW_JOYSTICK_HAT_BUTTONS | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
@ref GLFW_COCOA_MENUBAR | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
@ref GLFW_ANGLE_PLATFORM_TYPE | `GLFW_ANGLE_PLATFORM_TYPE_NONE` | `GLFW_ANGLE_PLATFORM_TYPE_NONE`, `GLFW_ANGLE_PLATFORM_TYPE_OPENGL`, `GLFW_ANGLE_PLATFORM_TYPE_OPENGLES`, `GLFW_ANGLE_PLATFORM_TYPE_D3D9`, `GLFW_ANGLE_PLATFORM_TYPE_D3D11`, `GLFW_ANGLE_PLATFORM_TYPE_VULKAN` or `GLFW_ANGLE_PLATFORM_TYPE_METAL`
|
||||||
@ref GLFW_WAYLAND_LIBDECOR | `GLFW_WAYLAND_PREFER_LIBDECOR` | `GLFW_WAYLAND_PREFER_LIBDECOR` or `GLFW_WAYLAND_DISABLE_LIBDECOR`
|
@ref GLFW_COCOA_CHDIR_RESOURCES | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
@ref GLFW_X11_XCB_VULKAN_SURFACE | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
@ref GLFW_COCOA_MENUBAR | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
|
@ref GLFW_WAYLAND_LIBDECOR | `GLFW_WAYLAND_PREFER_LIBDECOR` | `GLFW_WAYLAND_PREFER_LIBDECOR` or `GLFW_WAYLAND_DISABLE_LIBDECOR`
|
||||||
|
@ref GLFW_X11_XCB_VULKAN_SURFACE | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
|
@ref GLFW_WIN32_MESSAGES_IN_FIBER | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
|
|
||||||
|
|
||||||
### Runtime platform selection {#platform}
|
### Runtime platform selection {#platform}
|
||||||
@ -621,11 +635,11 @@ The format of the string is as follows:
|
|||||||
- The names of the always supported context creation APIs EGL and OSMesa
|
- 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
|
- 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
|
For example, compiling GLFW 3.5 with MinGW-64 as a DLL for Windows, may result
|
||||||
like this:
|
in a version string like this:
|
||||||
|
|
||||||
```c
|
```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
|
Compiling GLFW as a static library for Linux, with both Wayland and X11 enabled, may
|
||||||
|
|||||||
@ -20,6 +20,15 @@ this.
|
|||||||
|
|
||||||
## Removals {#removals}
|
## 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 symbols {#new_symbols}
|
||||||
|
|
||||||
### New functions {#new_functions}
|
### New functions {#new_functions}
|
||||||
|
|||||||
@ -1328,6 +1328,11 @@ extern "C" {
|
|||||||
* Wayland specific [init hint](@ref GLFW_WAYLAND_LIBDECOR_hint).
|
* Wayland specific [init hint](@ref GLFW_WAYLAND_LIBDECOR_hint).
|
||||||
*/
|
*/
|
||||||
#define GLFW_WAYLAND_LIBDECOR 0x00053001
|
#define GLFW_WAYLAND_LIBDECOR 0x00053001
|
||||||
|
/*! @brief Windows specific init hint.
|
||||||
|
*
|
||||||
|
* Windows specific [init hint](@ref GLFW_WIN32_MESSAGES_IN_FIBER_hint).
|
||||||
|
*/
|
||||||
|
#define GLFW_WIN32_MESSAGES_IN_FIBER 0x00054001
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
/*! @addtogroup init
|
/*! @addtogroup init
|
||||||
@ -1604,6 +1609,10 @@ typedef void (* GLFWerrorfun)(int error_code, const char* description);
|
|||||||
* @param[in] ypos The new y-coordinate, in screen coordinates, of the
|
* @param[in] ypos The new y-coordinate, in screen coordinates, of the
|
||||||
* upper-left corner of the content area of the window.
|
* upper-left corner of the content area of the window.
|
||||||
*
|
*
|
||||||
|
* @remark @win32 On Windows moving or resizing of window will block event
|
||||||
|
* processing. Workaround for this is @ref GLFW_WIN32_MESSAGES_IN_FIBER init
|
||||||
|
* hint.
|
||||||
|
*
|
||||||
* @sa @ref window_pos
|
* @sa @ref window_pos
|
||||||
* @sa @ref glfwSetWindowPosCallback
|
* @sa @ref glfwSetWindowPosCallback
|
||||||
*
|
*
|
||||||
@ -1625,6 +1634,10 @@ typedef void (* GLFWwindowposfun)(GLFWwindow* window, int xpos, int ypos);
|
|||||||
* @param[in] width The new width, in screen coordinates, of the window.
|
* @param[in] width The new width, in screen coordinates, of the window.
|
||||||
* @param[in] height The new height, in screen coordinates, of the window.
|
* @param[in] height The new height, in screen coordinates, of the window.
|
||||||
*
|
*
|
||||||
|
* @remark @win32 On Windows moving or resizing of window will block event
|
||||||
|
* processing. Workaround for this is @ref GLFW_WIN32_MESSAGES_IN_FIBER init
|
||||||
|
* hint.
|
||||||
|
*
|
||||||
* @sa @ref window_size
|
* @sa @ref window_size
|
||||||
* @sa @ref glfwSetWindowSizeCallback
|
* @sa @ref glfwSetWindowSizeCallback
|
||||||
*
|
*
|
||||||
|
|||||||
@ -255,24 +255,6 @@ if (GLFW_BUILD_WIN32)
|
|||||||
target_compile_definitions(glfw PRIVATE UNICODE _UNICODE)
|
target_compile_definitions(glfw PRIVATE UNICODE _UNICODE)
|
||||||
endif()
|
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
|
# Workaround for the MS CRT deprecating parts of the standard library
|
||||||
if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
|
if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
|
||||||
target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS)
|
target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||||
@ -286,10 +268,6 @@ endif()
|
|||||||
if (GLFW_BUILD_SHARED_LIBRARY)
|
if (GLFW_BUILD_SHARED_LIBRARY)
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
if (MINGW)
|
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)
|
# Remove the lib prefix on the DLL (but not the import library)
|
||||||
set_target_properties(glfw PROPERTIES PREFIX "")
|
set_target_properties(glfw PROPERTIES PREFIX "")
|
||||||
|
|
||||||
|
|||||||
@ -66,6 +66,10 @@ static _GLFWinitconfig _glfwInitHints =
|
|||||||
{
|
{
|
||||||
.libdecorMode = GLFW_WAYLAND_PREFER_LIBDECOR
|
.libdecorMode = GLFW_WAYLAND_PREFER_LIBDECOR
|
||||||
},
|
},
|
||||||
|
.win32 =
|
||||||
|
{
|
||||||
|
.msgInFiber = GLFW_FALSE,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// The allocation function used when no custom allocator is set
|
// The allocation function used when no custom allocator is set
|
||||||
@ -462,6 +466,9 @@ GLFWAPI void glfwInitHint(int hint, int value)
|
|||||||
case GLFW_WAYLAND_LIBDECOR:
|
case GLFW_WAYLAND_LIBDECOR:
|
||||||
_glfwInitHints.wl.libdecorMode = value;
|
_glfwInitHints.wl.libdecorMode = value;
|
||||||
return;
|
return;
|
||||||
|
case GLFW_WIN32_MESSAGES_IN_FIBER:
|
||||||
|
_glfwInitHints.win32.msgInFiber = value;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwInputError(GLFW_INVALID_ENUM,
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
|
|||||||
@ -388,6 +388,9 @@ struct _GLFWinitconfig
|
|||||||
struct {
|
struct {
|
||||||
int libdecorMode;
|
int libdecorMode;
|
||||||
} wl;
|
} wl;
|
||||||
|
struct {
|
||||||
|
GLFWbool msgInFiber;
|
||||||
|
} win32;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Window configuration
|
// Window configuration
|
||||||
|
|||||||
@ -187,8 +187,6 @@ GLFWAPI const char* glfwGetVersionString(void)
|
|||||||
" OSMesa"
|
" OSMesa"
|
||||||
#if defined(__MINGW64_VERSION_MAJOR)
|
#if defined(__MINGW64_VERSION_MAJOR)
|
||||||
" MinGW-w64"
|
" MinGW-w64"
|
||||||
#elif defined(__MINGW32__)
|
|
||||||
" MinGW"
|
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
" VisualC"
|
" VisualC"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -370,7 +370,6 @@ static LRESULT CALLBACK helperWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
|
|||||||
//
|
//
|
||||||
static GLFWbool createHelperWindow(void)
|
static GLFWbool createHelperWindow(void)
|
||||||
{
|
{
|
||||||
MSG msg;
|
|
||||||
WNDCLASSEXW wc = { sizeof(wc) };
|
WNDCLASSEXW wc = { sizeof(wc) };
|
||||||
|
|
||||||
wc.style = CS_OWNDC;
|
wc.style = CS_OWNDC;
|
||||||
@ -421,10 +420,18 @@ static GLFWbool createHelperWindow(void)
|
|||||||
DEVICE_NOTIFY_WINDOW_HANDLE);
|
DEVICE_NOTIFY_WINDOW_HANDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (PeekMessageW(&msg, _glfw.win32.helperWindowHandle, 0, 0, PM_REMOVE))
|
if (_glfw.hints.init.win32.msgInFiber)
|
||||||
{
|
{
|
||||||
TranslateMessage(&msg);
|
SwitchToFiber(_glfw.win32.messageFiber);
|
||||||
DispatchMessageW(&msg);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MSG msg;
|
||||||
|
while (PeekMessageW(&msg, _glfw.win32.helperWindowHandle, 0, 0, PM_REMOVE))
|
||||||
|
{
|
||||||
|
TranslateMessage(&msg);
|
||||||
|
DispatchMessageW(&msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
@ -598,6 +605,45 @@ BOOL _glfwIsWindows10BuildOrGreaterWin32(WORD build)
|
|||||||
return RtlVerifyVersionInfo(&osvi, mask, cond) == 0;
|
return RtlVerifyVersionInfo(&osvi, mask, cond) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _glfwPollMessageLoopWin32(void)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window;
|
||||||
|
MSG msg;
|
||||||
|
while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
|
||||||
|
{
|
||||||
|
if (msg.message == WM_QUIT)
|
||||||
|
{
|
||||||
|
// NOTE: While GLFW does not itself post WM_QUIT, other processes
|
||||||
|
// may post it to this one, for example Task Manager
|
||||||
|
// HACK: Treat WM_QUIT as a close on all windows
|
||||||
|
|
||||||
|
window = _glfw.windowListHead;
|
||||||
|
while (window)
|
||||||
|
{
|
||||||
|
_glfwInputWindowCloseRequest(window);
|
||||||
|
window = window->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TranslateMessage(&msg);
|
||||||
|
DispatchMessageW(&msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Windows message dispatch fiber
|
||||||
|
void CALLBACK messageFiberProc(LPVOID lpFiberParameter)
|
||||||
|
{
|
||||||
|
(void)lpFiberParameter;
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
_glfwPollMessageLoopWin32();
|
||||||
|
SwitchToFiber(_glfw.win32.mainFiber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform)
|
GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform)
|
||||||
{
|
{
|
||||||
const _GLFWplatform win32 =
|
const _GLFWplatform win32 =
|
||||||
@ -695,6 +741,17 @@ int _glfwInitWin32(void)
|
|||||||
else if (IsWindowsVistaOrGreater())
|
else if (IsWindowsVistaOrGreater())
|
||||||
SetProcessDPIAware();
|
SetProcessDPIAware();
|
||||||
|
|
||||||
|
if (_glfw.hints.init.win32.msgInFiber)
|
||||||
|
{
|
||||||
|
_glfw.win32.mainFiber = ConvertThreadToFiber(NULL);
|
||||||
|
if (!_glfw.win32.mainFiber)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
_glfw.win32.messageFiber = CreateFiber(0, &messageFiberProc, NULL);
|
||||||
|
if (!_glfw.win32.messageFiber)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!createHelperWindow())
|
if (!createHelperWindow())
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
|
||||||
@ -717,6 +774,12 @@ void _glfwTerminateWin32(void)
|
|||||||
if (_glfw.win32.mainWindowClass)
|
if (_glfw.win32.mainWindowClass)
|
||||||
UnregisterClassW(MAKEINTATOM(_glfw.win32.mainWindowClass), _glfw.win32.instance);
|
UnregisterClassW(MAKEINTATOM(_glfw.win32.mainWindowClass), _glfw.win32.instance);
|
||||||
|
|
||||||
|
if (_glfw.hints.init.win32.msgInFiber)
|
||||||
|
{
|
||||||
|
DeleteFiber(_glfw.win32.messageFiber);
|
||||||
|
ConvertFiberToThread();
|
||||||
|
}
|
||||||
|
|
||||||
_glfw_free(_glfw.win32.clipboardString);
|
_glfw_free(_glfw.win32.clipboardString);
|
||||||
_glfw_free(_glfw.win32.rawInput);
|
_glfw_free(_glfw.win32.rawInput);
|
||||||
|
|
||||||
|
|||||||
@ -83,24 +83,12 @@
|
|||||||
#ifndef WM_COPYGLOBALDATA
|
#ifndef WM_COPYGLOBALDATA
|
||||||
#define WM_COPYGLOBALDATA 0x0049
|
#define WM_COPYGLOBALDATA 0x0049
|
||||||
#endif
|
#endif
|
||||||
#ifndef WM_UNICHAR
|
|
||||||
#define WM_UNICHAR 0x0109
|
|
||||||
#endif
|
|
||||||
#ifndef UNICODE_NOCHAR
|
|
||||||
#define UNICODE_NOCHAR 0xFFFF
|
|
||||||
#endif
|
|
||||||
#ifndef WM_DPICHANGED
|
#ifndef WM_DPICHANGED
|
||||||
#define WM_DPICHANGED 0x02E0
|
#define WM_DPICHANGED 0x02E0
|
||||||
#endif
|
#endif
|
||||||
#ifndef GET_XBUTTON_WPARAM
|
|
||||||
#define GET_XBUTTON_WPARAM(w) (HIWORD(w))
|
|
||||||
#endif
|
|
||||||
#ifndef EDS_ROTATEDMODE
|
#ifndef EDS_ROTATEDMODE
|
||||||
#define EDS_ROTATEDMODE 0x00000004
|
#define EDS_ROTATEDMODE 0x00000004
|
||||||
#endif
|
#endif
|
||||||
#ifndef DISPLAY_DEVICE_ACTIVE
|
|
||||||
#define DISPLAY_DEVICE_ACTIVE 0x00000001
|
|
||||||
#endif
|
|
||||||
#ifndef _WIN32_WINNT_WINBLUE
|
#ifndef _WIN32_WINNT_WINBLUE
|
||||||
#define _WIN32_WINNT_WINBLUE 0x0603
|
#define _WIN32_WINNT_WINBLUE 0x0603
|
||||||
#endif
|
#endif
|
||||||
@ -113,9 +101,6 @@
|
|||||||
#ifndef USER_DEFAULT_SCREEN_DPI
|
#ifndef USER_DEFAULT_SCREEN_DPI
|
||||||
#define USER_DEFAULT_SCREEN_DPI 96
|
#define USER_DEFAULT_SCREEN_DPI 96
|
||||||
#endif
|
#endif
|
||||||
#ifndef OCR_HAND
|
|
||||||
#define OCR_HAND 32649
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if WINVER < 0x0601
|
#if WINVER < 0x0601
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -433,6 +418,11 @@ typedef struct _GLFWwindowWin32
|
|||||||
int lastCursorPosX, lastCursorPosY;
|
int lastCursorPosX, lastCursorPosY;
|
||||||
// The last received high surrogate when decoding pairs of UTF-16 messages
|
// The last received high surrogate when decoding pairs of UTF-16 messages
|
||||||
WCHAR highSurrogate;
|
WCHAR highSurrogate;
|
||||||
|
|
||||||
|
// If user pressed mouse button on window title bar
|
||||||
|
UINT ncMouseButton;
|
||||||
|
LPARAM ncMousePos;
|
||||||
|
|
||||||
} _GLFWwindowWin32;
|
} _GLFWwindowWin32;
|
||||||
|
|
||||||
// Win32-specific global data
|
// Win32-specific global data
|
||||||
@ -461,6 +451,9 @@ typedef struct _GLFWlibraryWin32
|
|||||||
// The cursor handle to use to hide the cursor (NULL or a transparent cursor)
|
// The cursor handle to use to hide the cursor (NULL or a transparent cursor)
|
||||||
HCURSOR blankCursor;
|
HCURSOR blankCursor;
|
||||||
|
|
||||||
|
LPVOID messageFiber;
|
||||||
|
LPVOID mainFiber;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
HINSTANCE instance;
|
HINSTANCE instance;
|
||||||
PFN_DirectInput8Create Create;
|
PFN_DirectInput8Create Create;
|
||||||
@ -579,6 +572,7 @@ void _glfwSetWindowOpacityWin32(_GLFWwindow* window, float opacity);
|
|||||||
void _glfwSetRawMouseMotionWin32(_GLFWwindow *window, GLFWbool enabled);
|
void _glfwSetRawMouseMotionWin32(_GLFWwindow *window, GLFWbool enabled);
|
||||||
GLFWbool _glfwRawMouseMotionSupportedWin32(void);
|
GLFWbool _glfwRawMouseMotionSupportedWin32(void);
|
||||||
|
|
||||||
|
void _glfwPollMessageLoopWin32(void);
|
||||||
void _glfwPollEventsWin32(void);
|
void _glfwPollEventsWin32(void);
|
||||||
void _glfwWaitEventsWin32(void);
|
void _glfwWaitEventsWin32(void);
|
||||||
void _glfwWaitEventsTimeoutWin32(double timeout);
|
void _glfwWaitEventsTimeoutWin32(double timeout);
|
||||||
|
|||||||
@ -856,11 +856,46 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case WM_NCLBUTTONDOWN:
|
||||||
|
{
|
||||||
|
if (wParam == HTCAPTION)
|
||||||
|
{
|
||||||
|
window->win32.ncMouseButton = uMsg;
|
||||||
|
window->win32.ncMousePos = lParam;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_NCMOUSEMOVE:
|
||||||
|
{
|
||||||
|
if (window->win32.ncMouseButton)
|
||||||
|
{
|
||||||
|
if (GET_X_LPARAM(window->win32.ncMousePos) != GET_X_LPARAM(lParam) ||
|
||||||
|
GET_Y_LPARAM(window->win32.ncMousePos) != GET_Y_LPARAM(lParam))
|
||||||
|
{
|
||||||
|
DefWindowProcW(hWnd, window->win32.ncMouseButton, HTCAPTION, window->win32.ncMousePos);
|
||||||
|
window->win32.ncMouseButton = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
{
|
{
|
||||||
const int x = GET_X_LPARAM(lParam);
|
const int x = GET_X_LPARAM(lParam);
|
||||||
const int y = GET_Y_LPARAM(lParam);
|
const int y = GET_Y_LPARAM(lParam);
|
||||||
|
|
||||||
|
if (window->win32.ncMouseButton)
|
||||||
|
{
|
||||||
|
if (GET_X_LPARAM(window->win32.ncMousePos) != x ||
|
||||||
|
GET_Y_LPARAM(window->win32.ncMousePos) != y)
|
||||||
|
{
|
||||||
|
DefWindowProcW(hWnd, window->win32.ncMouseButton, HTCAPTION, window->win32.ncMousePos);
|
||||||
|
window->win32.ncMouseButton = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!window->win32.cursorTracked)
|
if (!window->win32.cursorTracked)
|
||||||
{
|
{
|
||||||
TRACKMOUSEEVENT tme;
|
TRACKMOUSEEVENT tme;
|
||||||
@ -1002,6 +1037,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
|
|||||||
else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||||
releaseCursor();
|
releaseCursor();
|
||||||
|
|
||||||
|
if (_glfw.hints.init.win32.msgInFiber)
|
||||||
|
SetTimer(hWnd, 1, 1, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1018,6 +1055,15 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
|
|||||||
else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||||
captureCursor(window);
|
captureCursor(window);
|
||||||
|
|
||||||
|
if (_glfw.hints.init.win32.msgInFiber)
|
||||||
|
KillTimer(hWnd, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_TIMER:
|
||||||
|
{
|
||||||
|
if (_glfw.hints.init.win32.msgInFiber && wParam == 1)
|
||||||
|
SwitchToFiber(_glfw.win32.mainFiber);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2101,31 +2147,13 @@ GLFWbool _glfwRawMouseMotionSupportedWin32(void)
|
|||||||
|
|
||||||
void _glfwPollEventsWin32(void)
|
void _glfwPollEventsWin32(void)
|
||||||
{
|
{
|
||||||
MSG msg;
|
|
||||||
HWND handle;
|
HWND handle;
|
||||||
_GLFWwindow* window;
|
_GLFWwindow* window;
|
||||||
|
|
||||||
while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
|
if (_glfw.hints.init.win32.msgInFiber)
|
||||||
{
|
SwitchToFiber(_glfw.win32.messageFiber);
|
||||||
if (msg.message == WM_QUIT)
|
else
|
||||||
{
|
_glfwPollMessageLoopWin32();
|
||||||
// NOTE: While GLFW does not itself post WM_QUIT, other processes
|
|
||||||
// may post it to this one, for example Task Manager
|
|
||||||
// HACK: Treat WM_QUIT as a close on all windows
|
|
||||||
|
|
||||||
window = _glfw.windowListHead;
|
|
||||||
while (window)
|
|
||||||
{
|
|
||||||
_glfwInputWindowCloseRequest(window);
|
|
||||||
window = window->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TranslateMessage(&msg);
|
|
||||||
DispatchMessageW(&msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// HACK: Release modifier keys that the system did not emit KEYUP for
|
// HACK: Release modifier keys that the system did not emit KEYUP for
|
||||||
// NOTE: Shift keys on Windows tend to "stick" when both are pressed as
|
// NOTE: Shift keys on Windows tend to "stick" when both are pressed as
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user