mirror of
https://github.com/glfw/glfw.git
synced 2025-12-19 05:31:57 +00:00
Compare commits
14 Commits
e8ef7c3330
...
94ec2521ec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94ec2521ec | ||
|
|
162896e5b9 | ||
|
|
936307558e | ||
|
|
4df5129529 | ||
|
|
6de70d8252 | ||
|
|
c371f4cb7d | ||
|
|
845f0bd901 | ||
|
|
955e8b0fa4 | ||
|
|
8c3f416c3b | ||
|
|
77fae536a9 | ||
|
|
1b5c120205 | ||
|
|
bb4ba846da | ||
|
|
618532218e | ||
|
|
98019fbe98 |
@ -282,10 +282,12 @@ video tutorials.
|
||||
- Corentin Wallez
|
||||
- Torsten Walluhn
|
||||
- Patrick Walton
|
||||
- Ivor Wanders
|
||||
- Jim Wang
|
||||
- Xo Wang
|
||||
- Andre Weissflog
|
||||
- Jay Weisskopf
|
||||
- Drew Weymouth
|
||||
- Frank Wille
|
||||
- Andy Williams
|
||||
- Joel Winarske
|
||||
|
||||
@ -144,7 +144,13 @@ information on what to include when reporting a bug.
|
||||
a modal to a fallback decoration
|
||||
- [Wayland] Bugfix: The cursor position was not updated when clicking through
|
||||
from a modal to the content area
|
||||
- [Wayland] Bugfix: free modules at end of terminate function to resolve
|
||||
potential segmentation fault (#2744)
|
||||
- [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631)
|
||||
- [X11] Bugfix: Occasional crash when an idle display awakes (#2766)
|
||||
- [X11] Bugfix: Prevent BadWindow when creating small windows with a content scale
|
||||
less than 1 (#2754)
|
||||
- [X11] Bugfix: Clamp width and height to >= 1 to prevent BadValue error and app exit
|
||||
- [Null] Added Vulkan 'window' surface creation via `VK_EXT_headless_surface`
|
||||
- [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
|
||||
|
||||
@ -1102,6 +1102,7 @@ extern "C" {
|
||||
* [window hint](@ref GLFW_SCALE_FRAMEBUFFER_hint).
|
||||
*/
|
||||
#define GLFW_SCALE_FRAMEBUFFER 0x0002200D
|
||||
#define GLFW_FULLSCREEN 0x0002200E
|
||||
/*! @brief Legacy name for compatibility.
|
||||
*
|
||||
* This is an alias for the
|
||||
|
||||
@ -555,6 +555,7 @@ GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform* platform)
|
||||
.setWindowFloating = _glfwSetWindowFloatingCocoa,
|
||||
.setWindowOpacity = _glfwSetWindowOpacityCocoa,
|
||||
.setWindowMousePassthrough = _glfwSetWindowMousePassthroughCocoa,
|
||||
.getWindowIsFullscreen = _glfwGetWindowIsFullscreenNull,
|
||||
.pollEvents = _glfwPollEventsCocoa,
|
||||
.waitEvents = _glfwWaitEventsCocoa,
|
||||
.waitEventsTimeout = _glfwWaitEventsTimeoutCocoa,
|
||||
|
||||
@ -247,6 +247,7 @@ void _glfwSetWindowFloatingCocoa(_GLFWwindow* window, GLFWbool enabled);
|
||||
float _glfwGetWindowOpacityCocoa(_GLFWwindow* window);
|
||||
void _glfwSetWindowOpacityCocoa(_GLFWwindow* window, float opacity);
|
||||
void _glfwSetWindowMousePassthroughCocoa(_GLFWwindow* window, GLFWbool enabled);
|
||||
GLFWbool _glfwGetWindowIsFullscreenCocoa(_GLFWwindow* window);
|
||||
|
||||
void _glfwSetRawMouseMotionCocoa(_GLFWwindow *window, GLFWbool enabled);
|
||||
GLFWbool _glfwRawMouseMotionSupportedCocoa(void);
|
||||
|
||||
@ -555,7 +555,8 @@ void _glfwTerminateEGL(void)
|
||||
_glfw.egl.display = EGL_NO_DISPLAY;
|
||||
}
|
||||
|
||||
if (_glfw.egl.handle)
|
||||
// Free modules only after all wayland termination functions are called
|
||||
if (_glfw.egl.handle && _glfw.platform.platformID != GLFW_PLATFORM_WAYLAND)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.egl.handle);
|
||||
_glfw.egl.handle = NULL;
|
||||
|
||||
@ -746,6 +746,7 @@ struct _GLFWplatform
|
||||
void (*setWindowFloating)(_GLFWwindow*,GLFWbool);
|
||||
void (*setWindowOpacity)(_GLFWwindow*,float);
|
||||
void (*setWindowMousePassthrough)(_GLFWwindow*,GLFWbool);
|
||||
GLFWbool (*getWindowIsFullscreen) (_GLFWwindow*);
|
||||
void (*pollEvents)(void);
|
||||
void (*waitEvents)(void);
|
||||
void (*waitEventsTimeout)(double);
|
||||
|
||||
@ -243,6 +243,8 @@ void _glfwSetWindowResizableNull(_GLFWwindow* window, GLFWbool enabled);
|
||||
void _glfwSetWindowDecoratedNull(_GLFWwindow* window, GLFWbool enabled);
|
||||
void _glfwSetWindowFloatingNull(_GLFWwindow* window, GLFWbool enabled);
|
||||
void _glfwSetWindowMousePassthroughNull(_GLFWwindow* window, GLFWbool enabled);
|
||||
GLFWbool _glfwGetWindowIsFullscreenNull(_GLFWwindow* window);
|
||||
|
||||
float _glfwGetWindowOpacityNull(_GLFWwindow* window);
|
||||
void _glfwSetWindowOpacityNull(_GLFWwindow* window, float opacity);
|
||||
void _glfwSetRawMouseMotionNull(_GLFWwindow *window, GLFWbool enabled);
|
||||
|
||||
@ -408,6 +408,11 @@ void _glfwSetWindowMousePassthroughNull(_GLFWwindow* window, GLFWbool enabled)
|
||||
{
|
||||
}
|
||||
|
||||
GLFWbool _glfwGetWindowIsFullscreenNull(_GLFWwindow* window)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
float _glfwGetWindowOpacityNull(_GLFWwindow* window)
|
||||
{
|
||||
return window->null.opacity;
|
||||
|
||||
@ -660,6 +660,7 @@ GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform)
|
||||
.setWindowFloating = _glfwSetWindowFloatingWin32,
|
||||
.setWindowOpacity = _glfwSetWindowOpacityWin32,
|
||||
.setWindowMousePassthrough = _glfwSetWindowMousePassthroughWin32,
|
||||
.getWindowIsFullscreen = _glfwGetWindowIsFullscreenNull,
|
||||
.pollEvents = _glfwPollEventsWin32,
|
||||
.waitEvents = _glfwWaitEventsWin32,
|
||||
.waitEventsTimeout = _glfwWaitEventsTimeoutWin32,
|
||||
|
||||
@ -513,6 +513,7 @@ void _glfwSetWindowResizableWin32(_GLFWwindow* window, GLFWbool enabled);
|
||||
void _glfwSetWindowDecoratedWin32(_GLFWwindow* window, GLFWbool enabled);
|
||||
void _glfwSetWindowFloatingWin32(_GLFWwindow* window, GLFWbool enabled);
|
||||
void _glfwSetWindowMousePassthroughWin32(_GLFWwindow* window, GLFWbool enabled);
|
||||
GLFWbool _glfwGetWindowIsFullscreenWin32(_GLFWwindow* window);
|
||||
float _glfwGetWindowOpacityWin32(_GLFWwindow* window);
|
||||
void _glfwSetWindowOpacityWin32(_GLFWwindow* window, float opacity);
|
||||
|
||||
|
||||
@ -899,6 +899,8 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
|
||||
return window->focusOnShow;
|
||||
case GLFW_MOUSE_PASSTHROUGH:
|
||||
return window->mousePassthrough;
|
||||
case GLFW_FULLSCREEN:
|
||||
return _glfw.platform.getWindowIsFullscreen(window);
|
||||
case GLFW_TRANSPARENT_FRAMEBUFFER:
|
||||
return _glfw.platform.framebufferTransparent(window);
|
||||
case GLFW_RESIZABLE:
|
||||
|
||||
@ -506,6 +506,7 @@ GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform)
|
||||
.setWindowFloating = _glfwSetWindowFloatingWayland,
|
||||
.setWindowOpacity = _glfwSetWindowOpacityWayland,
|
||||
.setWindowMousePassthrough = _glfwSetWindowMousePassthroughWayland,
|
||||
.getWindowIsFullscreen = _glfwGetWindowIsFullscreenNull,
|
||||
.pollEvents = _glfwPollEventsWayland,
|
||||
.waitEvents = _glfwWaitEventsWayland,
|
||||
.waitEventsTimeout = _glfwWaitEventsTimeoutWayland,
|
||||
@ -907,18 +908,6 @@ void _glfwTerminateWayland(void)
|
||||
libdecor_unref(_glfw.wl.libdecor.context);
|
||||
}
|
||||
|
||||
if (_glfw.wl.libdecor.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.libdecor.handle);
|
||||
_glfw.wl.libdecor.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.egl.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.egl.handle);
|
||||
_glfw.wl.egl.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.xkb.composeState)
|
||||
xkb_compose_state_unref(_glfw.wl.xkb.composeState);
|
||||
if (_glfw.wl.xkb.keymap)
|
||||
@ -927,21 +916,11 @@ void _glfwTerminateWayland(void)
|
||||
xkb_state_unref(_glfw.wl.xkb.state);
|
||||
if (_glfw.wl.xkb.context)
|
||||
xkb_context_unref(_glfw.wl.xkb.context);
|
||||
if (_glfw.wl.xkb.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.xkb.handle);
|
||||
_glfw.wl.xkb.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.cursorTheme)
|
||||
wl_cursor_theme_destroy(_glfw.wl.cursorTheme);
|
||||
if (_glfw.wl.cursorThemeHiDPI)
|
||||
wl_cursor_theme_destroy(_glfw.wl.cursorThemeHiDPI);
|
||||
if (_glfw.wl.cursor.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.cursor.handle);
|
||||
_glfw.wl.cursor.handle = NULL;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < _glfw.wl.offerCount; i++)
|
||||
wl_data_offer_destroy(_glfw.wl.offers[i].offer);
|
||||
@ -1001,6 +980,36 @@ void _glfwTerminateWayland(void)
|
||||
if (_glfw.wl.cursorTimerfd >= 0)
|
||||
close(_glfw.wl.cursorTimerfd);
|
||||
|
||||
// Free modules only after all wayland termination functions are called
|
||||
if (_glfw.egl.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.egl.handle);
|
||||
_glfw.egl.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.libdecor.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.libdecor.handle);
|
||||
_glfw.wl.libdecor.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.egl.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.egl.handle);
|
||||
_glfw.wl.egl.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.xkb.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.xkb.handle);
|
||||
_glfw.wl.xkb.handle = NULL;
|
||||
}
|
||||
if (_glfw.wl.cursor.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.cursor.handle);
|
||||
_glfw.wl.cursor.handle = NULL;
|
||||
}
|
||||
|
||||
_glfw_free(_glfw.wl.clipboardString);
|
||||
}
|
||||
|
||||
|
||||
@ -649,6 +649,7 @@ void _glfwSetWindowFloatingWayland(_GLFWwindow* window, GLFWbool enabled);
|
||||
float _glfwGetWindowOpacityWayland(_GLFWwindow* window);
|
||||
void _glfwSetWindowOpacityWayland(_GLFWwindow* window, float opacity);
|
||||
void _glfwSetWindowMousePassthroughWayland(_GLFWwindow* window, GLFWbool enabled);
|
||||
GLFWbool _glfwGetWindowIsFullscreenWayland(_GLFWwindow* window);
|
||||
|
||||
void _glfwSetRawMouseMotionWayland(_GLFWwindow* window, GLFWbool enabled);
|
||||
GLFWbool _glfwRawMouseMotionSupportedWayland(void);
|
||||
|
||||
@ -1237,6 +1237,7 @@ GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform)
|
||||
.setWindowFloating = _glfwSetWindowFloatingX11,
|
||||
.setWindowOpacity = _glfwSetWindowOpacityX11,
|
||||
.setWindowMousePassthrough = _glfwSetWindowMousePassthroughX11,
|
||||
.getWindowIsFullscreen = _glfwGetWindowIsFullscreenX11,
|
||||
.pollEvents = _glfwPollEventsX11,
|
||||
.waitEvents = _glfwWaitEventsX11,
|
||||
.waitEventsTimeout = _glfwWaitEventsTimeoutX11,
|
||||
|
||||
@ -151,6 +151,11 @@ void _glfwPollMonitorsX11(void)
|
||||
}
|
||||
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, oi->crtc);
|
||||
if (!ci) {
|
||||
XRRFreeOutputInfo(oi);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ci->rotation == RR_Rotate_90 || ci->rotation == RR_Rotate_270)
|
||||
{
|
||||
widthMM = oi->mm_height;
|
||||
|
||||
@ -935,6 +935,7 @@ void _glfwSetWindowFloatingX11(_GLFWwindow* window, GLFWbool enabled);
|
||||
float _glfwGetWindowOpacityX11(_GLFWwindow* window);
|
||||
void _glfwSetWindowOpacityX11(_GLFWwindow* window, float opacity);
|
||||
void _glfwSetWindowMousePassthroughX11(_GLFWwindow* window, GLFWbool enabled);
|
||||
GLFWbool _glfwGetWindowIsFullscreenX11(_GLFWwindow* window);
|
||||
|
||||
void _glfwSetRawMouseMotionX11(_GLFWwindow *window, GLFWbool enabled);
|
||||
GLFWbool _glfwRawMouseMotionSupportedX11(void);
|
||||
|
||||
@ -576,6 +576,10 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
||||
height *= _glfw.x11.contentScaleY;
|
||||
}
|
||||
|
||||
// The dimensions must be nonzero, or a BadValue error results.
|
||||
width = _glfw_max(1, width);
|
||||
height = _glfw_max(1, height);
|
||||
|
||||
int xpos = 0, ypos = 0;
|
||||
|
||||
if (wndconfig->xpos != GLFW_ANY_POSITION && wndconfig->ypos != GLFW_ANY_POSITION)
|
||||
@ -2203,6 +2207,10 @@ void _glfwGetWindowSizeX11(_GLFWwindow* window, int* width, int* height)
|
||||
|
||||
void _glfwSetWindowSizeX11(_GLFWwindow* window, int width, int height)
|
||||
{
|
||||
// The dimensions must be nonzero, or a BadValue error results.
|
||||
width = _glfw_max(1, width);
|
||||
height = _glfw_max(1, height);
|
||||
|
||||
if (window->monitor)
|
||||
{
|
||||
if (window->monitor->window == window)
|
||||
@ -2729,6 +2737,51 @@ void _glfwSetWindowMousePassthroughX11(_GLFWwindow* window, GLFWbool enabled)
|
||||
}
|
||||
}
|
||||
|
||||
GLFWbool _glfwGetWindowIsFullscreenX11(_GLFWwindow* window)
|
||||
{
|
||||
Atom wm_state = XInternAtom(_glfw.x11.display, "_NET_WM_STATE", True);
|
||||
Atom wm_state_fullscreen = XInternAtom(_glfw.x11.display, "_NET_WM_STATE_FULLSCREEN", True);
|
||||
|
||||
Atom type = XA_ATOM;
|
||||
int format;
|
||||
size_t nItems;
|
||||
size_t bytesAfterReturn;
|
||||
Atom* prop;
|
||||
|
||||
int result = XGetWindowProperty(
|
||||
_glfw.x11.display,
|
||||
window->x11.handle,
|
||||
wm_state,
|
||||
0,
|
||||
~0L,
|
||||
False,
|
||||
AnyPropertyType,
|
||||
&type,
|
||||
&format,
|
||||
&nItems,
|
||||
&bytesAfterReturn,
|
||||
(unsigned char**)&prop
|
||||
);
|
||||
|
||||
assert(result == Success);
|
||||
assert(nItems > 0);
|
||||
|
||||
if (!prop) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
GLFWbool isFullscreen = 0;
|
||||
for (int i = 0; i < nItems; i++) {
|
||||
if (prop[i] == wm_state_fullscreen) {
|
||||
isFullscreen = 1;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(prop);
|
||||
|
||||
return isFullscreen;
|
||||
}
|
||||
|
||||
float _glfwGetWindowOpacityX11(_GLFWwindow* window)
|
||||
{
|
||||
float opacity = 1.f;
|
||||
|
||||
@ -441,6 +441,7 @@ int main(int argc, char** argv)
|
||||
nk_value_bool(nk, "Visible", glfwGetWindowAttrib(window, GLFW_VISIBLE));
|
||||
nk_value_bool(nk, "Iconified", glfwGetWindowAttrib(window, GLFW_ICONIFIED));
|
||||
nk_value_bool(nk, "Maximized", glfwGetWindowAttrib(window, GLFW_MAXIMIZED));
|
||||
nk_value_bool(nk, "Fullscreen", glfwGetWindowAttrib(window, GLFW_FULLSCREEN));
|
||||
}
|
||||
nk_end(nk);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user