Merge branch 'master' into multi-context-windows-merge-master

This commit is contained in:
Doug Binks 2022-06-26 17:17:14 +02:00
commit f40442fa59
6 changed files with 518 additions and 302 deletions

View File

@ -24,6 +24,7 @@ video tutorials.
- Waris Boonyasiriwat - Waris Boonyasiriwat
- Kyle Brenneman - Kyle Brenneman
- Rok Breulj - Rok Breulj
- TheBrokenRail
- Kai Burjack - Kai Burjack
- Martin Capitanio - Martin Capitanio
- Nicolas Caramelli - Nicolas Caramelli
@ -145,6 +146,7 @@ video tutorials.
- Pierre Moulon - Pierre Moulon
- Martins Mozeiko - Martins Mozeiko
- Pascal Muetschard - Pascal Muetschard
- James Murphy
- Julian Møller - Julian Møller
- ndogxj - ndogxj
- n3rdopolis - n3rdopolis
@ -160,6 +162,7 @@ video tutorials.
- Christopher Pelloux - Christopher Pelloux
- Arturo J. Pérez - Arturo J. Pérez
- Vladimir Perminov - Vladimir Perminov
- Olivier Perret
- Anthony Pesch - Anthony Pesch
- Orson Peters - Orson Peters
- Emmanuel Gil Peyrot - Emmanuel Gil Peyrot
@ -173,6 +176,7 @@ video tutorials.
- Pablo Prietz - Pablo Prietz
- przemekmirek - przemekmirek
- pthom - pthom
- Martin Pulec
- Guillaume Racicot - Guillaume Racicot
- Philip Rideout - Philip Rideout
- Eddie Ringle - Eddie Ringle

View File

@ -302,6 +302,7 @@ information on what to include when reporting a bug.
- [Wayland] Added dynamic loading of all Wayland libraries - [Wayland] Added dynamic loading of all Wayland libraries
- [Wayland] Added support for key names via xkbcommon - [Wayland] Added support for key names via xkbcommon
- [Wayland] Added support for file path drop events (#2040) - [Wayland] Added support for file path drop events (#2040)
- [Wayland] Added support for more human-readable monitor names where available
- [Wayland] Removed support for `wl_shell` (#1443) - [Wayland] Removed support for `wl_shell` (#1443)
- [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432) - [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432)
- [Wayland] Bugfix: `CLOCK_MONOTONIC` was not correctly enabled - [Wayland] Bugfix: `CLOCK_MONOTONIC` was not correctly enabled
@ -335,6 +336,37 @@ information on what to include when reporting a bug.
- [Wayland] Bugfix: The OSMesa library was not unloaded on termination - [Wayland] Bugfix: The OSMesa library was not unloaded on termination
- [Wayland] Bugfix: `glfwCreateWindow` could emit `GLFW_FEATURE_UNAVAILABLE` - [Wayland] Bugfix: `glfwCreateWindow` could emit `GLFW_FEATURE_UNAVAILABLE`
- [Wayland] Bugfix: Lock key modifier bits were only set when lock keys were pressed - [Wayland] Bugfix: Lock key modifier bits were only set when lock keys were pressed
- [Wayland] Bugfix: A window leaving full screen mode would be iconified (#1995)
- [Wayland] Bugfix: A window leaving full screen mode ignored its desired size
- [Wayland] Bugfix: `glfwSetWindowMonitor` did not update windowed mode size
- [Wayland] Bugfix: `glfwRestoreWindow` would make a full screen window windowed
- [Wayland] Bugfix: A window maximized or restored by the user would enter an
inconsistent state
- [Wayland] Bugfix: Window maximization events were not emitted
- [Wayland] Bugfix: `glfwRestoreWindow` assumed it was always in windowed mode
- [Wayland] Bugfix: `glfwSetWindowSize` would resize a full screen window
- [Wayland] Bugfix: A window content scale event would be emitted every time
the window resized
- [Wayland] Bugfix: If `glfwInit` failed it would close stdin
- [Wayland] Bugfix: Manual resizing with fallback decorations behaved erratically
(#1991,#2115,#2127)
- [Wayland] Bugfix: Size limits included frame size for fallback decorations
- [Wayland] Bugfix: Updating `GLFW_DECORATED` had no effect on server-side
decorations
- [Wayland] Bugfix: A monitor would be reported as connected again if its scale
changed
- [Wayland] Bugfix: `glfwTerminate` would segfault if any monitor had changed
scale
- [Wayland] Bugfix: Window content scale events were not emitted when monitor
scale changed
- [Wayland] Bugfix: `glfwSetWindowAspectRatio` reported an error instead of
applying the specified ratio
- [Wayland] Bugfix: `GLFW_MAXIMIZED` window hint had no effect
- [Wayland] Bugfix: `glfwRestoreWindow` had no effect before first show
- [Wayland] Bugfix: Hiding and then showing a window caused program abort on
wlroots compositors (#1268)
- [Wayland] Bugfix: `GLFW_DECORATED` was ignored when showing a window with XDG
decorations
- [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Removed use of deprecated function `gettimeofday`
- [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
- [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072)

View File

@ -184,11 +184,9 @@ static void registryHandleGlobalRemove(void* userData,
struct wl_registry* registry, struct wl_registry* registry,
uint32_t name) uint32_t name)
{ {
_GLFWmonitor* monitor;
for (int i = 0; i < _glfw.monitorCount; ++i) for (int i = 0; i < _glfw.monitorCount; ++i)
{ {
monitor = _glfw.monitors[i]; _GLFWmonitor* monitor = _glfw.monitors[i];
if (monitor->wl.name == name) if (monitor->wl.name == name)
{ {
_glfwInputMonitor(monitor, GLFW_DISCONNECTED, 0); _glfwInputMonitor(monitor, GLFW_DISCONNECTED, 0);
@ -480,6 +478,10 @@ int _glfwInitWayland(void)
long cursorSizeLong; long cursorSizeLong;
int cursorSize; int cursorSize;
// These must be set before any failure checks
_glfw.wl.timerfd = -1;
_glfw.wl.cursorTimerfd = -1;
_glfw.wl.client.display_flush = (PFN_wl_display_flush) _glfw.wl.client.display_flush = (PFN_wl_display_flush)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_flush"); _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_flush");
_glfw.wl.client.display_cancel_read = (PFN_wl_display_cancel_read) _glfw.wl.client.display_cancel_read = (PFN_wl_display_cancel_read)
@ -636,9 +638,10 @@ int _glfwInitWayland(void)
// Sync so we got all initial output events // Sync so we got all initial output events
wl_display_roundtrip(_glfw.wl.display); wl_display_roundtrip(_glfw.wl.display);
_glfw.wl.timerfd = -1; #ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION
if (_glfw.wl.seatVersion >= 4) if (_glfw.wl.seatVersion >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION)
_glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); _glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
#endif
if (!_glfw.wl.wmBase) if (!_glfw.wl.wmBase)
{ {

View File

@ -55,7 +55,8 @@ static void outputHandleGeometry(void* userData,
monitor->widthMM = physicalWidth; monitor->widthMM = physicalWidth;
monitor->heightMM = physicalHeight; monitor->heightMM = physicalHeight;
snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model); if (strlen(monitor->name) == 0)
snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model);
} }
static void outputHandleMode(void* userData, static void outputHandleMode(void* userData,
@ -96,6 +97,12 @@ static void outputHandleDone(void* userData, struct wl_output* output)
monitor->heightMM = (int) (mode->height * 25.4f / 96.f); monitor->heightMM = (int) (mode->height * 25.4f / 96.f);
} }
for (int i = 0; i < _glfw.monitorCount; i++)
{
if (_glfw.monitors[i] == monitor)
return;
}
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST); _glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
} }
@ -106,14 +113,47 @@ static void outputHandleScale(void* userData,
struct _GLFWmonitor* monitor = userData; struct _GLFWmonitor* monitor = userData;
monitor->wl.scale = factor; monitor->wl.scale = factor;
for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
{
for (int i = 0; i < window->wl.monitorsCount; i++)
{
if (window->wl.monitors[i] == monitor)
{
_glfwUpdateContentScaleWayland(window);
break;
}
}
}
} }
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
void outputHandleName(void* userData, struct wl_output* wl_output, const char* name)
{
struct _GLFWmonitor* monitor = userData;
strncpy(monitor->name, name, sizeof(monitor->name) - 1);
}
void outputHandleDescription(void* userData,
struct wl_output* wl_output,
const char* description)
{
}
#endif // WL_OUTPUT_NAME_SINCE_VERSION
static const struct wl_output_listener outputListener = static const struct wl_output_listener outputListener =
{ {
outputHandleGeometry, outputHandleGeometry,
outputHandleMode, outputHandleMode,
outputHandleDone, outputHandleDone,
outputHandleScale, outputHandleScale,
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
outputHandleName,
outputHandleDescription,
#endif
}; };
@ -123,9 +163,6 @@ static const struct wl_output_listener outputListener =
void _glfwAddOutputWayland(uint32_t name, uint32_t version) void _glfwAddOutputWayland(uint32_t name, uint32_t version)
{ {
_GLFWmonitor* monitor;
struct wl_output* output;
if (version < 2) if (version < 2)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
@ -133,19 +170,21 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
return; return;
} }
// The actual name of this output will be set in the geometry handler. #ifdef WL_OUTPUT_NAME_SINCE_VERSION
monitor = _glfwAllocMonitor("", 0, 0); version = _glfw_min(version, WL_OUTPUT_NAME_SINCE_VERSION);
#else
version = 2;
#endif
output = wl_registry_bind(_glfw.wl.registry, struct wl_output* output = wl_registry_bind(_glfw.wl.registry,
name, name,
&wl_output_interface, &wl_output_interface,
2); version);
if (!output) if (!output)
{
_glfwFreeMonitor(monitor);
return; return;
}
// The actual name of this output will be set in the geometry handler
_GLFWmonitor* monitor = _glfwAllocMonitor("", 0, 0);
monitor->wl.scale = 1; monitor->wl.scale = 1;
monitor->wl.output = output; monitor->wl.output = output;
monitor->wl.name = name; monitor->wl.name = name;

View File

@ -198,11 +198,6 @@ typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_st
#define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status #define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status
#define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym #define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym
#define _GLFW_DECORATION_WIDTH 4
#define _GLFW_DECORATION_TOP 24
#define _GLFW_DECORATION_VERTICAL (_GLFW_DECORATION_TOP + _GLFW_DECORATION_WIDTH)
#define _GLFW_DECORATION_HORIZONTAL (2 * _GLFW_DECORATION_WIDTH)
typedef enum _GLFWdecorationSideWayland typedef enum _GLFWdecorationSideWayland
{ {
mainWindow, mainWindow,
@ -233,16 +228,30 @@ typedef struct _GLFWwindowWayland
int width, height; int width, height;
GLFWbool visible; GLFWbool visible;
GLFWbool maximized; GLFWbool maximized;
GLFWbool activated;
GLFWbool fullscreen;
GLFWbool hovered; GLFWbool hovered;
GLFWbool transparent; GLFWbool transparent;
struct wl_surface* surface; struct wl_surface* surface;
struct wl_egl_window* native;
struct wl_callback* callback; struct wl_callback* callback;
struct {
struct wl_egl_window* window;
} egl;
struct {
int width, height;
GLFWbool maximized;
GLFWbool iconified;
GLFWbool activated;
GLFWbool fullscreen;
} pending;
struct { struct {
struct xdg_surface* surface; struct xdg_surface* surface;
struct xdg_toplevel* toplevel; struct xdg_toplevel* toplevel;
struct zxdg_toplevel_decoration_v1* decoration; struct zxdg_toplevel_decoration_v1* decoration;
uint32_t decorationMode;
} xdg; } xdg;
_GLFWcursor* currentCursor; _GLFWcursor* currentCursor;
@ -264,13 +273,10 @@ typedef struct _GLFWwindowWayland
struct zwp_idle_inhibitor_v1* idleInhibitor; struct zwp_idle_inhibitor_v1* idleInhibitor;
GLFWbool wasFullscreen;
struct { struct {
GLFWbool serverSide;
struct wl_buffer* buffer; struct wl_buffer* buffer;
_GLFWdecorationWayland top, left, right, bottom; _GLFWdecorationWayland top, left, right, bottom;
int focus; _GLFWdecorationSideWayland focus;
} decorations; } decorations;
} _GLFWwindowWayland; } _GLFWwindowWayland;
@ -508,6 +514,7 @@ GLFWbool _glfwGetGammaRampWayland(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
void _glfwSetGammaRampWayland(_GLFWmonitor* monitor, const GLFWgammaramp* ramp); void _glfwSetGammaRampWayland(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
void _glfwAddOutputWayland(uint32_t name, uint32_t version); void _glfwAddOutputWayland(uint32_t name, uint32_t version);
void _glfwUpdateContentScaleWayland(_GLFWwindow* window);
GLFWbool _glfwInputTextWayland(_GLFWwindow* window, uint32_t scancode); GLFWbool _glfwInputTextWayland(_GLFWwindow* window, uint32_t scancode);
_GLFWusercontext* _glfwCreateUserContextWayland(_GLFWwindow* window); _GLFWusercontext* _glfwCreateUserContextWayland(_GLFWwindow* window);

File diff suppressed because it is too large Load Diff