From 932309f238594b65c5d64c924412aa82aac85e46 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Sat, 22 Jul 2023 09:43:53 -0600 Subject: [PATCH 1/4] Upgrade Checkout action Fixes some deprecation warnings --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a78fd977..d360e3c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: config: { name: Shared DRM, flags: -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_DRM=TRUE } steps: - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install Linux Dependencies if: runner.os == 'Linux' From 429bde6648cd6b8c9009d51fe234d7b85c9e9529 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Thu, 14 Jul 2022 21:56:34 -0600 Subject: [PATCH 2/4] Don't specify standard library on macOS libc++ is already the default and GCC can't even be used so there's no circumstance where we'd need to explicitly tell Clang to use libc++. I confirmed that even with this removed, libc++ headers are still being used and found. --- cmake/Macros.cmake | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index 77a7d11e..65f6977a 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -20,13 +20,8 @@ function(sfml_set_stdlib target) endif() endif() - if (SFML_OS_MACOSX) - if (${CMAKE_GENERATOR} MATCHES "Xcode") - sfml_set_xcode_property(${target} CLANG_CXX_LIBRARY "libc++") - else() - target_compile_options(${target} PRIVATE "-stdlib=libc++") - target_link_libraries(${target} PRIVATE "-stdlib=libc++") - endif() + if(${CMAKE_GENERATOR} MATCHES "Xcode") + sfml_set_xcode_property(${target} CLANG_CXX_LIBRARY "libc++") endif() endfunction() From 86285c53789ce5ae40d2b63362325ba4fd590eef Mon Sep 17 00:00:00 2001 From: Shane Whitmire Date: Sat, 15 Jul 2023 08:57:06 -0500 Subject: [PATCH 3/4] Fix macOS resize bug There is a commit up for the macOS resize bug where we get rid of a previous fix entiry and just resize, but kimci86 stated that he found better behavior with this solution. I'm going to put up this for code review and we can compare it to https://github.com/SFML/SFML/pull/2538 and see which we like best --- src/SFML/Window/OSX/SFWindowController.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/SFML/Window/OSX/SFWindowController.mm b/src/SFML/Window/OSX/SFWindowController.mm index 1da9634a..f6cb3e99 100644 --- a/src/SFML/Window/OSX/SFWindowController.mm +++ b/src/SFML/Window/OSX/SFWindowController.mm @@ -483,6 +483,11 @@ if (m_requester != 0) m_requester->windowResized(width, height - static_cast([self titlebarHeight])); } + else if (width != [self size].width || height != [self size].height + static_cast([self titlebarHeight])) + { + if (m_requester != 0) + m_requester->windowResized(width, height - static_cast([self titlebarHeight])); + } NSRect frame = NSMakeRect([m_window frame].origin.x, [m_window frame].origin.y, From 66a5f3c42c4e0487d1ce9d393c2331be97bb7811 Mon Sep 17 00:00:00 2001 From: kimci86 Date: Tue, 15 Aug 2023 18:38:08 +0200 Subject: [PATCH 4/4] Skip ClientMessage events with other window ID unless it is for IM --- src/SFML/Window/Unix/WindowImplX11.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/SFML/Window/Unix/WindowImplX11.cpp b/src/SFML/Window/Unix/WindowImplX11.cpp index 6c88c7d4..554a9dbd 100644 --- a/src/SFML/Window/Unix/WindowImplX11.cpp +++ b/src/SFML/Window/Unix/WindowImplX11.cpp @@ -85,13 +85,25 @@ namespace static const unsigned int maxTrialsCount = 5; - // Filter the events received by windows (only allow those matching a specific window) + // Filter the events received by windows (only allow those matching a specific window or those needed for the IM to work) Bool checkEvent(::Display*, XEvent* event, XPointer userData) { - // Just check if the event matches the window - // The input method sometimes sends ClientMessages with a different window ID, - // our event loop has to process them for the IM to work - return (event->xany.window == reinterpret_cast< ::Window >(userData)) || (event->type == ClientMessage); + if (event->xany.window == reinterpret_cast<::Window>(userData)) + { + // The event matches the current window so pick it up + return true; + } + if (event->type == ClientMessage) + { + // The input method sometimes sends ClientMessage with a different window ID. + // Our event loop has to process them for the IM to work. + // We assume ClientMessage events not having WM_PROTOCOLS message type are such events. + // ClientMessage events having WM_PROTOCOLS message type should be handled by their own window, + // so we ignore them here. They will eventually be picked up with the first condition. + static const Atom wmProtocols = sf::priv::getAtom("WM_PROTOCOLS"); + return event->xclient.message_type != wmProtocols; + } + return false; } // Find the name of the current executable