mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 02:42:02 +01:00
parent
c536e34e56
commit
052947d7b7
1
go.sum
1
go.sum
@ -51,6 +51,7 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
|
|||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=
|
||||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
32
internal/glfw/glfw/README.md
vendored
32
internal/glfw/glfw/README.md
vendored
@ -1,3 +1,35 @@
|
|||||||
These files are basically copy of github.com/v3.3/glfw/glfw.
|
These files are basically copy of github.com/v3.3/glfw/glfw.
|
||||||
|
|
||||||
There is one change from the original files: `GLFWscrollfun` takes pointers instead of values since all arguments of C functions have to be 32bit on 32bit Windows machine.
|
There is one change from the original files: `GLFWscrollfun` takes pointers instead of values since all arguments of C functions have to be 32bit on 32bit Windows machine.
|
||||||
|
|
||||||
|
```diff
|
||||||
|
diff --git a/tmp/glfw-3.3.3/include/GLFW/glfw3.h b/./internal/glfw/glfw/include/GLFW/glfw3.h
|
||||||
|
index 35bbf075..b41c0dca 100644
|
||||||
|
--- a/tmp/glfw-3.3.3/include/GLFW/glfw3.h
|
||||||
|
+++ b/./internal/glfw/glfw/include/GLFW/glfw3.h
|
||||||
|
@@ -1496,7 +1496,7 @@ typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
*/
|
||||||
|
-typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
|
||||||
|
+typedef void (* GLFWscrollfun)(GLFWwindow*,double*,double*);
|
||||||
|
|
||||||
|
/*! @brief The function pointer type for keyboard key callbacks.
|
||||||
|
*
|
||||||
|
```
|
||||||
|
|
||||||
|
```diff
|
||||||
|
diff --git a/tmp/glfw-3.3.3/src/input.c b/./internal/glfw/glfw/src/input.c
|
||||||
|
index 337d5cf0..4ac555cb 100644
|
||||||
|
--- a/tmp/glfw-3.3.3/src/input.c
|
||||||
|
+++ b/./internal/glfw/glfw/src/input.c
|
||||||
|
@@ -312,7 +312,7 @@ void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, GLFWb
|
||||||
|
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)
|
||||||
|
{
|
||||||
|
if (window->callbacks.scroll)
|
||||||
|
- window->callbacks.scroll((GLFWwindow*) window, xoffset, yoffset);
|
||||||
|
+ window->callbacks.scroll((GLFWwindow*) window, &xoffset, &yoffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notifies shared code of a mouse button click event
|
||||||
|
```
|
||||||
|
55
internal/glfw/glfw/include/GLFW/glfw3.h
vendored
55
internal/glfw/glfw/include/GLFW/glfw3.h
vendored
@ -52,7 +52,7 @@ extern "C" {
|
|||||||
* This is the reference documentation for OpenGL and OpenGL ES context related
|
* This is the reference documentation for OpenGL and OpenGL ES context related
|
||||||
* functions. For more task-oriented information, see the @ref context_guide.
|
* functions. For more task-oriented information, see the @ref context_guide.
|
||||||
*/
|
*/
|
||||||
/*! @defgroup vulkan Vulkan reference
|
/*! @defgroup vulkan Vulkan support reference
|
||||||
* @brief Functions and types related to Vulkan.
|
* @brief Functions and types related to Vulkan.
|
||||||
*
|
*
|
||||||
* This is the reference documentation for Vulkan related functions and types.
|
* This is the reference documentation for Vulkan related functions and types.
|
||||||
@ -193,7 +193,38 @@ extern "C" {
|
|||||||
|
|
||||||
#endif /*__APPLE__*/
|
#endif /*__APPLE__*/
|
||||||
|
|
||||||
#elif !defined(GLFW_INCLUDE_NONE)
|
#elif defined(GLFW_INCLUDE_GLU)
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
|
||||||
|
#if defined(GLFW_INCLUDE_GLU)
|
||||||
|
#include <OpenGL/glu.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /*__APPLE__*/
|
||||||
|
|
||||||
|
#if defined(GLFW_INCLUDE_GLU)
|
||||||
|
#include <GL/glu.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /*__APPLE__*/
|
||||||
|
|
||||||
|
#elif !defined(GLFW_INCLUDE_NONE) && \
|
||||||
|
!defined(__gl_h_) && \
|
||||||
|
!defined(__gles1_gl_h_) && \
|
||||||
|
!defined(__gles2_gl2_h_) && \
|
||||||
|
!defined(__gles2_gl3_h_) && \
|
||||||
|
!defined(__gles2_gl31_h_) && \
|
||||||
|
!defined(__gles2_gl32_h_) && \
|
||||||
|
!defined(__gl_glcorearb_h_) && \
|
||||||
|
!defined(__gl2_h_) /*legacy*/ && \
|
||||||
|
!defined(__gl3_h_) /*legacy*/ && \
|
||||||
|
!defined(__gl31_h_) /*legacy*/ && \
|
||||||
|
!defined(__gl32_h_) /*legacy*/ && \
|
||||||
|
!defined(__glcorearb_h_) /*legacy*/ && \
|
||||||
|
!defined(__GL_H__) /*non-standard*/ && \
|
||||||
|
!defined(__gltypes_h_) /*non-standard*/ && \
|
||||||
|
!defined(__glee_h_) /*non-standard*/
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
|
||||||
@ -201,9 +232,6 @@ extern "C" {
|
|||||||
#define GL_GLEXT_LEGACY
|
#define GL_GLEXT_LEGACY
|
||||||
#endif
|
#endif
|
||||||
#include <OpenGL/gl.h>
|
#include <OpenGL/gl.h>
|
||||||
#if defined(GLFW_INCLUDE_GLU)
|
|
||||||
#include <OpenGL/glu.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else /*__APPLE__*/
|
#else /*__APPLE__*/
|
||||||
|
|
||||||
@ -211,9 +239,6 @@ extern "C" {
|
|||||||
#if defined(GLFW_INCLUDE_GLEXT)
|
#if defined(GLFW_INCLUDE_GLEXT)
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(GLFW_INCLUDE_GLU)
|
|
||||||
#include <GL/glu.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /*__APPLE__*/
|
#endif /*__APPLE__*/
|
||||||
|
|
||||||
@ -270,7 +295,7 @@ extern "C" {
|
|||||||
* API changes.
|
* API changes.
|
||||||
* @ingroup init
|
* @ingroup init
|
||||||
*/
|
*/
|
||||||
#define GLFW_VERSION_REVISION 2
|
#define GLFW_VERSION_REVISION 3
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
/*! @brief One.
|
/*! @brief One.
|
||||||
@ -949,9 +974,9 @@ extern "C" {
|
|||||||
* and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib).
|
* and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib).
|
||||||
*/
|
*/
|
||||||
#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
|
#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
|
||||||
/*! @brief OpenGL debug context hint and attribute.
|
/*! @brief Debug mode context hint and attribute.
|
||||||
*
|
*
|
||||||
* OpenGL debug context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and
|
* Debug mode context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and
|
||||||
* [attribute](@ref GLFW_OPENGL_DEBUG_CONTEXT_attrib).
|
* [attribute](@ref GLFW_OPENGL_DEBUG_CONTEXT_attrib).
|
||||||
*/
|
*/
|
||||||
#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
|
#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
|
||||||
@ -1328,7 +1353,7 @@ typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
|
|||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param[in] window The window that was maximized or restored.
|
* @param[in] window The window that was maximized or restored.
|
||||||
* @param[in] iconified `GLFW_TRUE` if the window was maximized, or
|
* @param[in] maximized `GLFW_TRUE` if the window was maximized, or
|
||||||
* `GLFW_FALSE` if it was restored.
|
* `GLFW_FALSE` if it was restored.
|
||||||
*
|
*
|
||||||
* @sa @ref window_maximize
|
* @sa @ref window_maximize
|
||||||
@ -1753,6 +1778,10 @@ typedef struct GLFWgamepadstate
|
|||||||
* bundle, if present. This can be disabled with the @ref
|
* bundle, if present. This can be disabled with the @ref
|
||||||
* GLFW_COCOA_CHDIR_RESOURCES init hint.
|
* GLFW_COCOA_CHDIR_RESOURCES init hint.
|
||||||
*
|
*
|
||||||
|
* @remark @x11 This function will set the `LC_CTYPE` category of the
|
||||||
|
* application locale according to the current environment if that category is
|
||||||
|
* still "C". This is because the "C" locale breaks Unicode text input.
|
||||||
|
*
|
||||||
* @thread_safety This function must only be called from the main thread.
|
* @thread_safety This function must only be called from the main thread.
|
||||||
*
|
*
|
||||||
* @sa @ref intro_init
|
* @sa @ref intro_init
|
||||||
@ -1776,6 +1805,8 @@ GLFWAPI int glfwInit(void);
|
|||||||
* call this function, as it is called by @ref glfwInit before it returns
|
* call this function, as it is called by @ref glfwInit before it returns
|
||||||
* failure.
|
* failure.
|
||||||
*
|
*
|
||||||
|
* This function has no effect if GLFW is not initialized.
|
||||||
|
*
|
||||||
* @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
|
* @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @remark This function may be called before @ref glfwInit.
|
* @remark This function may be called before @ref glfwInit.
|
||||||
|
16
internal/glfw/glfw/src/egl_context.c
vendored
16
internal/glfw/glfw/src/egl_context.c
vendored
@ -588,18 +588,16 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up attributes for surface creation
|
// Set up attributes for surface creation
|
||||||
|
index = 0;
|
||||||
|
|
||||||
|
if (fbconfig->sRGB)
|
||||||
{
|
{
|
||||||
int index = 0;
|
if (_glfw.egl.KHR_gl_colorspace)
|
||||||
|
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
|
||||||
if (fbconfig->sRGB)
|
|
||||||
{
|
|
||||||
if (_glfw.egl.KHR_gl_colorspace)
|
|
||||||
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
|
|
||||||
}
|
|
||||||
|
|
||||||
setAttrib(EGL_NONE, EGL_NONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setAttrib(EGL_NONE, EGL_NONE);
|
||||||
|
|
||||||
window->context.egl.surface =
|
window->context.egl.surface =
|
||||||
eglCreateWindowSurface(_glfw.egl.display,
|
eglCreateWindowSurface(_glfw.egl.display,
|
||||||
config,
|
config,
|
||||||
|
36
internal/glfw/glfw/src/internal.h
vendored
36
internal/glfw/glfw/src/internal.h
vendored
@ -342,9 +342,9 @@ struct _GLFWcontext
|
|||||||
int robustness;
|
int robustness;
|
||||||
int release;
|
int release;
|
||||||
|
|
||||||
PFNGLGETSTRINGIPROC GetStringi;
|
PFNGLGETSTRINGIPROC GetStringi;
|
||||||
PFNGLGETINTEGERVPROC GetIntegerv;
|
PFNGLGETINTEGERVPROC GetIntegerv;
|
||||||
PFNGLGETSTRINGPROC GetString;
|
PFNGLGETSTRINGPROC GetString;
|
||||||
|
|
||||||
_GLFWmakecontextcurrentfun makeCurrent;
|
_GLFWmakecontextcurrentfun makeCurrent;
|
||||||
_GLFWswapbuffersfun swapBuffers;
|
_GLFWswapbuffersfun swapBuffers;
|
||||||
@ -396,23 +396,23 @@ struct _GLFWwindow
|
|||||||
_GLFWcontext context;
|
_GLFWcontext context;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
GLFWwindowposfun pos;
|
GLFWwindowposfun pos;
|
||||||
GLFWwindowsizefun size;
|
GLFWwindowsizefun size;
|
||||||
GLFWwindowclosefun close;
|
GLFWwindowclosefun close;
|
||||||
GLFWwindowrefreshfun refresh;
|
GLFWwindowrefreshfun refresh;
|
||||||
GLFWwindowfocusfun focus;
|
GLFWwindowfocusfun focus;
|
||||||
GLFWwindowiconifyfun iconify;
|
GLFWwindowiconifyfun iconify;
|
||||||
GLFWwindowmaximizefun maximize;
|
GLFWwindowmaximizefun maximize;
|
||||||
GLFWframebuffersizefun fbsize;
|
GLFWframebuffersizefun fbsize;
|
||||||
GLFWwindowcontentscalefun scale;
|
GLFWwindowcontentscalefun scale;
|
||||||
GLFWmousebuttonfun mouseButton;
|
GLFWmousebuttonfun mouseButton;
|
||||||
GLFWcursorposfun cursorPos;
|
GLFWcursorposfun cursorPos;
|
||||||
GLFWcursorenterfun cursorEnter;
|
GLFWcursorenterfun cursorEnter;
|
||||||
GLFWscrollfun scroll;
|
GLFWscrollfun scroll;
|
||||||
GLFWkeyfun key;
|
GLFWkeyfun key;
|
||||||
GLFWcharfun character;
|
GLFWcharfun character;
|
||||||
GLFWcharmodsfun charmods;
|
GLFWcharmodsfun charmods;
|
||||||
GLFWdropfun drop;
|
GLFWdropfun drop;
|
||||||
} callbacks;
|
} callbacks;
|
||||||
|
|
||||||
// This is defined in the window API's platform.h
|
// This is defined in the window API's platform.h
|
||||||
|
4
internal/glfw/glfw/src/wgl_context.h
vendored
4
internal/glfw/glfw/src/wgl_context.h
vendored
@ -104,10 +104,6 @@ typedef BOOL (WINAPI * PFN_wglShareLists)(HGLRC,HGLRC);
|
|||||||
#define wglMakeCurrent _glfw.wgl.MakeCurrent
|
#define wglMakeCurrent _glfw.wgl.MakeCurrent
|
||||||
#define wglShareLists _glfw.wgl.ShareLists
|
#define wglShareLists _glfw.wgl.ShareLists
|
||||||
|
|
||||||
#define _GLFW_RECREATION_NOT_NEEDED 0
|
|
||||||
#define _GLFW_RECREATION_REQUIRED 1
|
|
||||||
#define _GLFW_RECREATION_IMPOSSIBLE 2
|
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL wgl
|
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL wgl
|
||||||
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryWGL wgl
|
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryWGL wgl
|
||||||
|
|
||||||
|
2
internal/glfw/glfw/src/win32_init.c
vendored
2
internal/glfw/glfw/src/win32_init.c
vendored
@ -143,6 +143,8 @@ static GLFWbool loadLibraries(void)
|
|||||||
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmFlush");
|
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmFlush");
|
||||||
_glfw.win32.dwmapi.EnableBlurBehindWindow = (PFN_DwmEnableBlurBehindWindow)
|
_glfw.win32.dwmapi.EnableBlurBehindWindow = (PFN_DwmEnableBlurBehindWindow)
|
||||||
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmEnableBlurBehindWindow");
|
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmEnableBlurBehindWindow");
|
||||||
|
_glfw.win32.dwmapi.GetColorizationColor = (PFN_DwmGetColorizationColor)
|
||||||
|
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmGetColorizationColor");
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfw.win32.shcore.instance = LoadLibraryA("shcore.dll");
|
_glfw.win32.shcore.instance = LoadLibraryA("shcore.dll");
|
||||||
|
10
internal/glfw/glfw/src/win32_joystick.c
vendored
10
internal/glfw/glfw/src/win32_joystick.c
vendored
@ -356,7 +356,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
|
|||||||
|
|
||||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
{
|
{
|
||||||
_GLFWjoystick* js = _glfw.joysticks + jid;
|
js = _glfw.joysticks + jid;
|
||||||
if (js->present)
|
if (js->present)
|
||||||
{
|
{
|
||||||
if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0)
|
if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0)
|
||||||
@ -672,11 +672,11 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Screams of horror are appropriate at this point
|
// Screams of horror are appropriate at this point
|
||||||
int state = LOWORD(*(DWORD*) data) / (45 * DI_DEGREES);
|
int stateIndex = LOWORD(*(DWORD*) data) / (45 * DI_DEGREES);
|
||||||
if (state < 0 || state > 8)
|
if (stateIndex < 0 || stateIndex > 8)
|
||||||
state = 8;
|
stateIndex = 8;
|
||||||
|
|
||||||
_glfwInputJoystickHat(js, pi, states[state]);
|
_glfwInputJoystickHat(js, pi, states[stateIndex]);
|
||||||
pi++;
|
pi++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
2
internal/glfw/glfw/src/win32_monitor.c
vendored
2
internal/glfw/glfw/src/win32_monitor.c
vendored
@ -185,6 +185,8 @@ void _glfwPollMonitorsWin32(void)
|
|||||||
display.DeviceName) == 0)
|
display.DeviceName) == 0)
|
||||||
{
|
{
|
||||||
disconnected[i] = NULL;
|
disconnected[i] = NULL;
|
||||||
|
// handle may have changed, update
|
||||||
|
EnumDisplayMonitors(NULL, NULL, monitorCallback, (LPARAM) _glfw.monitors[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
internal/glfw/glfw/src/win32_platform.h
vendored
13
internal/glfw/glfw/src/win32_platform.h
vendored
@ -77,6 +77,9 @@
|
|||||||
#ifndef WM_DWMCOMPOSITIONCHANGED
|
#ifndef WM_DWMCOMPOSITIONCHANGED
|
||||||
#define WM_DWMCOMPOSITIONCHANGED 0x031E
|
#define WM_DWMCOMPOSITIONCHANGED 0x031E
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef WM_DWMCOLORIZATIONCOLORCHANGED
|
||||||
|
#define WM_DWMCOLORIZATIONCOLORCHANGED 0x0320
|
||||||
|
#endif
|
||||||
#ifndef WM_COPYGLOBALDATA
|
#ifndef WM_COPYGLOBALDATA
|
||||||
#define WM_COPYGLOBALDATA 0x0049
|
#define WM_COPYGLOBALDATA 0x0049
|
||||||
#endif
|
#endif
|
||||||
@ -99,7 +102,7 @@
|
|||||||
#define DISPLAY_DEVICE_ACTIVE 0x00000001
|
#define DISPLAY_DEVICE_ACTIVE 0x00000001
|
||||||
#endif
|
#endif
|
||||||
#ifndef _WIN32_WINNT_WINBLUE
|
#ifndef _WIN32_WINNT_WINBLUE
|
||||||
#define _WIN32_WINNT_WINBLUE 0x0602
|
#define _WIN32_WINNT_WINBLUE 0x0603
|
||||||
#endif
|
#endif
|
||||||
#ifndef _WIN32_WINNT_WIN8
|
#ifndef _WIN32_WINNT_WIN8
|
||||||
#define _WIN32_WINNT_WIN8 0x0602
|
#define _WIN32_WINNT_WIN8 0x0602
|
||||||
@ -247,9 +250,11 @@ typedef BOOL (WINAPI * PFN_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UIN
|
|||||||
typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*);
|
typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*);
|
||||||
typedef HRESULT (WINAPI * PFN_DwmFlush)(VOID);
|
typedef HRESULT (WINAPI * PFN_DwmFlush)(VOID);
|
||||||
typedef HRESULT(WINAPI * PFN_DwmEnableBlurBehindWindow)(HWND,const DWM_BLURBEHIND*);
|
typedef HRESULT(WINAPI * PFN_DwmEnableBlurBehindWindow)(HWND,const DWM_BLURBEHIND*);
|
||||||
|
typedef HRESULT (WINAPI * PFN_DwmGetColorizationColor)(DWORD*,BOOL*);
|
||||||
#define DwmIsCompositionEnabled _glfw.win32.dwmapi.IsCompositionEnabled
|
#define DwmIsCompositionEnabled _glfw.win32.dwmapi.IsCompositionEnabled
|
||||||
#define DwmFlush _glfw.win32.dwmapi.Flush
|
#define DwmFlush _glfw.win32.dwmapi.Flush
|
||||||
#define DwmEnableBlurBehindWindow _glfw.win32.dwmapi.EnableBlurBehindWindow
|
#define DwmEnableBlurBehindWindow _glfw.win32.dwmapi.EnableBlurBehindWindow
|
||||||
|
#define DwmGetColorizationColor _glfw.win32.dwmapi.GetColorizationColor
|
||||||
|
|
||||||
// shcore.dll function pointer typedefs
|
// shcore.dll function pointer typedefs
|
||||||
typedef HRESULT (WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS);
|
typedef HRESULT (WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS);
|
||||||
@ -316,8 +321,13 @@ typedef struct _GLFWwindowWin32
|
|||||||
GLFWbool transparent;
|
GLFWbool transparent;
|
||||||
GLFWbool scaleToMonitor;
|
GLFWbool scaleToMonitor;
|
||||||
|
|
||||||
|
// Cached size used to filter out duplicate events
|
||||||
|
int width, height;
|
||||||
|
|
||||||
// The last received cursor position, regardless of source
|
// The last received cursor position, regardless of source
|
||||||
int lastCursorPosX, lastCursorPosY;
|
int lastCursorPosX, lastCursorPosY;
|
||||||
|
// The last recevied high surrogate when decoding pairs of UTF-16 messages
|
||||||
|
WCHAR highSurrogate;
|
||||||
|
|
||||||
} _GLFWwindowWin32;
|
} _GLFWwindowWin32;
|
||||||
|
|
||||||
@ -373,6 +383,7 @@ typedef struct _GLFWlibraryWin32
|
|||||||
PFN_DwmIsCompositionEnabled IsCompositionEnabled;
|
PFN_DwmIsCompositionEnabled IsCompositionEnabled;
|
||||||
PFN_DwmFlush Flush;
|
PFN_DwmFlush Flush;
|
||||||
PFN_DwmEnableBlurBehindWindow EnableBlurBehindWindow;
|
PFN_DwmEnableBlurBehindWindow EnableBlurBehindWindow;
|
||||||
|
PFN_DwmGetColorizationColor GetColorizationColor;
|
||||||
} dwmapi;
|
} dwmapi;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
131
internal/glfw/glfw/src/win32_window.c
vendored
131
internal/glfw/glfw/src/win32_window.c
vendored
@ -377,12 +377,17 @@ static void updateWindowStyles(const _GLFWwindow* window)
|
|||||||
//
|
//
|
||||||
static void updateFramebufferTransparency(const _GLFWwindow* window)
|
static void updateFramebufferTransparency(const _GLFWwindow* window)
|
||||||
{
|
{
|
||||||
BOOL enabled;
|
BOOL composition, opaque;
|
||||||
|
DWORD color;
|
||||||
|
|
||||||
if (!IsWindowsVistaOrGreater())
|
if (!IsWindowsVistaOrGreater())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled)
|
if (FAILED(DwmIsCompositionEnabled(&composition)) || !composition)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (IsWindows8OrGreater() ||
|
||||||
|
(SUCCEEDED(DwmGetColorizationColor(&color, &opaque)) && !opaque))
|
||||||
{
|
{
|
||||||
HRGN region = CreateRectRgn(0, 0, -1, -1);
|
HRGN region = CreateRectRgn(0, 0, -1, -1);
|
||||||
DWM_BLURBEHIND bb = {0};
|
DWM_BLURBEHIND bb = {0};
|
||||||
@ -390,37 +395,18 @@ static void updateFramebufferTransparency(const _GLFWwindow* window)
|
|||||||
bb.hRgnBlur = region;
|
bb.hRgnBlur = region;
|
||||||
bb.fEnable = TRUE;
|
bb.fEnable = TRUE;
|
||||||
|
|
||||||
if (SUCCEEDED(DwmEnableBlurBehindWindow(window->win32.handle, &bb)))
|
DwmEnableBlurBehindWindow(window->win32.handle, &bb);
|
||||||
{
|
|
||||||
// Decorated windows don't repaint the transparent background
|
|
||||||
// leaving a trail behind animations
|
|
||||||
// HACK: Making the window layered with a transparency color key
|
|
||||||
// seems to fix this. Normally, when specifying
|
|
||||||
// a transparency color key to be used when composing the
|
|
||||||
// layered window, all pixels painted by the window in this
|
|
||||||
// color will be transparent. That doesn't seem to be the
|
|
||||||
// case anymore, at least when used with blur behind window
|
|
||||||
// plus negative region.
|
|
||||||
LONG exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
|
|
||||||
exStyle |= WS_EX_LAYERED;
|
|
||||||
SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle);
|
|
||||||
|
|
||||||
// Using a color key not equal to black to fix the trailing
|
|
||||||
// issue. When set to black, something is making the hit test
|
|
||||||
// not resize with the window frame.
|
|
||||||
SetLayeredWindowAttributes(window->win32.handle,
|
|
||||||
RGB(255, 0, 255), 255, LWA_COLORKEY);
|
|
||||||
}
|
|
||||||
|
|
||||||
DeleteObject(region);
|
DeleteObject(region);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LONG exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
|
// HACK: Disable framebuffer transparency on Windows 7 when the
|
||||||
exStyle &= ~WS_EX_LAYERED;
|
// colorization color is opaque, because otherwise the window
|
||||||
SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle);
|
// contents is blended additively with the previous frame instead
|
||||||
RedrawWindow(window->win32.handle, NULL, NULL,
|
// of replacing it
|
||||||
RDW_ERASE | RDW_INVALIDATE | RDW_FRAME);
|
DWM_BLURBEHIND bb = {0};
|
||||||
|
bb.dwFlags = DWM_BB_ENABLE;
|
||||||
|
DwmEnableBlurBehindWindow(window->win32.handle, &bb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,7 +505,17 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
case WM_NCCREATE:
|
case WM_NCCREATE:
|
||||||
{
|
{
|
||||||
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
||||||
EnableNonClientDpiScaling(hWnd);
|
{
|
||||||
|
const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam;
|
||||||
|
const _GLFWwndconfig* wndconfig = cs->lpCreateParams;
|
||||||
|
|
||||||
|
// On per-monitor DPI aware V1 systems, only enable
|
||||||
|
// non-client scaling for windows that scale the client area
|
||||||
|
// We need WM_GETDPISCALEDSIZE from V2 to keep the client
|
||||||
|
// area static when the non-client area is scaled
|
||||||
|
if (wndconfig && wndconfig->scaleToMonitor)
|
||||||
|
EnableNonClientDpiScaling(hWnd);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -645,11 +641,35 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
case WM_CHAR:
|
case WM_CHAR:
|
||||||
case WM_SYSCHAR:
|
case WM_SYSCHAR:
|
||||||
|
{
|
||||||
|
if (wParam >= 0xd800 && wParam <= 0xdbff)
|
||||||
|
window->win32.highSurrogate = (WCHAR) wParam;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unsigned int codepoint = 0;
|
||||||
|
|
||||||
|
if (wParam >= 0xdc00 && wParam <= 0xdfff)
|
||||||
|
{
|
||||||
|
if (window->win32.highSurrogate)
|
||||||
|
{
|
||||||
|
codepoint += (window->win32.highSurrogate - 0xd800) << 10;
|
||||||
|
codepoint += (WCHAR) wParam - 0xdc00;
|
||||||
|
codepoint += 0x10000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
codepoint = (WCHAR) wParam;
|
||||||
|
|
||||||
|
window->win32.highSurrogate = 0;
|
||||||
|
_glfwInputChar(window, codepoint, getKeyMods(), uMsg != WM_SYSCHAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_UNICHAR:
|
case WM_UNICHAR:
|
||||||
{
|
{
|
||||||
const GLFWbool plain = (uMsg != WM_SYSCHAR);
|
if (wParam == UNICODE_NOCHAR)
|
||||||
|
|
||||||
if (uMsg == WM_UNICHAR && wParam == UNICODE_NOCHAR)
|
|
||||||
{
|
{
|
||||||
// WM_UNICHAR is not sent by Windows, but is sent by some
|
// WM_UNICHAR is not sent by Windows, but is sent by some
|
||||||
// third-party input method engine
|
// third-party input method engine
|
||||||
@ -657,7 +677,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), plain);
|
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), GLFW_TRUE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -944,6 +964,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
{
|
||||||
|
const int width = LOWORD(lParam);
|
||||||
|
const int height = HIWORD(lParam);
|
||||||
const GLFWbool iconified = wParam == SIZE_MINIMIZED;
|
const GLFWbool iconified = wParam == SIZE_MINIMIZED;
|
||||||
const GLFWbool maximized = wParam == SIZE_MAXIMIZED ||
|
const GLFWbool maximized = wParam == SIZE_MAXIMIZED ||
|
||||||
(window->win32.maximized &&
|
(window->win32.maximized &&
|
||||||
@ -958,8 +980,14 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
if (window->win32.maximized != maximized)
|
if (window->win32.maximized != maximized)
|
||||||
_glfwInputWindowMaximize(window, maximized);
|
_glfwInputWindowMaximize(window, maximized);
|
||||||
|
|
||||||
_glfwInputFramebufferSize(window, LOWORD(lParam), HIWORD(lParam));
|
if (width != window->win32.width || height != window->win32.height)
|
||||||
_glfwInputWindowSize(window, LOWORD(lParam), HIWORD(lParam));
|
{
|
||||||
|
window->win32.width = width;
|
||||||
|
window->win32.height = height;
|
||||||
|
|
||||||
|
_glfwInputFramebufferSize(window, width, height);
|
||||||
|
_glfwInputWindowSize(window, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
if (window->monitor && window->win32.iconified != iconified)
|
if (window->monitor && window->win32.iconified != iconified)
|
||||||
{
|
{
|
||||||
@ -1073,6 +1101,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
case WM_DWMCOMPOSITIONCHANGED:
|
case WM_DWMCOMPOSITIONCHANGED:
|
||||||
|
case WM_DWMCOLORIZATIONCOLORCHANGED:
|
||||||
{
|
{
|
||||||
if (window->win32.transparent)
|
if (window->win32.transparent)
|
||||||
updateFramebufferTransparency(window);
|
updateFramebufferTransparency(window);
|
||||||
@ -1112,9 +1141,11 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
const float xscale = HIWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI;
|
const float xscale = HIWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI;
|
||||||
const float yscale = LOWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI;
|
const float yscale = LOWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI;
|
||||||
|
|
||||||
// Only apply the suggested size if the OS is new enough to have
|
// Resize windowed mode windows that either permit rescaling or that
|
||||||
// sent a WM_GETDPISCALEDSIZE before this
|
// need it to compensate for non-client area scaling
|
||||||
if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32())
|
if (!window->monitor &&
|
||||||
|
(window->win32.scaleToMonitor ||
|
||||||
|
_glfwIsWindows10CreatorsUpdateOrGreaterWin32()))
|
||||||
{
|
{
|
||||||
RECT* suggested = (RECT*) lParam;
|
RECT* suggested = (RECT*) lParam;
|
||||||
SetWindowPos(window->win32.handle, HWND_TOP,
|
SetWindowPos(window->win32.handle, HWND_TOP,
|
||||||
@ -1229,7 +1260,7 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
NULL, // No parent window
|
NULL, // No parent window
|
||||||
NULL, // No window menu
|
NULL, // No window menu
|
||||||
GetModuleHandleW(NULL),
|
GetModuleHandleW(NULL),
|
||||||
NULL);
|
(LPVOID) wndconfig);
|
||||||
|
|
||||||
free(wideTitle);
|
free(wideTitle);
|
||||||
|
|
||||||
@ -1296,6 +1327,8 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
window->win32.transparent = GLFW_TRUE;
|
window->win32.transparent = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_glfwPlatformGetWindowSize(window, &window->win32.width, &window->win32.height);
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1797,7 +1830,8 @@ int _glfwPlatformWindowHovered(_GLFWwindow* window)
|
|||||||
|
|
||||||
int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
|
int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
BOOL enabled;
|
BOOL composition, opaque;
|
||||||
|
DWORD color;
|
||||||
|
|
||||||
if (!window->win32.transparent)
|
if (!window->win32.transparent)
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
@ -1805,7 +1839,20 @@ int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
|
|||||||
if (!IsWindowsVistaOrGreater())
|
if (!IsWindowsVistaOrGreater())
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
|
||||||
return SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled;
|
if (FAILED(DwmIsCompositionEnabled(&composition)) || !composition)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
if (!IsWindows8OrGreater())
|
||||||
|
{
|
||||||
|
// HACK: Disable framebuffer transparency on Windows 7 when the
|
||||||
|
// colorization color is opaque, because otherwise the window
|
||||||
|
// contents is blended additively with the previous frame instead
|
||||||
|
// of replacing it
|
||||||
|
if (FAILED(DwmGetColorizationColor(&color, &opaque)) || opaque)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
|
void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
|
||||||
|
1
internal/glfw/glfw/src/window.c
vendored
1
internal/glfw/glfw/src/window.c
vendored
@ -1099,3 +1099,4 @@ GLFWAPI void glfwPostEmptyEvent(void)
|
|||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
_glfwPlatformPostEmptyEvent();
|
_glfwPlatformPostEmptyEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
package glfw
|
package glfw
|
||||||
|
|
||||||
const glfwDLLHash = "93ce68219cb0e920a0b9f04a38bbeff104f530a643fd0a792215572525869f90"
|
const glfwDLLHash = "acab6665ea9a1e855eaa0a7e6cb56b8c3a252240e8cf829c99ba2f094cc969c9"
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
package glfw
|
package glfw
|
||||||
|
|
||||||
const glfwDLLHash = "9297f0b5337eb17f170398f4e027f59a8daf502cb45cff9b74b615d70d8369c2"
|
const glfwDLLHash = "cc243593fabeb8a7a12f189a588504628b1b97cbc0be8366e15327230e8ef733"
|
||||||
|
Loading…
Reference in New Issue
Block a user