diff options
author | EncryptedCicada | 2021-12-29 11:37:25 +0530 |
---|---|---|
committer | EncryptedCicada | 2021-12-29 11:37:25 +0530 |
commit | fe976390827d285132270188849f32e956524e1f (patch) | |
tree | 6acfd85f786f9eadc5cc26c8a583783a1f4d4171 | |
parent | 3c94b47ff80eb81fae96049b4ed1b26657afe390 (diff) | |
download | aur-fe976390827d285132270188849f32e956524e1f.tar.gz |
Merged Upstream
15 files changed, 570 insertions, 736 deletions
@@ -20,21 +20,28 @@ pkgbase = glfw-wayland-minecraft-libdecoration depends = wayland depends = libxkbcommon depends = libgl - depends = libdecor provides = glfw=3.4.0 conflicts = glfw conflicts = glfw-wayland source = https://github.com/glfw/glfw/archive/87d5646f5d2bad0562744501633bf8105f59c193.tar.gz - source = 0001-libdecoration-support.patch - source = 0002-set-O_NONBLOCK-on-repeat-timerfd.patch - source = 0003-wayland-don-t-crash-app-on-api-calls-to-window-focus.patch - source = 0004-fix-broken-opengl-screenshots-on-mutter.patch - source = 0005-don-t-crash-on-get-scancode-name.patch - sha256sums = 7b8c990cfb039110d38c7f5bb21948c402933be3f93f333fe7dcda3deaf72aa4 - sha256sums = c163b4a0a6496d758bc656203c23151015683754a6b5c2fc4944df7296d6b5af - sha256sums = 5cd74a83dc7824c7696c1534f880b7a4a0992bb6dba6e4531ad1c040541f1d30 - sha256sums = a442f8c7e40fb09775f922b95402108b366114874ee96e370c29e5f8500a02b7 - sha256sums = 27aea70b07df2d46ac7469c129d28d695eff1ec9492489aa7b2558dd780ebdf0 - sha256sums = 16a2410511d75f00902ab1869942a80d85261f8390a97be946f82662891351e5 + source = 0001-Wayland-Set-O_NONBLOCK-on-repeat-timerfd.patch + source = 0002-Wayland-Continue-poll-if-timerfd-can-t-be-read.patch + source = 0003-Don-t-crash-on-calls-to-focus-or-icon.patch + source = 0004-wayland-fix-broken-opengl-screenshots-on-mutter.patch + source = 0005-Add-warning-about-being-an-unofficial-patch.patch + source = 0006-Don-t-crash-getting-scancode-name.patch + source = 0007-libdecor-proper-decorations-with-title-and-window-bu.patch + source = 0008-Add-libdecoration-marker-to-stderr-warning.patch + source = 0009-Wayland-Fix-cursor-offset-when-shape-changes.patch + sha512sums = 4fb9c8900165bd6e9d64f30017f81471cc4aecf8ea5cc35dbf586ab2f6d2ffc4c765d9b84799fc64bcf8d08a8f693b3fd1967017c2178edf85fcb353c829e0ca + sha512sums = fd7090ae10ef1f52c3f01d95716cbb55a73da4d211608f84ec38abf99aee240d8b75cf84ba4b11e2b0c462397248a060a14ef1955574bb1609051a2653f43f4a + sha512sums = 009c1b6b07cdea4f6ada3d068837d9447e79ce2e9c0336b33a742df4fa6b0978914d3a0e45b745205c910bb30fd373e557c5060cd499aad99b13938630102b15 + sha512sums = 9c6f6e81de1feafeed93988207999d21754c93ff97c8c3158aee43f38b291f4589feaf83e42081445cf89c9209c86e56a0102fccf0d0a97740874dd88e84a746 + sha512sums = 3c6d317c0c129effd6da48e183228da952a28286acd09abaec4d934031e39a5531d44306e4308c75b33b515113eb54942ca18885edd49b14254af24085de52da + sha512sums = d8e8b704e19652bb30c7799300a1bd0db1619ad17e8e36a3ee51673933eba6a8c47dbd615f4a9a385021bdfaa1ddedb2f24e8c05b670ef5278c71d217e91146e + sha512sums = b35562f1a65ede074e2b1c9caf934062488d391912a41da1ebbc328d2e3500cea31882a9228b9dfad357e571265825aabcfebb3c74bce077ed6e9752c7f865f5 + sha512sums = c9893d17241b2a2aa8a02faa0e39f0b41e2b77d1aaee9c6162938265b8a1c52a104068b9837206c27d4d7f1910cf61bc4a32daaeb56ac2066bd39088b27fdc40 + sha512sums = 12266bb2f86466b933785f47b7638539b1190b513c956297517367e90b059699cab1bfd08f636db45a60a97abe42684eb83534a90ca1cfb25e608c26ba817c30 + sha512sums = 40daf899af7aa8dd344b48803b6ac44810e83cff05913ed9466ec25fd08f62a0473435bec87b23012609891e1e3129d70261453bfc1fc9e0dd52e799cf4ebc1e pkgname = glfw-wayland-minecraft-libdecoration diff --git a/.gitignore b/.gitignore index d53251af9d26..12dc576dd5a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ * + !*.patch !.SRCINFO -!.gitignore !PKGBUILD -!README.md
\ No newline at end of file + +!.gitignore +!README.md diff --git a/0002-set-O_NONBLOCK-on-repeat-timerfd.patch b/0001-Wayland-Set-O_NONBLOCK-on-repeat-timerfd.patch index e21cf69be0e3..9797dca34d96 100644 --- a/0002-set-O_NONBLOCK-on-repeat-timerfd.patch +++ b/0001-Wayland-Set-O_NONBLOCK-on-repeat-timerfd.patch @@ -1,7 +1,7 @@ -From 963e728881d7551aab0b843c79915f2419d4d36e Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Stone Tickle <lattis@mochiro.moe> Date: Fri, 5 Jun 2020 12:51:25 +0900 -Subject: [PATCH] Wayland: Set O_NONBLOCK on repeat timerfd +Subject: Wayland: Set O_NONBLOCK on repeat timerfd Fixes #1710 Fixes #1711 @@ -10,10 +10,10 @@ Fixes #1711 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wl_init.c b/src/wl_init.c -index acfe477d4..bba908fa9 100644 +index 5e20daa6..4988d3a5 100644 --- a/src/wl_init.c +++ b/src/wl_init.c -@@ -1336,7 +1336,7 @@ int _glfwInitWayland(void) +@@ -1148,7 +1148,7 @@ int _glfwPlatformInit(void) _glfw.wl.timerfd = -1; if (_glfw.wl.seatVersion >= 4) @@ -22,7 +22,7 @@ index acfe477d4..bba908fa9 100644 if (!_glfw.wl.wmBase) { -@@ -1370,7 +1370,7 @@ int _glfwInitWayland(void) +@@ -1182,7 +1182,7 @@ int _glfwPlatformInit(void) wl_cursor_theme_load(cursorTheme, 2 * cursorSize, _glfw.wl.shm); _glfw.wl.cursorSurface = wl_compositor_create_surface(_glfw.wl.compositor); diff --git a/0003-Continue-poll-if-timerfd-cant-be-read.patch b/0002-Wayland-Continue-poll-if-timerfd-can-t-be-read.patch index 5eb7513fa298..0e304b26a9c4 100644 --- a/0003-Continue-poll-if-timerfd-cant-be-read.patch +++ b/0002-Wayland-Continue-poll-if-timerfd-can-t-be-read.patch @@ -1,8 +1,8 @@ -From 68879081cb39f50bd65d12e0f1869f5970dc71b9 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> Date: Tue, 14 Dec 2021 09:29:01 +0100 -Subject: [PATCH] =?UTF-8?q?Wayland:=20Continue=20poll()=20if=20timerfd=20c?= - =?UTF-8?q?an=E2=80=99t=20be=20read?= +Subject: =?UTF-8?q?Wayland:=20Continue=20poll()=20if=20timerfd=20can?= + =?UTF-8?q?=E2=80=99t=20be=20read?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -13,13 +13,13 @@ cursor timerfd wasn’t read at all even when it could. Related to #1711 --- src/wl_window.c | 11 +++-------- - 2 files changed, 4 insertions(+), 8 deletions(-) + 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c -index b4c59d693..8ed803b4b 100644 +index 939f9c19..656743a9 100644 --- a/src/wl_window.c +++ b/src/wl_window.c -@@ -751,10 +751,7 @@ static void handleEvents(int timeout) +@@ -746,10 +746,7 @@ static void handleEvents(int timeout) if (fds[1].revents & POLLIN) { read_ret = read(_glfw.wl.timerfd, &repeats, sizeof(repeats)); @@ -29,9 +29,9 @@ index b4c59d693..8ed803b4b 100644 - if (_glfw.wl.keyboardFocus) + if (read_ret == 8 && _glfw.wl.keyboardFocus) { - for (uint64_t i = 0; i < repeats; ++i) + for (i = 0; i < repeats; ++i) { -@@ -770,10 +767,8 @@ static void handleEvents(int timeout) +@@ -765,10 +762,8 @@ static void handleEvents(int timeout) if (fds[2].revents & POLLIN) { read_ret = read(_glfw.wl.cursorTimerfd, &repeats, sizeof(repeats)); diff --git a/0003-Don-t-crash-on-calls-to-focus-or-icon.patch b/0003-Don-t-crash-on-calls-to-focus-or-icon.patch new file mode 100644 index 000000000000..768c986a18a2 --- /dev/null +++ b/0003-Don-t-crash-on-calls-to-focus-or-icon.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ecmel=20Berk=20Canl=C4=B1er?= <me@ecmelberk.com> +Date: Tue, 28 Dec 2021 19:41:19 +0300 +Subject: Don't crash on calls to focus or icon + +--- + src/wl_window.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/src/wl_window.c b/src/wl_window.c +index 656743a9..c36b11cd 100644 +--- a/src/wl_window.c ++++ b/src/wl_window.c +@@ -885,8 +885,7 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) + void _glfwPlatformSetWindowIcon(_GLFWwindow* window, + int count, const GLFWimage* images) + { +- _glfwInputError(GLFW_FEATURE_UNAVAILABLE, +- "Wayland: The platform does not support setting the window icon"); ++ fprintf(stderr, "!!! Ignoring Error: Wayland: The platform does not support setting the window icon\n"); + } + + void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) +@@ -1042,8 +1041,7 @@ void _glfwPlatformRequestWindowAttention(_GLFWwindow* window) + + void _glfwPlatformFocusWindow(_GLFWwindow* window) + { +- _glfwInputError(GLFW_FEATURE_UNAVAILABLE, +- "Wayland: The platform does not support setting the input focus"); ++ fprintf(stderr, "!!! Ignoring Error: Wayland: The platform does not support setting the input focus\n"); + } + + void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, diff --git a/0003-wayland-don-t-crash-app-on-api-calls-to-window-focus.patch b/0003-wayland-don-t-crash-app-on-api-calls-to-window-focus.patch deleted file mode 100644 index 15e312aa6007..000000000000 --- a/0003-wayland-don-t-crash-app-on-api-calls-to-window-focus.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 8400d399b74f55bf128488f7ea73609babbf4eaf Mon Sep 17 00:00:00 2001 -From: ninja- <ninja-@users.noreply.github.com> -Date: Tue, 30 Jun 2020 19:41:48 +0200 -Subject: [PATCH 3/4] wayland: don't crash app on api calls to window focus or - window icon - just ignore them - ---- - src/wl_window.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/src/wl_window.c b/src/wl_window.c -index 47cc1437..f3bda65b 100644 ---- a/src/wl_window.c -+++ b/src/wl_window.c -@@ -1021,8 +1021,8 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) - void _glfwPlatformSetWindowIcon(_GLFWwindow* window, - int count, const GLFWimage* images) - { -- _glfwInputError(GLFW_FEATURE_UNAVAILABLE, -- "Wayland: The platform does not support setting the window icon"); -+ // _glfwInputError(GLFW_FEATURE_UNAVAILABLE, -+ // "Wayland: The platform does not support setting the window icon"); - } - - void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) -@@ -1201,8 +1201,8 @@ void _glfwPlatformRequestWindowAttention(_GLFWwindow* window) - - void _glfwPlatformFocusWindow(_GLFWwindow* window) - { -- _glfwInputError(GLFW_FEATURE_UNAVAILABLE, -- "Wayland: The platform does not support setting the input focus"); -+ // _glfwInputError(GLFW_FEATURE_UNAVAILABLE, -+ // "Wayland: The platform does not support setting the input focus"); - } - - void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, --- -2.32.0 - diff --git a/0004-fix-broken-opengl-screenshots-on-mutter.patch b/0004-wayland-fix-broken-opengl-screenshots-on-mutter.patch index c850f99cb381..9acaaec73d7f 100644 --- a/0004-fix-broken-opengl-screenshots-on-mutter.patch +++ b/0004-wayland-fix-broken-opengl-screenshots-on-mutter.patch @@ -1,10 +1,8 @@ -From 4d47891ca1f3979c20f0acc3539a80d8fa97a2ad Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: ninja- <ninja-@users.noreply.github.com> Date: Tue, 30 Jun 2020 19:41:52 +0200 -Subject: [PATCH 4/4] fix broken opengl screenshots on mutter +Subject: wayland: fix broken opengl screenshots on mutter -(admicos) This breaks more than just screenshots. On sway, the window is -rendered half transparent. And we do not want that. --- src/egl_context.c | 8 ++++++++ 1 file changed, 8 insertions(+) @@ -28,6 +26,3 @@ index 975c67be..b5cbeaff 100644 u->handle = (uintptr_t) n; usableCount++; } --- -2.32.0 - diff --git a/0005-Add-warning-about-being-an-unofficial-patch.patch b/0005-Add-warning-about-being-an-unofficial-patch.patch new file mode 100644 index 000000000000..bd0b24ea4a0d --- /dev/null +++ b/0005-Add-warning-about-being-an-unofficial-patch.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ecmel=20Berk=20Canl=C4=B1er?= <me@ecmelberk.com> +Date: Tue, 28 Dec 2021 19:25:30 +0300 +Subject: Add warning about being an unofficial patch + +This is just to help mod developers and other people who don't need to +care about this patchset to ignore any issues that are not their fault. +--- + src/init.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/init.c b/src/init.c +index 25a6b4f3..c0ba6d31 100644 +--- a/src/init.c ++++ b/src/init.c +@@ -261,6 +261,12 @@ GLFWAPI int glfwInit(void) + _glfw.timer.offset = _glfwPlatformGetTimerValue(); + + glfwDefaultWindowHints(); ++ ++ fprintf(stderr, "!!! Patched GLFW from https://github.com/Admicos/minecraft-wayland\n" ++ "!!! If any issues with the window, or some issues with rendering, occur, " ++ "first try with the built-in GLFW, and if that solves the issue, report there first.\n" ++ "!!! Use outside Minecraft is untested, and things might break.\n"); ++ + return GLFW_TRUE; + } + diff --git a/0005-don-t-crash-on-get-scancode-name.patch b/0005-don-t-crash-on-get-scancode-name.patch deleted file mode 100644 index 9a4c7200902d..000000000000 --- a/0005-don-t-crash-on-get-scancode-name.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/src/wl_window.c -+++ b/src/wl_window.c -@@ -1378,8 +1378,6 @@ - const char* _glfwPlatformGetScancodeName(int scancode) - { - // TODO -- _glfwInputError(GLFW_FEATURE_UNIMPLEMENTED, -- "Wayland: Key names not yet implemented"); - return NULL; - } diff --git a/0006-Don-t-crash-getting-scancode-name.patch b/0006-Don-t-crash-getting-scancode-name.patch new file mode 100644 index 000000000000..8d7d05f98d38 --- /dev/null +++ b/0006-Don-t-crash-getting-scancode-name.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ecmel=20Berk=20Canl=C4=B1er?= <me@ecmelberk.com> +Date: Tue, 28 Dec 2021 20:30:44 +0300 +Subject: Don't crash getting scancode name + +--- + src/wl_window.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/wl_window.c b/src/wl_window.c +index c36b11cd..bf188e27 100644 +--- a/src/wl_window.c ++++ b/src/wl_window.c +@@ -1205,8 +1205,7 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) + const char* _glfwPlatformGetScancodeName(int scancode) + { + // TODO +- _glfwInputError(GLFW_FEATURE_UNIMPLEMENTED, +- "Wayland: Key names not yet implemented"); ++ fprintf(stderr, "!!! Ignoring Error: Wayland: Key names not yet implemented\n"); + return NULL; + } + diff --git a/0001-libdecoration-support.patch b/0007-libdecor-proper-decorations-with-title-and-window-bu.patch index 3a33e93990b6..13f75721fe56 100644 --- a/0001-libdecoration-support.patch +++ b/0007-libdecor-proper-decorations-with-title-and-window-bu.patch @@ -1,123 +1,68 @@ -From 96ad19143d8d20553bfb86d440faaaf91eaff955 Mon Sep 17 00:00:00 2001 -From: Christian Rauch <Rauch.Christian@gmx.de> -Date: Sun, 12 Apr 2020 14:21:03 +0100 -Subject: [PATCH 1/8] wl: fix resize glitches +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ecmel=20Berk=20Canl=C4=B1er?= <me@ecmelberk.com> +Date: Tue, 28 Dec 2021 20:32:52 +0300 +Subject: libdecor: proper decorations with title and window buttons ---- - src/wl_window.c | 1 - - 1 file changed, 1 deletion(-) +Squashed https://github.com/glfw/glfw/pull/1693 -diff --git a/src/wl_window.c b/src/wl_window.c -index 939f9c196..3899c858c 100644 ---- a/src/wl_window.c -+++ b/src/wl_window.c -@@ -292,7 +292,6 @@ static void setOpaqueRegion(_GLFWwindow* window) - - wl_region_add(region, 0, 0, window->wl.width, window->wl.height); - wl_surface_set_opaque_region(window->wl.surface, region); -- wl_surface_commit(window->wl.surface); - wl_region_destroy(region); - } - +commit 2fad37473f20406159dde6e43c3c24fa241686d7 +Author: Christian Rauch <Rauch.Christian@gmx.de> +Date: Mon Feb 10 00:59:44 2020 +0000 -From 69f6e358e266581ec21d3e602c626d54abb06b39 Mon Sep 17 00:00:00 2001 -From: Christian Rauch <Rauch.Christian@gmx.de> -Date: Sat, 9 May 2020 21:06:23 +0100 -Subject: [PATCH 2/8] wl: initialise fullscreen + wl: add decorations ---- - src/wl_window.c | 3 +++ - 1 file changed, 3 insertions(+) +commit 7ec585b8eb5169896876f11a68c12311237fd9e1 +Author: Christian Rauch <Rauch.Christian@gmx.de> +Date: Sun Feb 9 14:56:27 2020 +0000 -diff --git a/src/wl_window.c b/src/wl_window.c -index 3899c858c..46cd742c6 100644 ---- a/src/wl_window.c -+++ b/src/wl_window.c -@@ -826,6 +826,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, - window->wl.visible = GLFW_FALSE; - } - -+ if (window->monitor) -+ setFullscreen(window, window->monitor, window->videoMode.refreshRate); -+ - window->wl.currentCursor = NULL; - - window->wl.monitors = calloc(1, sizeof(_GLFWmonitor*)); + wl: deactivate 'viewporter' decorations -From ce0e2096b556c6753b8c21ec841b09321f9ee54e Mon Sep 17 00:00:00 2001 -From: Christian Rauch <Rauch.Christian@gmx.de> -Date: Mon, 3 May 2021 23:46:21 +0100 -Subject: [PATCH 3/8] make windows opaque by default +commit b2ecb88f3f2cf7bccbf56afacfe2de130873a610 +Author: Christian Rauch <Rauch.Christian@gmx.de> +Date: Sun Feb 9 14:01:58 2020 +0000 ---- - src/window.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + cmake: add 'libdecor' dependency -diff --git a/src/window.c b/src/window.c -index 518b27fd5..688971f36 100644 ---- a/src/window.c -+++ b/src/window.c -@@ -279,7 +279,7 @@ void glfwDefaultWindowHints(void) - _glfw.hints.framebuffer.redBits = 8; - _glfw.hints.framebuffer.greenBits = 8; - _glfw.hints.framebuffer.blueBits = 8; -- _glfw.hints.framebuffer.alphaBits = 8; -+ _glfw.hints.framebuffer.alphaBits = 0; - _glfw.hints.framebuffer.depthBits = 24; - _glfw.hints.framebuffer.stencilBits = 8; - _glfw.hints.framebuffer.doublebuffer = GLFW_TRUE; +commit 8b539bd285d2b7abc3511286f34bffbdc78c9837 +Author: Christian Rauch <Rauch.Christian@gmx.de> +Date: Fri Jul 16 23:40:45 2021 +0100 -From 5df88303d22f5fd0861b6b8023e795c84ef31ae9 Mon Sep 17 00:00:00 2001 -From: Christian Rauch <Rauch.Christian@gmx.de> -Date: Fri, 19 Jun 2020 00:05:12 +0100 -Subject: [PATCH 4/8] cmake: enable AddressSanitizer in Debug builds + CI: install libdecor from upstream ---- - CMakeLists.txt | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) +commit 5df88303d22f5fd0861b6b8023e795c84ef31ae9 +Author: Christian Rauch <Rauch.Christian@gmx.de> +Date: Fri Jun 19 00:05:12 2020 +0100 -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 59ab473c9..fb9fab99a 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -66,6 +66,25 @@ if (GLFW_BUILD_DOCS) - find_package(Doxygen) - endif() - -+if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") -+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} \ -+ -fsanitize=address \ -+ -fsanitize=bool \ -+ -fsanitize=bounds \ -+ -fsanitize=enum \ -+ -fsanitize=float-cast-overflow \ -+ -fsanitize=float-divide-by-zero \ -+ -fsanitize=nonnull-attribute \ -+ -fsanitize=returns-nonnull-attribute \ -+ -fsanitize=signed-integer-overflow \ -+ -fsanitize=undefined \ -+ -fsanitize=vla-bound \ -+ -fno-sanitize=alignment \ -+ -fsanitize=leak \ -+ -fsanitize=object-size \ -+ ") -+endif() -+ - #-------------------------------------------------------------------- - # Set compiler specific flags - #-------------------------------------------------------------------- + cmake: enable AddressSanitizer in Debug builds + +commit ce0e2096b556c6753b8c21ec841b09321f9ee54e +Author: Christian Rauch <Rauch.Christian@gmx.de> +Date: Mon May 3 23:46:21 2021 +0100 + + make windows opaque by default -From 8b539bd285d2b7abc3511286f34bffbdc78c9837 Mon Sep 17 00:00:00 2001 -From: Christian Rauch <Rauch.Christian@gmx.de> -Date: Fri, 16 Jul 2021 23:40:45 +0100 -Subject: [PATCH 5/8] CI: install libdecor from upstream +commit 69f6e358e266581ec21d3e602c626d54abb06b39 +Author: Christian Rauch <Rauch.Christian@gmx.de> +Date: Sat May 9 21:06:23 2020 +0100 + wl: initialise fullscreen + +commit 96ad19143d8d20553bfb86d440faaaf91eaff955 +Author: Christian Rauch <Rauch.Christian@gmx.de> +Date: Sun Apr 12 14:21:03 2020 +0100 + + wl: fix resize glitches --- - .github/workflows/build.yml | 6 ++++++ - 1 file changed, 6 insertions(+) + .github/workflows/build.yml | 6 + + CMakeLists.txt | 29 ++++ + src/window.c | 2 +- + src/wl_init.c | 67 ++++++++- + src/wl_platform.h | 23 ++- + src/wl_window.c | 270 +++++++++++++++++++++++++++++------- + 6 files changed, 339 insertions(+), 58 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml -index d87ae8d1d..efe120a3c 100644 +index d87ae8d1..efe120a3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,6 +43,12 @@ jobs: @@ -133,18 +78,8 @@ index d87ae8d1d..efe120a3c 100644 - name: Configure static library run: cmake -S . -B build-static -D GLFW_USE_WAYLAND=ON - -From b2ecb88f3f2cf7bccbf56afacfe2de130873a610 Mon Sep 17 00:00:00 2001 -From: Christian Rauch <Rauch.Christian@gmx.de> -Date: Sun, 9 Feb 2020 14:01:58 +0000 -Subject: [PATCH 6/8] cmake: add 'libdecor' dependency - ---- - CMakeLists.txt | 10 ++++++++++ - 1 file changed, 10 insertions(+) - diff --git a/CMakeLists.txt b/CMakeLists.txt -index fb9fab99a..2ff626ac7 100644 +index 77cdc945..3377bde0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,8 @@ cmake_dependent_option(GLFW_USE_WAYLAND "Use Wayland for window creation" OFF @@ -156,7 +91,33 @@ index fb9fab99a..2ff626ac7 100644 if (BUILD_SHARED_LIBS AND UNIX) # On Unix-like systems, shared libraries can use the soname system. -@@ -225,6 +227,14 @@ if (_GLFW_WAYLAND) +@@ -66,6 +68,25 @@ if (GLFW_BUILD_DOCS) + find_package(Doxygen) + endif() + ++if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") ++ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} \ ++ -fsanitize=address \ ++ -fsanitize=bool \ ++ -fsanitize=bounds \ ++ -fsanitize=enum \ ++ -fsanitize=float-cast-overflow \ ++ -fsanitize=float-divide-by-zero \ ++ -fsanitize=nonnull-attribute \ ++ -fsanitize=returns-nonnull-attribute \ ++ -fsanitize=signed-integer-overflow \ ++ -fsanitize=undefined \ ++ -fsanitize=vla-bound \ ++ -fno-sanitize=alignment \ ++ -fsanitize=leak \ ++ -fsanitize=object-size \ ++ ") ++endif() ++ + #-------------------------------------------------------------------- + # Apply Microsoft C runtime library option + # This is here because it also applies to tests and examples +@@ -207,6 +228,14 @@ if (_GLFW_WAYLAND) list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}") list(APPEND glfw_LIBRARIES "${Wayland_LINK_LIBRARIES}") @@ -171,364 +132,24 @@ index fb9fab99a..2ff626ac7 100644 include(CheckIncludeFiles) include(CheckFunctionExists) check_include_files(xkbcommon/xkbcommon-compose.h HAVE_XKBCOMMON_COMPOSE_H) - -From 7ec585b8eb5169896876f11a68c12311237fd9e1 Mon Sep 17 00:00:00 2001 -From: Christian Rauch <Rauch.Christian@gmx.de> -Date: Sun, 9 Feb 2020 14:56:27 +0000 -Subject: [PATCH 7/8] wl: deactivate 'viewporter' decorations - ---- - src/wl_init.c | 13 +++++++++++ - src/wl_platform.h | 10 +++++++++ - src/wl_window.c | 57 ++++++++++++++++++++++++++++++++++++++++++----- - 3 files changed, 74 insertions(+), 6 deletions(-) - -diff --git a/src/wl_init.c b/src/wl_init.c -index 1ba497b71..d49e44e77 100644 ---- a/src/wl_init.c -+++ b/src/wl_init.c -@@ -56,6 +56,7 @@ static _GLFWwindow* findWindowFromDecorationSurface(struct wl_surface* surface, - _GLFWwindow* window = _glfw.windowListHead; - if (!which) - which = &focus; -+#ifndef WITH_DECORATION - while (window) - { - if (surface == window->wl.decorations.top.surface) -@@ -80,6 +81,7 @@ static _GLFWwindow* findWindowFromDecorationSurface(struct wl_surface* surface, - } - window = window->next; - } -+#endif - return window; - } - -@@ -103,7 +105,10 @@ static void pointerHandleEnter(void* data, - return; - } - -+#ifndef WITH_DECORATION - window->wl.decorations.focus = focus; -+#endif -+ - _glfw.wl.serial = serial; - _glfw.wl.pointerFocus = window; - -@@ -194,6 +199,7 @@ static void pointerHandleMotion(void* data, - x = wl_fixed_to_double(sx); - y = wl_fixed_to_double(sy); - -+#ifndef WITH_DECORATION - switch (window->wl.decorations.focus) - { - case mainWindow: -@@ -231,6 +237,7 @@ static void pointerHandleMotion(void* data, - default: - assert(0); - } -+#endif - if (_glfw.wl.cursorPreviousName != cursorName) - setCursor(window, cursorName); - } -@@ -248,6 +255,7 @@ static void pointerHandleButton(void* data, - - if (!window) - return; -+#ifndef WITH_DECORATION - if (button == BTN_LEFT) - { - switch (window->wl.decorations.focus) -@@ -306,6 +314,7 @@ static void pointerHandleButton(void* data, - // Don’t pass the button to the user if it was related to a decoration. - if (window->wl.decorations.focus != mainWindow) - return; -+#endif - - _glfw.wl.serial = serial; - -@@ -840,11 +849,13 @@ static void registryHandleGlobal(void* data, - &zxdg_decoration_manager_v1_interface, - 1); - } -+#ifndef WITH_DECORATION - else if (strcmp(interface, "wp_viewporter") == 0) - { - _glfw.wl.viewporter = - wl_registry_bind(registry, name, &wp_viewporter_interface, 1); - } -+#endif - else if (strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) - { - _glfw.wl.relativePointerManager = -@@ -1249,8 +1260,10 @@ void _glfwPlatformTerminate(void) - wl_compositor_destroy(_glfw.wl.compositor); - if (_glfw.wl.shm) - wl_shm_destroy(_glfw.wl.shm); -+#ifndef WITH_DECORATION - if (_glfw.wl.viewporter) - wp_viewporter_destroy(_glfw.wl.viewporter); -+#endif - if (_glfw.wl.decorationManager) - zxdg_decoration_manager_v1_destroy(_glfw.wl.decorationManager); - if (_glfw.wl.wmBase) -diff --git a/src/wl_platform.h b/src/wl_platform.h -index 966155fdd..4591becbd 100644 ---- a/src/wl_platform.h -+++ b/src/wl_platform.h -@@ -56,7 +56,9 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR - - #include "wayland-xdg-shell-client-protocol.h" - #include "wayland-xdg-decoration-client-protocol.h" -+#ifndef WITH_DECORATION - #include "wayland-viewporter-client-protocol.h" -+#endif - #include "wayland-relative-pointer-unstable-v1-client-protocol.h" - #include "wayland-pointer-constraints-unstable-v1-client-protocol.h" - #include "wayland-idle-inhibit-unstable-v1-client-protocol.h" -@@ -146,6 +148,7 @@ typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_st - #define _GLFW_DECORATION_VERTICAL (_GLFW_DECORATION_TOP + _GLFW_DECORATION_WIDTH) - #define _GLFW_DECORATION_HORIZONTAL (2 * _GLFW_DECORATION_WIDTH) - -+#ifndef WITH_DECORATION - typedef enum _GLFWdecorationSideWayland - { - mainWindow, -@@ -163,6 +166,7 @@ typedef struct _GLFWdecorationWayland - struct wp_viewport* viewport; - - } _GLFWdecorationWayland; -+#endif - - // Wayland-specific per-window data - // -@@ -204,12 +208,16 @@ typedef struct _GLFWwindowWayland - - GLFWbool wasFullscreen; - -+#ifndef WITH_DECORATION - struct { - GLFWbool serverSide; - struct wl_buffer* buffer; - _GLFWdecorationWayland top, left, right, bottom; - int focus; - } decorations; -+#else -+ GLFWbool ssd; -+#endif - - } _GLFWwindowWayland; - -@@ -231,7 +239,9 @@ typedef struct _GLFWlibraryWayland - struct wl_data_source* dataSource; - struct xdg_wm_base* wmBase; - struct zxdg_decoration_manager_v1* decorationManager; -+#ifndef WITH_DECORATION - struct wp_viewporter* viewporter; -+#endif - struct zwp_relative_pointer_manager_v1* relativePointerManager; - struct zwp_pointer_constraints_v1* pointerConstraints; - struct zwp_idle_inhibit_manager_v1* idleInhibitManager; -diff --git a/src/wl_window.c b/src/wl_window.c -index 46cd742c6..9e10e8a3f 100644 ---- a/src/wl_window.c -+++ b/src/wl_window.c -@@ -40,6 +40,10 @@ - #include <sys/timerfd.h> - #include <poll.h> - -+#ifdef WITH_DECORATION -+#include <libdecoration.h> -+#endif -+ - - static int createTmpfileCloexec(char* tmpname) - { -@@ -182,6 +186,7 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image) - return buffer; - } - -+#ifndef WITH_DECORATION - static void createDecoration(_GLFWdecorationWayland* decoration, - struct wl_surface* parent, - struct wl_buffer* buffer, GLFWbool opaque, -@@ -211,7 +216,14 @@ static void createDecoration(_GLFWdecorationWayland* decoration, - else - wl_surface_commit(decoration->surface); - } -+#endif - -+#ifdef WITH_DECORATION -+static void createDecorations(_GLFWwindow* window) -+{ -+ // -+} -+#else - static void createDecorations(_GLFWwindow* window) - { - unsigned char data[] = { 224, 224, 224, 255 }; -@@ -243,7 +255,9 @@ static void createDecorations(_GLFWwindow* window) - -_GLFW_DECORATION_WIDTH, window->wl.height, - window->wl.width + _GLFW_DECORATION_HORIZONTAL, _GLFW_DECORATION_WIDTH); - } -+#endif - -+#ifndef WITH_DECORATION - static void destroyDecoration(_GLFWdecorationWayland* decoration) - { - if (decoration->subsurface) -@@ -256,7 +270,14 @@ static void destroyDecoration(_GLFWdecorationWayland* decoration) - decoration->subsurface = NULL; - decoration->viewport = NULL; - } -+#endif - -+#ifdef WITH_DECORATION -+static void destroyDecorations(_GLFWwindow* window) -+{ -+ // -+} -+#else - static void destroyDecorations(_GLFWwindow* window) - { - destroyDecoration(&window->wl.decorations.top); -@@ -264,6 +285,7 @@ static void destroyDecorations(_GLFWwindow* window) - destroyDecoration(&window->wl.decorations.right); - destroyDecoration(&window->wl.decorations.bottom); - } -+#endif - - static void xdgDecorationHandleConfigure(void* data, - struct zxdg_toplevel_decoration_v1* decoration, -@@ -271,9 +293,11 @@ static void xdgDecorationHandleConfigure(void* data, - { - _GLFWwindow* window = data; - -- window->wl.decorations.serverSide = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); -- -- if (!window->wl.decorations.serverSide) -+#ifdef WITH_DECORATION -+ if (!(window->wl.ssd = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE))) -+#else -+ if (!(window->wl.decorations.serverSide = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE))) -+#endif - createDecorations(window); - } - -@@ -307,6 +331,7 @@ static void resizeWindow(_GLFWwindow* window) - _glfwInputFramebufferSize(window, scaledWidth, scaledHeight); - _glfwInputWindowContentScale(window, scale, scale); - -+#ifndef WITH_DECORATION - if (!window->wl.decorations.top.surface) - return; - -@@ -333,6 +358,7 @@ static void resizeWindow(_GLFWwindow* window) - wp_viewport_set_destination(window->wl.decorations.bottom.viewport, - window->wl.width + _GLFW_DECORATION_HORIZONTAL, _GLFW_DECORATION_WIDTH); - wl_surface_commit(window->wl.decorations.bottom.surface); -+#endif - } - - static void checkScaleChange(_GLFWwindow* window) -@@ -465,7 +491,11 @@ static void setFullscreen(_GLFWwindow* window, _GLFWmonitor* monitor, - monitor->wl.output); - } - setIdleInhibitor(window, GLFW_TRUE); -+#ifdef WITH_DECORATION -+ if (!window->wl.ssd) -+#else - if (!window->wl.decorations.serverSide) -+#endif - destroyDecorations(window); - } - -@@ -573,7 +603,11 @@ static void setXdgDecorations(_GLFWwindow* window) - } - else - { -+#ifdef WITH_DECORATION -+ window->wl.ssd = GLFW_FALSE; -+#else - window->wl.decorations.serverSide = GLFW_FALSE; -+#endif - createDecorations(window); - } - } -@@ -689,8 +723,12 @@ static void incrementCursorImage(_GLFWwindow* window) - { - _GLFWcursor* cursor; - -- if (!window || window->wl.decorations.focus != mainWindow) -+ if (!window) return; -+ -+#ifndef WITH_DECORATION -+ if (window->wl.decorations.focus != mainWindow) - return; -+#endif - - cursor = window->wl.currentCursor; - if (cursor && cursor->wl.cursor) -@@ -860,9 +898,10 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window) - destroyDecorations(window); - if (window->wl.xdg.decoration) - zxdg_toplevel_decoration_v1_destroy(window->wl.xdg.decoration); -- -+#ifndef WITH_DECORATION - if (window->wl.decorations.buffer) - wl_buffer_destroy(window->wl.decorations.buffer); -+#endif - - if (window->wl.native) - wl_egl_window_destroy(window->wl.native); -@@ -967,6 +1006,7 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, - int* left, int* top, - int* right, int* bottom) - { -+#ifndef WITH_DECORATION - if (window->decorated && !window->monitor && !window->wl.decorations.serverSide) - { - if (top) -@@ -978,6 +1018,7 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, - if (bottom) - *bottom = _GLFW_DECORATION_WIDTH; - } -+#endif - } - - void _glfwPlatformGetWindowContentScale(_GLFWwindow* window, -@@ -1461,10 +1502,14 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) - - window->wl.currentCursor = cursor; - -+ if (window != _glfw.wl.pointerFocus) return; -+ -+#ifndef WITH_DECORATION - // If we're not in the correct window just save the cursor - // the next time the pointer enters the window the cursor will change -- if (window != _glfw.wl.pointerFocus || window->wl.decorations.focus != mainWindow) -+ if (window->wl.decorations.focus != mainWindow) - return; -+#endif - - // Unlock possible pointer lock if no longer disabled. - if (window->cursorMode != GLFW_CURSOR_DISABLED && isPointerLocked(window)) - -From 2fad37473f20406159dde6e43c3c24fa241686d7 Mon Sep 17 00:00:00 2001 -From: Christian Rauch <Rauch.Christian@gmx.de> -Date: Mon, 10 Feb 2020 00:59:44 +0000 -Subject: [PATCH 8/8] wl: add decorations - ---- - src/wl_init.c | 64 +++++++++-- - src/wl_platform.h | 19 +++- - src/wl_window.c | 271 +++++++++++++++++++++++++++++++++------------- - 3 files changed, 265 insertions(+), 89 deletions(-) - +diff --git a/src/window.c b/src/window.c +index 518b27fd..688971f3 100644 +--- a/src/window.c ++++ b/src/window.c +@@ -279,7 +279,7 @@ void glfwDefaultWindowHints(void) + _glfw.hints.framebuffer.redBits = 8; + _glfw.hints.framebuffer.greenBits = 8; + _glfw.hints.framebuffer.blueBits = 8; +- _glfw.hints.framebuffer.alphaBits = 8; ++ _glfw.hints.framebuffer.alphaBits = 0; + _glfw.hints.framebuffer.depthBits = 24; + _glfw.hints.framebuffer.stencilBits = 8; + _glfw.hints.framebuffer.doublebuffer = GLFW_TRUE; diff --git a/src/wl_init.c b/src/wl_init.c -index d49e44e77..b6cdb39dd 100644 +index 4988d3a5..f43a0f82 100644 --- a/src/wl_init.c +++ b/src/wl_init.c -@@ -44,11 +44,14 @@ +@@ -42,11 +42,14 @@ #include <wayland-client.h> @@ -543,19 +164,8 @@ index d49e44e77..b6cdb39dd 100644 static _GLFWwindow* findWindowFromDecorationSurface(struct wl_surface* surface, int* which) { -@@ -56,7 +59,6 @@ static _GLFWwindow* findWindowFromDecorationSurface(struct wl_surface* surface, - _GLFWwindow* window = _glfw.windowListHead; - if (!which) - which = &focus; --#ifndef WITH_DECORATION - while (window) - { - if (surface == window->wl.decorations.top.surface) -@@ -81,9 +83,22 @@ static _GLFWwindow* findWindowFromDecorationSurface(struct wl_surface* surface, - } - window = window->next; +@@ -80,6 +83,20 @@ static _GLFWwindow* findWindowFromDecorationSurface(struct wl_surface* surface, } --#endif return window; } +#endif @@ -575,33 +185,34 @@ index d49e44e77..b6cdb39dd 100644 static void pointerHandleEnter(void* data, struct wl_pointer* pointer, -@@ -96,8 +111,16 @@ static void pointerHandleEnter(void* data, +@@ -92,8 +109,16 @@ static void pointerHandleEnter(void* data, if (!surface) return; -- int focus = 0; + if (wl_proxy_get_tag((struct wl_proxy *) surface) != &proxy_tag) + return; + - _GLFWwindow* window = wl_surface_get_user_data(surface); ++ _GLFWwindow* window = wl_surface_get_user_data(surface); + +#ifdef WITH_DECORATION + if (surface != window->wl.surface) + return; +#else -+ int focus = 0; + int focus = 0; +- _GLFWwindow* window = wl_surface_get_user_data(surface); if (!window) { window = findWindowFromDecorationSurface(surface, &focus); -@@ -105,7 +128,6 @@ static void pointerHandleEnter(void* data, - return; +@@ -102,6 +127,8 @@ static void pointerHandleEnter(void* data, } --#ifndef WITH_DECORATION window->wl.decorations.focus = focus; - #endif ++#endif ++ + _glfw.wl.serial = serial; + _glfw.wl.pointerFocus = window; -@@ -196,10 +218,16 @@ static void pointerHandleMotion(void* data, +@@ -189,9 +216,16 @@ static void pointerHandleMotion(void* data, if (window->cursorMode == GLFW_CURSOR_DISABLED) return; @@ -609,7 +220,6 @@ index d49e44e77..b6cdb39dd 100644 x = wl_fixed_to_double(sx); y = wl_fixed_to_double(sy); --#ifndef WITH_DECORATION +#ifdef WITH_DECORATION + window->wl.cursorPosX = x; + window->wl.cursorPosY = y; @@ -619,20 +229,38 @@ index d49e44e77..b6cdb39dd 100644 switch (window->wl.decorations.focus) { case mainWindow: -@@ -251,11 +279,11 @@ static void pointerHandleButton(void* data, +@@ -229,6 +263,7 @@ static void pointerHandleMotion(void* data, + default: + assert(0); + } ++#endif + if (_glfw.wl.cursorPreviousName != cursorName) + setCursor(window, cursorName); + } +@@ -242,10 +277,11 @@ static void pointerHandleButton(void* data, { _GLFWwindow* window = _glfw.wl.pointerFocus; int glfwButton; -- uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE; - - if (!window) - return; - #ifndef WITH_DECORATION -+ uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE; ++ ++ if (!window) ++ return; ++#ifndef WITH_DECORATION + uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE; +- +- if (!window) +- return; if (button == BTN_LEFT) { switch (window->wl.decorations.focus) -@@ -477,13 +505,21 @@ static void keyboardHandleEnter(void* data, +@@ -304,6 +340,7 @@ static void pointerHandleButton(void* data, + // Don’t pass the button to the user if it was related to a decoration. + if (window->wl.decorations.focus != mainWindow) + return; ++#endif + + _glfw.wl.serial = serial; + +@@ -466,13 +503,21 @@ static void keyboardHandleEnter(void* data, if (!surface) return; @@ -654,7 +282,7 @@ index d49e44e77..b6cdb39dd 100644 _glfw.wl.serial = serial; _glfw.wl.keyboardFocus = window; -@@ -778,6 +814,7 @@ static const struct wl_data_device_listener dataDeviceListener = { +@@ -767,6 +812,7 @@ static const struct wl_data_device_listener dataDeviceListener = { dataDeviceHandleSelection, }; @@ -662,7 +290,7 @@ index d49e44e77..b6cdb39dd 100644 static void wmBaseHandlePing(void* data, struct xdg_wm_base* wmBase, uint32_t serial) -@@ -788,6 +825,7 @@ static void wmBaseHandlePing(void* data, +@@ -777,6 +823,7 @@ static void wmBaseHandlePing(void* data, static const struct xdg_wm_base_listener wmBaseListener = { wmBaseHandlePing }; @@ -670,7 +298,7 @@ index d49e44e77..b6cdb39dd 100644 static void registryHandleGlobal(void* data, struct wl_registry* registry, -@@ -836,6 +874,7 @@ static void registryHandleGlobal(void* data, +@@ -825,6 +872,7 @@ static void registryHandleGlobal(void* data, &wl_data_device_manager_interface, 1); } } @@ -678,17 +306,17 @@ index d49e44e77..b6cdb39dd 100644 else if (strcmp(interface, "xdg_wm_base") == 0) { _glfw.wl.wmBase = -@@ -849,7 +888,6 @@ static void registryHandleGlobal(void* data, - &zxdg_decoration_manager_v1_interface, - 1); +@@ -843,6 +891,7 @@ static void registryHandleGlobal(void* data, + _glfw.wl.viewporter = + wl_registry_bind(registry, name, &wp_viewporter_interface, 1); } --#ifndef WITH_DECORATION - else if (strcmp(interface, "wp_viewporter") == 0) ++#endif + else if (strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) { - _glfw.wl.viewporter = -@@ -1163,12 +1201,14 @@ int _glfwPlatformInit(void) + _glfw.wl.relativePointerManager = +@@ -1150,12 +1199,14 @@ int _glfwPlatformInit(void) if (_glfw.wl.seatVersion >= 4) - _glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); + _glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); +#ifndef WITH_DECORATION if (!_glfw.wl.wmBase) @@ -701,7 +329,7 @@ index d49e44e77..b6cdb39dd 100644 if (_glfw.wl.pointer && _glfw.wl.shm) { -@@ -1214,6 +1254,10 @@ int _glfwPlatformInit(void) +@@ -1201,6 +1252,10 @@ int _glfwPlatformInit(void) _glfw.wl.clipboardSize = 4096; } @@ -712,17 +340,15 @@ index d49e44e77..b6cdb39dd 100644 return GLFW_TRUE; } -@@ -1260,14 +1304,16 @@ void _glfwPlatformTerminate(void) +@@ -1247,12 +1302,16 @@ void _glfwPlatformTerminate(void) wl_compositor_destroy(_glfw.wl.compositor); if (_glfw.wl.shm) wl_shm_destroy(_glfw.wl.shm); --#ifndef WITH_DECORATION +#ifdef WITH_DECORATION + libdecor_unref(_glfw.wl.csd_context); +#else if (_glfw.wl.viewporter) wp_viewporter_destroy(_glfw.wl.viewporter); --#endif if (_glfw.wl.decorationManager) zxdg_decoration_manager_v1_destroy(_glfw.wl.decorationManager); if (_glfw.wl.wmBase) @@ -732,32 +358,48 @@ index d49e44e77..b6cdb39dd 100644 wl_data_source_destroy(_glfw.wl.dataSource); if (_glfw.wl.dataDevice) diff --git a/src/wl_platform.h b/src/wl_platform.h -index 4591becbd..b6b3392e4 100644 +index 966155fd..b6b3392e 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h -@@ -54,14 +54,17 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR +@@ -54,13 +54,18 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR #endif #include "xkb_unicode.h" -+#include "wayland-relative-pointer-unstable-v1-client-protocol.h" -+#include "wayland-pointer-constraints-unstable-v1-client-protocol.h" -+#include "wayland-idle-inhibit-unstable-v1-client-protocol.h" -+ +-#include "wayland-xdg-shell-client-protocol.h" +-#include "wayland-xdg-decoration-client-protocol.h" +-#include "wayland-viewporter-client-protocol.h" + #include "wayland-relative-pointer-unstable-v1-client-protocol.h" + #include "wayland-pointer-constraints-unstable-v1-client-protocol.h" + #include "wayland-idle-inhibit-unstable-v1-client-protocol.h" + +#ifdef WITH_DECORATION +#include <libdecor.h> +#else - #include "wayland-xdg-shell-client-protocol.h" - #include "wayland-xdg-decoration-client-protocol.h" --#ifndef WITH_DECORATION - #include "wayland-viewporter-client-protocol.h" - #endif --#include "wayland-relative-pointer-unstable-v1-client-protocol.h" --#include "wayland-pointer-constraints-unstable-v1-client-protocol.h" --#include "wayland-idle-inhibit-unstable-v1-client-protocol.h" - ++#include "wayland-xdg-shell-client-protocol.h" ++#include "wayland-xdg-decoration-client-protocol.h" ++#include "wayland-viewporter-client-protocol.h" ++#endif ++ #define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL) #define _glfw_dlclose(handle) dlclose(handle) -@@ -181,11 +184,13 @@ typedef struct _GLFWwindowWayland + #define _glfw_dlsym(handle, name) dlsym(handle, name) +@@ -146,6 +151,7 @@ typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_st + #define _GLFW_DECORATION_VERTICAL (_GLFW_DECORATION_TOP + _GLFW_DECORATION_WIDTH) + #define _GLFW_DECORATION_HORIZONTAL (2 * _GLFW_DECORATION_WIDTH) + ++#ifndef WITH_DECORATION + typedef enum _GLFWdecorationSideWayland + { + mainWindow, +@@ -163,6 +169,7 @@ typedef struct _GLFWdecorationWayland + struct wp_viewport* viewport; + + } _GLFWdecorationWayland; ++#endif + + // Wayland-specific per-window data + // +@@ -177,11 +184,13 @@ typedef struct _GLFWwindowWayland struct wl_egl_window* native; struct wl_callback* callback; @@ -771,16 +413,24 @@ index 4591becbd..b6b3392e4 100644 _GLFWcursor* currentCursor; double cursorPosX, cursorPosY; -@@ -216,7 +221,7 @@ typedef struct _GLFWwindowWayland +@@ -204,12 +213,16 @@ typedef struct _GLFWwindowWayland + + GLFWbool wasFullscreen; + ++#ifndef WITH_DECORATION + struct { + GLFWbool serverSide; + struct wl_buffer* buffer; + _GLFWdecorationWayland top, left, right, bottom; int focus; } decorations; - #else -- GLFWbool ssd; ++#else + struct libdecor_frame *decoration_frame; - #endif ++#endif } _GLFWwindowWayland; -@@ -237,9 +242,11 @@ typedef struct _GLFWlibraryWayland + +@@ -229,9 +242,13 @@ typedef struct _GLFWlibraryWayland struct wl_data_device* dataDevice; struct wl_data_offer* dataOffer; struct wl_data_source* dataSource; @@ -789,33 +439,32 @@ index 4591becbd..b6b3392e4 100644 +#else struct xdg_wm_base* wmBase; struct zxdg_decoration_manager_v1* decorationManager; --#ifndef WITH_DECORATION struct wp_viewporter* viewporter; - #endif ++#endif struct zwp_relative_pointer_manager_v1* relativePointerManager; + struct zwp_pointer_constraints_v1* pointerConstraints; + struct zwp_idle_inhibit_manager_v1* idleInhibitManager; diff --git a/src/wl_window.c b/src/wl_window.c -index 9e10e8a3f..47cc14377 100644 +index bf188e27..ddf5ad37 100644 --- a/src/wl_window.c +++ b/src/wl_window.c -@@ -41,10 +41,12 @@ +@@ -40,6 +40,12 @@ + #include <sys/timerfd.h> #include <poll.h> - #ifdef WITH_DECORATION --#include <libdecoration.h> ++#ifdef WITH_DECORATION +#include <libdecor.h> - #endif - - -+extern const char *proxy_tag; ++#endif + ++ ++extern const char *proxy_tag; + static int createTmpfileCloexec(char* tmpname) { - int fd; -@@ -186,7 +188,61 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image) +@@ -182,6 +188,61 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image) return buffer; } --#ifndef WITH_DECORATION +#ifdef WITH_DECORATION +static void resizeWindow(_GLFWwindow* window); +void frame_configure(struct libdecor_frame *frame, struct libdecor_configuration *configuration, void *user_data) @@ -874,49 +523,11 @@ index 9e10e8a3f..47cc14377 100644 static void createDecoration(_GLFWdecorationWayland* decoration, struct wl_surface* parent, struct wl_buffer* buffer, GLFWbool opaque, -@@ -216,14 +272,7 @@ static void createDecoration(_GLFWdecorationWayland* decoration, - else - wl_surface_commit(decoration->surface); - } --#endif - --#ifdef WITH_DECORATION --static void createDecorations(_GLFWwindow* window) --{ -- // --} --#else - static void createDecorations(_GLFWwindow* window) - { - unsigned char data[] = { 224, 224, 224, 255 }; -@@ -255,9 +304,7 @@ static void createDecorations(_GLFWwindow* window) - -_GLFW_DECORATION_WIDTH, window->wl.height, - window->wl.width + _GLFW_DECORATION_HORIZONTAL, _GLFW_DECORATION_WIDTH); - } --#endif - --#ifndef WITH_DECORATION - static void destroyDecoration(_GLFWdecorationWayland* decoration) - { - if (decoration->subsurface) -@@ -270,14 +317,7 @@ static void destroyDecoration(_GLFWdecorationWayland* decoration) - decoration->subsurface = NULL; - decoration->viewport = NULL; - } --#endif - --#ifdef WITH_DECORATION --static void destroyDecorations(_GLFWwindow* window) --{ -- // --} --#else - static void destroyDecorations(_GLFWwindow* window) - { - destroyDecoration(&window->wl.decorations.top); -@@ -287,23 +327,21 @@ static void destroyDecorations(_GLFWwindow* window) +@@ -264,22 +325,23 @@ static void destroyDecorations(_GLFWwindow* window) + destroyDecoration(&window->wl.decorations.right); + destroyDecoration(&window->wl.decorations.bottom); } - #endif ++#endif +#ifndef WITH_DECORATION static void xdgDecorationHandleConfigure(void* data, @@ -925,11 +536,10 @@ index 9e10e8a3f..47cc14377 100644 { _GLFWwindow* window = data; --#ifdef WITH_DECORATION -- if (!(window->wl.ssd = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE))) --#else - if (!(window->wl.decorations.serverSide = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE))) --#endif +- window->wl.decorations.serverSide = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); +- +- if (!window->wl.decorations.serverSide) ++ if (!(window->wl.decorations.serverSide = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE))) createDecorations(window); } @@ -940,7 +550,31 @@ index 9e10e8a3f..47cc14377 100644 // Makes the surface considered as XRGB instead of ARGB. static void setOpaqueRegion(_GLFWwindow* window) -@@ -392,6 +430,9 @@ static void surfaceHandleEnter(void *data, +@@ -292,7 +354,6 @@ static void setOpaqueRegion(_GLFWwindow* window) + + wl_region_add(region, 0, 0, window->wl.width, window->wl.height); + wl_surface_set_opaque_region(window->wl.surface, region); +- wl_surface_commit(window->wl.surface); + wl_region_destroy(region); + } + +@@ -308,6 +369,7 @@ static void resizeWindow(_GLFWwindow* window) + _glfwInputFramebufferSize(window, scaledWidth, scaledHeight); + _glfwInputWindowContentScale(window, scale, scale); + ++#ifndef WITH_DECORATION + if (!window->wl.decorations.top.surface) + return; + +@@ -334,6 +396,7 @@ static void resizeWindow(_GLFWwindow* window) + wp_viewport_set_destination(window->wl.decorations.bottom.viewport, + window->wl.width + _GLFW_DECORATION_HORIZONTAL, _GLFW_DECORATION_WIDTH); + wl_surface_commit(window->wl.decorations.bottom.surface); ++#endif + } + + static void checkScaleChange(_GLFWwindow* window) +@@ -367,6 +430,9 @@ static void surfaceHandleEnter(void *data, struct wl_surface *surface, struct wl_output *output) { @@ -950,7 +584,7 @@ index 9e10e8a3f..47cc14377 100644 _GLFWwindow* window = data; _GLFWmonitor* monitor = wl_output_get_user_data(output); -@@ -412,6 +453,9 @@ static void surfaceHandleLeave(void *data, +@@ -387,6 +453,9 @@ static void surfaceHandleLeave(void *data, struct wl_surface *surface, struct wl_output *output) { @@ -960,7 +594,7 @@ index 9e10e8a3f..47cc14377 100644 _GLFWwindow* window = data; _GLFWmonitor* monitor = wl_output_get_user_data(output); GLFWbool found; -@@ -452,8 +496,7 @@ static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable) +@@ -427,8 +496,7 @@ static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable) } } @@ -970,7 +604,7 @@ index 9e10e8a3f..47cc14377 100644 { window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor); if (!window->wl.surface) -@@ -464,41 +507,60 @@ static GLFWbool createSurface(_GLFWwindow* window, +@@ -439,37 +507,60 @@ static GLFWbool createSurface(_GLFWwindow* window, window); wl_surface_set_user_data(window->wl.surface, window); @@ -1026,12 +660,8 @@ index 9e10e8a3f..47cc14377 100644 } +#endif setIdleInhibitor(window, GLFW_TRUE); --#ifdef WITH_DECORATION -- if (!window->wl.ssd) --#else +#ifndef WITH_DECORATION if (!window->wl.decorations.serverSide) --#endif destroyDecorations(window); +#endif } @@ -1041,19 +671,7 @@ index 9e10e8a3f..47cc14377 100644 static void xdgToplevelHandleConfigure(void* data, struct xdg_toplevel* toplevel, int32_t width, -@@ -603,11 +665,7 @@ static void setXdgDecorations(_GLFWwindow* window) - } - else - { --#ifdef WITH_DECORATION -- window->wl.ssd = GLFW_FALSE; --#else - window->wl.decorations.serverSide = GLFW_FALSE; --#endif - createDecorations(window); - } - } -@@ -672,6 +730,7 @@ static GLFWbool createXdgSurface(_GLFWwindow* window) +@@ -639,6 +730,7 @@ static GLFWbool createXdgSurface(_GLFWwindow* window) return GLFW_TRUE; } @@ -1061,7 +679,21 @@ index 9e10e8a3f..47cc14377 100644 static void setCursorImage(_GLFWwindow* window, _GLFWcursorWayland* cursorWayland) -@@ -825,7 +884,17 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, +@@ -690,8 +782,12 @@ static void incrementCursorImage(_GLFWwindow* window) + { + _GLFWcursor* cursor; + +- if (!window || window->wl.decorations.focus != mainWindow) ++ if (!window) return; ++ ++#ifndef WITH_DECORATION ++ if (window->wl.decorations.focus != mainWindow) + return; ++#endif + + cursor = window->wl.currentCursor; + if (cursor && cursor->wl.cursor) +@@ -783,7 +879,17 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, { window->wl.transparent = fbconfig->transparent; @@ -1080,7 +712,7 @@ index 9e10e8a3f..47cc14377 100644 return GLFW_FALSE; if (ctxconfig->client != GLFW_NO_API) -@@ -847,9 +916,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, +@@ -805,9 +911,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, } } @@ -1091,7 +723,7 @@ index 9e10e8a3f..47cc14377 100644 if (wndconfig->visible) { if (!createXdgSurface(window)) -@@ -863,6 +930,16 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, +@@ -821,6 +925,19 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, window->wl.xdg.toplevel = NULL; window->wl.visible = GLFW_FALSE; } @@ -1105,10 +737,13 @@ index 9e10e8a3f..47cc14377 100644 + _glfwPlatformSetWindowTitle(window, wndconfig->title); + + _glfwPlatformSetWindowResizable(window, wndconfig->resizable); ++ ++ if (window->monitor) ++ setFullscreen(window, window->monitor, window->videoMode.refreshRate); - if (window->monitor) - setFullscreen(window, window->monitor, window->videoMode.refreshRate); -@@ -873,6 +950,8 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, + window->wl.currentCursor = NULL; + +@@ -828,6 +945,8 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, window->wl.monitorsCount = 0; window->wl.monitorsSize = 1; @@ -1117,7 +752,7 @@ index 9e10e8a3f..47cc14377 100644 return GLFW_TRUE; } -@@ -896,9 +975,11 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window) +@@ -851,20 +970,25 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window) window->context.destroy(window); destroyDecorations(window); @@ -1126,11 +761,11 @@ index 9e10e8a3f..47cc14377 100644 +#else if (window->wl.xdg.decoration) zxdg_toplevel_decoration_v1_destroy(window->wl.xdg.decoration); --#ifndef WITH_DECORATION +- if (window->wl.decorations.buffer) wl_buffer_destroy(window->wl.decorations.buffer); - #endif -@@ -906,11 +987,13 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window) ++#endif + if (window->wl.native) wl_egl_window_destroy(window->wl.native); @@ -1144,7 +779,7 @@ index 9e10e8a3f..47cc14377 100644 if (window->wl.surface) wl_surface_destroy(window->wl.surface); -@@ -924,8 +1007,15 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) +@@ -878,8 +1002,15 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) if (window->wl.title) free(window->wl.title); window->wl.title = _glfw_strdup(title); @@ -1162,7 +797,7 @@ index 9e10e8a3f..47cc14377 100644 } void _glfwPlatformSetWindowIcon(_GLFWwindow* window, -@@ -971,16 +1061,23 @@ void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window, +@@ -924,16 +1055,23 @@ void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight) { @@ -1191,7 +826,23 @@ index 9e10e8a3f..47cc14377 100644 } void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, -@@ -1032,31 +1129,37 @@ void _glfwPlatformGetWindowContentScale(_GLFWwindow* window, +@@ -959,6 +1097,7 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, + int* left, int* top, + int* right, int* bottom) + { ++#ifndef WITH_DECORATION + if (window->decorated && !window->monitor && !window->wl.decorations.serverSide) + { + if (top) +@@ -970,6 +1109,7 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, + if (bottom) + *bottom = _GLFW_DECORATION_WIDTH; + } ++#endif + } + + void _glfwPlatformGetWindowContentScale(_GLFWwindow* window, +@@ -983,31 +1123,37 @@ void _glfwPlatformGetWindowContentScale(_GLFWwindow* window, void _glfwPlatformIconifyWindow(_GLFWwindow* window) { @@ -1244,14 +895,14 @@ index 9e10e8a3f..47cc14377 100644 window->wl.maximized = GLFW_TRUE; } -@@ -1064,13 +1167,18 @@ void _glfwPlatformShowWindow(_GLFWwindow* window) +@@ -1015,13 +1161,18 @@ void _glfwPlatformShowWindow(_GLFWwindow* window) { if (!window->wl.visible) { -- createXdgSurface(window); - window->wl.visible = GLFW_TRUE; ++ window->wl.visible = GLFW_TRUE; +#ifndef WITH_DECORATION -+ createXdgSurface(window); + createXdgSurface(window); +- window->wl.visible = GLFW_TRUE; +#else + // TODO: enable visibility support +#endif @@ -1264,7 +915,7 @@ index 9e10e8a3f..47cc14377 100644 if (window->wl.xdg.toplevel) { xdg_toplevel_destroy(window->wl.xdg.toplevel); -@@ -1078,6 +1186,9 @@ void _glfwPlatformHideWindow(_GLFWwindow* window) +@@ -1029,6 +1180,9 @@ void _glfwPlatformHideWindow(_GLFWwindow* window) window->wl.xdg.toplevel = NULL; window->wl.xdg.surface = NULL; } @@ -1274,7 +925,7 @@ index 9e10e8a3f..47cc14377 100644 window->wl.visible = GLFW_FALSE; } -@@ -1106,11 +1217,14 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, +@@ -1056,11 +1210,14 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, } else { @@ -1291,7 +942,7 @@ index 9e10e8a3f..47cc14377 100644 } _glfwInputWindowMonitor(window, monitor); } -@@ -1149,9 +1263,14 @@ int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) +@@ -1099,9 +1256,14 @@ int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) { @@ -1309,7 +960,7 @@ index 9e10e8a3f..47cc14377 100644 } void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) -@@ -1167,9 +1286,13 @@ void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) +@@ -1117,9 +1279,13 @@ void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled) { @@ -1326,3 +977,19 @@ index 9e10e8a3f..47cc14377 100644 } void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, GLFWbool enabled) +@@ -1451,10 +1617,14 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) + + window->wl.currentCursor = cursor; + ++ if (window != _glfw.wl.pointerFocus) return; ++ ++#ifndef WITH_DECORATION + // If we're not in the correct window just save the cursor + // the next time the pointer enters the window the cursor will change +- if (window != _glfw.wl.pointerFocus || window->wl.decorations.focus != mainWindow) ++ if (window->wl.decorations.focus != mainWindow) + return; ++#endif + + // Unlock possible pointer lock if no longer disabled. + if (window->cursorMode != GLFW_CURSOR_DISABLED && isPointerLocked(window)) diff --git a/0008-Add-libdecoration-marker-to-stderr-warning.patch b/0008-Add-libdecoration-marker-to-stderr-warning.patch new file mode 100644 index 000000000000..8893216c2768 --- /dev/null +++ b/0008-Add-libdecoration-marker-to-stderr-warning.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ecmel=20Berk=20Canl=C4=B1er?= <me@ecmelberk.com> +Date: Tue, 28 Dec 2021 22:01:03 +0300 +Subject: Add libdecoration marker to stderr warning + +--- + src/init.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/init.c b/src/init.c +index c0ba6d31..803915bb 100644 +--- a/src/init.c ++++ b/src/init.c +@@ -262,7 +262,7 @@ GLFWAPI int glfwInit(void) + + glfwDefaultWindowHints(); + +- fprintf(stderr, "!!! Patched GLFW from https://github.com/Admicos/minecraft-wayland\n" ++ fprintf(stderr, "!!! Patched GLFW from https://github.com/Admicos/minecraft-wayland (libdecoration)\n" + "!!! If any issues with the window, or some issues with rendering, occur, " + "first try with the built-in GLFW, and if that solves the issue, report there first.\n" + "!!! Use outside Minecraft is untested, and things might break.\n"); diff --git a/0009-Wayland-Fix-cursor-offset-when-shape-changes.patch b/0009-Wayland-Fix-cursor-offset-when-shape-changes.patch new file mode 100644 index 000000000000..40f6b025badf --- /dev/null +++ b/0009-Wayland-Fix-cursor-offset-when-shape-changes.patch @@ -0,0 +1,89 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Waris Boonyasiriwat <wboonyasiriwat@teradici.com> +Date: Wed, 12 May 2021 00:30:14 -0700 +Subject: Wayland: Fix cursor offset when shape changes + +The Wayland protocol spec[1] states that set_cursor must be called +with the serial number of the enter event. However, GLFW is passing in +the serial number of the latest received event, which does not meet the +protocol spec. + +[1] https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_pointer + +As a result, set_cursor calls were simply ignored by the compositor. + +This fix complies with the protocol more closely by specifically caching +the enter event serial, and using it for all set_cursor calls. + +Fixes #1706 +Closes #1899 +--- + src/wl_init.c | 3 ++- + src/wl_platform.h | 1 + + src/wl_window.c | 6 +++--- + 3 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/src/wl_init.c b/src/wl_init.c +index f43a0f82..cc355136 100644 +--- a/src/wl_init.c ++++ b/src/wl_init.c +@@ -130,6 +130,7 @@ static void pointerHandleEnter(void* data, + #endif + + _glfw.wl.serial = serial; ++ _glfw.wl.pointerEnterSerial = serial; + _glfw.wl.pointerFocus = window; + + window->wl.hovered = GLFW_TRUE; +@@ -189,7 +190,7 @@ static void setCursor(_GLFWwindow* window, const char* name) + buffer = wl_cursor_image_get_buffer(image); + if (!buffer) + return; +- wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, ++ wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, + surface, + image->hotspot_x / scale, + image->hotspot_y / scale); +diff --git a/src/wl_platform.h b/src/wl_platform.h +index b6b3392e..18dbd60a 100644 +--- a/src/wl_platform.h ++++ b/src/wl_platform.h +@@ -262,6 +262,7 @@ typedef struct _GLFWlibraryWayland + const char* cursorPreviousName; + int cursorTimerfd; + uint32_t serial; ++ uint32_t pointerEnterSerial; + + int32_t keyboardRepeatRate; + int32_t keyboardRepeatDelay; +diff --git a/src/wl_window.c b/src/wl_window.c +index ddf5ad37..23762e08 100644 +--- a/src/wl_window.c ++++ b/src/wl_window.c +@@ -767,7 +767,7 @@ static void setCursorImage(_GLFWwindow* window, + cursorWayland->yhot = image->hotspot_y; + } + +- wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, ++ wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, + surface, + cursorWayland->xhot / scale, + cursorWayland->yhot / scale); +@@ -1598,7 +1598,7 @@ static void lockPointer(_GLFWwindow* window) + window->wl.pointerLock.relativePointer = relativePointer; + window->wl.pointerLock.lockedPointer = lockedPointer; + +- wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, ++ wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, + NULL, 0, 0); + } + +@@ -1666,7 +1666,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) + } + else if (window->cursorMode == GLFW_CURSOR_HIDDEN) + { +- wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, NULL, 0, 0); ++ wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, NULL, 0, 0); + } + } + @@ -15,24 +15,32 @@ pkgrel=1 arch=('x86_64') url="https://github.com/EncryptedCicada/minecraft-wayland" license=('custom:ZLIB') -depends=('wayland' 'libxkbcommon' 'libgl' 'libdecor') +depends=('wayland' 'libxkbcommon' 'libgl') conflicts=('glfw' 'glfw-wayland') provides=("glfw=$pkgver") makedepends=('mesa' 'cmake' 'doxygen' 'vulkan-headers' 'vulkan-icd-loader' 'extra-cmake-modules' 'wayland-protocols' 'libxi' 'libxrandr' 'libxcursor' 'libxkbcommon' 'libxinerama') source=("https://github.com/glfw/glfw/archive/${_pkggit}.tar.gz" - "0001-libdecoration-support.patch" - "0002-set-O_NONBLOCK-on-repeat-timerfd.patch" - "0003-wayland-don-t-crash-app-on-api-calls-to-window-focus.patch" - "0004-fix-broken-opengl-screenshots-on-mutter.patch" - "0005-don-t-crash-on-get-scancode-name.patch") -sha256sums=('7b8c990cfb039110d38c7f5bb21948c402933be3f93f333fe7dcda3deaf72aa4' - 'c163b4a0a6496d758bc656203c23151015683754a6b5c2fc4944df7296d6b5af' - '5cd74a83dc7824c7696c1534f880b7a4a0992bb6dba6e4531ad1c040541f1d30' - 'a442f8c7e40fb09775f922b95402108b366114874ee96e370c29e5f8500a02b7' - '27aea70b07df2d46ac7469c129d28d695eff1ec9492489aa7b2558dd780ebdf0' - '16a2410511d75f00902ab1869942a80d85261f8390a97be946f82662891351e5') + "0001-Wayland-Set-O_NONBLOCK-on-repeat-timerfd.patch" + "0002-Wayland-Continue-poll-if-timerfd-can-t-be-read.patch" + "0003-Don-t-crash-on-calls-to-focus-or-icon.patch" + "0004-wayland-fix-broken-opengl-screenshots-on-mutter.patch" + "0005-Add-warning-about-being-an-unofficial-patch.patch" + "0006-Don-t-crash-getting-scancode-name.patch" + "0007-libdecor-proper-decorations-with-title-and-window-bu.patch" + "0008-Add-libdecoration-marker-to-stderr-warning.patch" + "0009-Wayland-Fix-cursor-offset-when-shape-changes.patch") +sha512sums=('4fb9c8900165bd6e9d64f30017f81471cc4aecf8ea5cc35dbf586ab2f6d2ffc4c765d9b84799fc64bcf8d08a8f693b3fd1967017c2178edf85fcb353c829e0ca' + 'fd7090ae10ef1f52c3f01d95716cbb55a73da4d211608f84ec38abf99aee240d8b75cf84ba4b11e2b0c462397248a060a14ef1955574bb1609051a2653f43f4a' + '009c1b6b07cdea4f6ada3d068837d9447e79ce2e9c0336b33a742df4fa6b0978914d3a0e45b745205c910bb30fd373e557c5060cd499aad99b13938630102b15' + '9c6f6e81de1feafeed93988207999d21754c93ff97c8c3158aee43f38b291f4589feaf83e42081445cf89c9209c86e56a0102fccf0d0a97740874dd88e84a746' + '3c6d317c0c129effd6da48e183228da952a28286acd09abaec4d934031e39a5531d44306e4308c75b33b515113eb54942ca18885edd49b14254af24085de52da' + 'd8e8b704e19652bb30c7799300a1bd0db1619ad17e8e36a3ee51673933eba6a8c47dbd615f4a9a385021bdfaa1ddedb2f24e8c05b670ef5278c71d217e91146e' + 'b35562f1a65ede074e2b1c9caf934062488d391912a41da1ebbc328d2e3500cea31882a9228b9dfad357e571265825aabcfebb3c74bce077ed6e9752c7f865f5' + 'c9893d17241b2a2aa8a02faa0e39f0b41e2b77d1aaee9c6162938265b8a1c52a104068b9837206c27d4d7f1910cf61bc4a32daaeb56ac2066bd39088b27fdc40' + '12266bb2f86466b933785f47b7638539b1190b513c956297517367e90b059699cab1bfd08f636db45a60a97abe42684eb83534a90ca1cfb25e608c26ba817c30' + '40daf899af7aa8dd344b48803b6ac44810e83cff05913ed9466ec25fd08f62a0473435bec87b23012609891e1e3129d70261453bfc1fc9e0dd52e799cf4ebc1e') prepare() { cd "$srcdir/glfw-$_pkggit" diff --git a/README.md b/README.md index 2f94d279d959..4bf37c828d65 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,8 @@ Because I **REALLY** had nothing better to do with my life. - Keys you replace through your compositor (example: `caps:swapescape`) will require you to use the original key - Originally made for Sway, GNOME needs to manually makepkg the `libdecoration` - branch for GNOME specific fixes (until a new GLFW version releases. See steps for Gnome on Arch below.) + branch for GNOME specific fixes or download an unofficial package listed below + (until a new GLFW version releases) - I haven't received any bug reports from KDE, so it'll (probably) work ## Step 1: Setting up MultiMC to use the system GLFW @@ -49,13 +50,21 @@ can try waiting for someone else to write a guide I guess. ### Option 1: Use the AUR -Install the `glfw-wayland-minecraft-libdecoration` package from the AUR. +Install the `glfw-wayland-minecraft` package from the AUR. + +If you're using GNOME, try using the **unofficial** +`glfw-wayland-minecraft-libdecoration` package, which packages the +`libdecoration` branch of this repository to the AUR. ### Option 2: Build the PKGBUILD manually `git clone` this repository to somewhere, and run `makepkg -si` inside. It will ask you to replace your existing GLFW package if already installed. +If you're using GNOME, consider running `git checkout libdecoration` before +running `makepkg -si`. This is a (probably) slightly unstable version that works +better on GNOME. + ### Option 3: Install the Fedora package Install the Fedora package from https://copr.fedorainfracloud.org/coprs/lyessaadi/minecraft-wayland-glfw/. |