Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5c07007

Browse files
committedFeb 10, 2025
Add focus fix patch and update gamescope.spec to apply it
ValveSoftware/gamescope#1611 (comment)
1 parent 9102d66 commit 5c07007

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed
 

‎001-focus-fix.patch

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
diff --git a/src/Backends/WaylandBackend.cpp b/src/Backends/WaylandBackend.cpp
2+
index e924ac8..7aed647 100644
3+
--- a/src/Backends/WaylandBackend.cpp
4+
+++ b/src/Backends/WaylandBackend.cpp
5+
@@ -73,13 +73,13 @@ static inline uint32_t WaylandScaleToPhysical( uint32_t pValue, uint32_t pFactor
6+
}
7+
static inline uint32_t WaylandScaleToLogical( uint32_t pValue, uint32_t pFactor ) {
8+
return div_roundup( pValue * WL_FRACTIONAL_SCALE_DENOMINATOR, pFactor );
9+
}
10+
11+
static bool IsSurfacePlane( wl_surface *pSurface ) {
12+
- return wl_proxy_get_tag( (wl_proxy *)pSurface ) == &GAMESCOPE_plane_tag;
13+
+ return pSurface && (wl_proxy_get_tag( (wl_proxy *)pSurface ) == &GAMESCOPE_plane_tag);
14+
}
15+
16+
#define WAYLAND_NULL() []<typename... Args> ( void *pData, Args... args ) { }
17+
#define WAYLAND_USERDATA_TO_THIS(type, name) []<typename... Args> ( void *pData, Args... args ) { type *pThing = (type *)pData; pThing->name( std::forward<Args>(args)... ); }
18+
19+
// Libdecor puts its userdata ptr at the end... how fun! I shouldn't have spent so long writing this total atrocity to mankind.
20+
@@ -717,13 +717,13 @@ namespace gamescope
21+
zwp_pointer_constraints_v1 *m_pPointerConstraints = nullptr;
22+
zwp_relative_pointer_manager_v1 *m_pRelativePointerManager = nullptr;
23+
wp_fractional_scale_manager_v1 *m_pFractionalScaleManager = nullptr;
24+
xdg_toplevel_icon_manager_v1 *m_pToplevelIconManager = nullptr;
25+
26+
// TODO: Restructure and remove the need for this.
27+
- std::shared_ptr<CWaylandConnector> m_pFocusConnector;
28+
+ std::weak_ptr<CWaylandConnector> m_pFocusConnector;
29+
30+
wl_data_device_manager *m_pDataDeviceManager = nullptr;
31+
wl_data_device *m_pDataDevice = nullptr;
32+
std::shared_ptr<std::string> m_pClipboard = nullptr;
33+
34+
zwp_primary_selection_device_manager_v1 *m_pPrimarySelectionDeviceManager = nullptr;
35+
@@ -2038,13 +2038,13 @@ namespace gamescope
36+
37+
return std::span<const uint64_t>{ iter->second.begin(), iter->second.end() };
38+
}
39+
40+
IBackendConnector *CWaylandBackend::GetCurrentConnector()
41+
{
42+
- return m_pFocusConnector.get();
43+
+ return m_pFocusConnector.lock().get();
44+
}
45+
IBackendConnector *CWaylandBackend::GetConnector( GamescopeScreenType eScreenType )
46+
{
47+
if ( eScreenType == GAMESCOPE_SCREEN_TYPE_INTERNAL )
48+
return GetCurrentConnector();
49+
50+
@@ -2110,13 +2110,13 @@ namespace gamescope
51+
{
52+
return true;
53+
}
54+
std::shared_ptr<IBackendConnector> CWaylandBackend::CreateVirtualConnector( uint64_t ulVirtualConnectorKey )
55+
{
56+
std::shared_ptr<CWaylandConnector> pConnector = std::make_shared<CWaylandConnector>( this, ulVirtualConnectorKey );
57+
- if ( !m_pFocusConnector )
58+
+ if ( m_pFocusConnector.expired() )
59+
m_pFocusConnector = pConnector;
60+
61+
if ( !pConnector->Init() )
62+
{
63+
return nullptr;
64+
}

‎gamescope.spec

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ License: BSD
1414
URL: https://github.com/ValveSoftware/gamescope
1515
# Create stb.pc to satisfy dependency('stb')
1616
Source0: stb.pc
17+
Patch1: 001-focus-fix.patch
1718

1819
BuildRequires: meson >= 0.54.0
1920
BuildRequires: ninja-build
@@ -105,7 +106,7 @@ cd gamescope
105106
git checkout %{commit}
106107
git submodule update --init --recursive
107108

108-
#%autopatch -p1
109+
%autopatch -p1
109110

110111
# Apply additional manual changes after patches
111112
mkdir -p pkgconfig

0 commit comments

Comments
 (0)
Please sign in to comment.