commit 0e19cde33bba95fc4a0758e9a78f1ac21d99e3b4
Author: Neal Gompa <ngompa13(a)gmail.com>
Date: Sat Jun 26 13:04:52 2021 -0400
Backport fix for cursor positioning in Wayland screencasting
...ewire-Properly-account-for-cursor-hotspot.patch | 38 ++++++++++++++++++++++
obs-studio.spec | 8 ++++-
2 files changed, 45 insertions(+), 1 deletion(-)
---
diff --git a/0001-pipewire-Properly-account-for-cursor-hotspot.patch
b/0001-pipewire-Properly-account-for-cursor-hotspot.patch
new file mode 100644
index 0000000..600b247
--- /dev/null
+++ b/0001-pipewire-Properly-account-for-cursor-hotspot.patch
@@ -0,0 +1,38 @@
+From 6942bb814dcf9361dc9c3dac395842444159be54 Mon Sep 17 00:00:00 2001
+From: Georges Basile Stavracas Neto <georges.stavracas(a)gmail.com>
+Date: Tue, 22 Jun 2021 22:31:26 -0300
+Subject: [PATCH] pipewire: Properly account for cursor hotspot
+
+The cursor bitmap is centered on the hotspot, so not accounting
+for it means PipeWire captures were positioning the cursor sprite
+slightly off.
+
+Properly account for the hotspot by subtracting it from the cursor
+position.
+
+Related:
https://github.com/obsproject/obs-studio/issues/4766
+---
+ plugins/linux-capture/pipewire.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/plugins/linux-capture/pipewire.c b/plugins/linux-capture/pipewire.c
+index abd0d4923..114e66c33 100644
+--- a/plugins/linux-capture/pipewire.c
++++ b/plugins/linux-capture/pipewire.c
+@@ -1234,9 +1234,11 @@ void obs_pipewire_video_render(obs_pipewire_data *obs_pw,
gs_effect_t *effect)
+
+ if (obs_pw->cursor.visible && obs_pw->cursor.valid &&
+ obs_pw->cursor.texture) {
++ float cursor_x = obs_pw->cursor.x - obs_pw->cursor.hotspot_x;
++ float cursor_y = obs_pw->cursor.y - obs_pw->cursor.hotspot_y;
++
+ gs_matrix_push();
+- gs_matrix_translate3f((float)obs_pw->cursor.x,
+- (float)obs_pw->cursor.y, 0.0f);
++ gs_matrix_translate3f(cursor_x, cursor_y, 0.0f);
+
+ gs_effect_set_texture(image, obs_pw->cursor.texture);
+ gs_draw_sprite(obs_pw->texture, 0, obs_pw->cursor.width,
+--
+2.31.1
+
diff --git a/obs-studio.spec b/obs-studio.spec
index 8aca393..2194ae9 100644
--- a/obs-studio.spec
+++ b/obs-studio.spec
@@ -7,7 +7,7 @@
Name: obs-studio
Version: 27.0.1
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Open Broadcaster Software Studio
License: GPLv2+
@@ -15,6 +15,9 @@ URL:
https://obsproject.com/
Source0:
https://github.com/obsproject/obs-studio/archive/%{version}/%{name}-%{ver...
Source1:
https://github.com/obsproject/obs-vst/archive/%{commit1}/obs-vst-%{shortc...
+# Backports from upstream
+Patch0001: 0001-pipewire-Properly-account-for-cursor-hotspot.patch
+
BuildRequires: gcc
BuildRequires: cmake >= 3.0
BuildRequires: ninja-build
@@ -135,6 +138,9 @@ appstream-util validate-relax --nonet
%{buildroot}%{_datadir}/metainfo/*.appdata
%{_includedir}/obs/
%changelog
+* Sat Jun 26 2021 Neal Gompa <ngompa13(a)gmail.com> - 27.0.1-2
+- Backport fix for cursor positioning in Wayland screencasting
+
* Sat Jun 12 2021 Neal Gompa <ngompa13(a)gmail.com> - 27.0.1-1
- Update to 27.0.1