summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authortytan6522021-07-26 11:00:56 +0200
committertytan6522021-07-26 11:00:56 +0200
commita8ba9f836cdd68760b6e53a11e9686484f5983a2 (patch)
tree7c4a05c8f4940efb517d0742d984232bfa22981d
parentf64eb521f59d2707e5db9b0433624faaabce9b42 (diff)
downloadaur-a8ba9f836cdd68760b6e53a11e9686484f5983a2.tar.gz
feat: Fixed drag & drop added by default
The fix is merged upstream so I backport it
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD27
-rw-r--r--browser_unset_xdndproxy.patch170
3 files changed, 12 insertions, 189 deletions
diff --git a/.SRCINFO b/.SRCINFO
index eb1b59b90ff7..7cd58ba05892 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = obs-studio-tytan652
pkgdesc = Free and open source software for video recording and live streaming. With Browser dock and sources, VST 2 filter, FTL protocol, working VLC sources and my bind interface and GNOME entry PRs.
pkgver = 27.0.1
- pkgrel = 6
+ pkgrel = 7
url = https://github.com/obsproject/obs-studio
arch = i686
arch = x86_64
@@ -47,7 +47,6 @@ pkgbase = obs-studio-tytan652
source = bind_iface.patch
source = update_desktop_entries.patch
source = v4l2_by-path.patch
- source = browser_unset_xdndproxy.patch
source = obs-browser::git+https://github.com/obsproject/obs-browser.git
source = obs-vst::git+https://github.com/obsproject/obs-vst.git#commit=cca219fa3613dbc65de676ab7ba29e76865fa6f8
sha256sums = SKIP
@@ -55,7 +54,6 @@ pkgbase = obs-studio-tytan652
sha256sums = a43f2ad974104888ef36eef49b3e60dc26f7cfc0f48300726c861978ae5ae3ea
sha256sums = 9dedcb1996794754f5e36c0c69b36abc5a2c3e6514f4556dc5b867cec2ec9731
sha256sums = fb55dffcb177fd89c2cbffeb14aaf920dae2ae60dcfa934cff252315f268470e
- sha256sums = 032dfbd47f402ad97f60c2dda1c0496798638a340acd61bcdb6c3b5a18ad132b
sha256sums = SKIP
sha256sums = SKIP
diff --git a/PKGBUILD b/PKGBUILD
index 91c7d7d5ce3b..15c443da0c8a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,15 +1,11 @@
# Maintainer: tytan652 <tytan652 at tytanium dot xyz>
-# Scene and source drag & drop was disabled due to this issue
-# (https://github.com/obsproject/obs-studio/issues/4488)
-# (https://github.com/obsproject/obs-browser/pull/304)
-# You can test it by changing the following variable to 1
-# But a PR fixing this is out, give your feedback on the PR page
-TEST_DRAGDROPFIX=0
+# Scene and source drag & drop with his fix is now added by default
+# No variable change needed anymore \o/
pkgname=obs-studio-tytan652
pkgver=27.0.1
-pkgrel=6
+pkgrel=7
pkgdesc="Free and open source software for video recording and live streaming. With Browser dock and sources, VST 2 filter, FTL protocol, working VLC sources and my bind interface and GNOME entry PRs."
arch=("i686" "x86_64" "aarch64")
url="https://github.com/obsproject/obs-studio"
@@ -58,7 +54,6 @@ source=(
"bind_iface.patch" # Based on https://patch-diff.githubusercontent.com/raw/obsproject/obs-studio/pull/4219.patch
"update_desktop_entries.patch" # Based on https://patch-diff.githubusercontent.com/raw/obsproject/obs-studio/pull/4496.patch
"v4l2_by-path.patch" # https://patch-diff.githubusercontent.com/raw/obsproject/obs-studio/pull/3437.patch
- "browser_unset_xdndproxy.patch" # https://patch-diff.githubusercontent.com/raw/obsproject/obs-browser/pull/304.patch
"obs-browser::git+https://github.com/obsproject/obs-browser.git"
"obs-vst::git+https://github.com/obsproject/obs-vst.git#commit=cca219fa3613dbc65de676ab7ba29e76865fa6f8"
)
@@ -68,7 +63,6 @@ sha256sums=(
"a43f2ad974104888ef36eef49b3e60dc26f7cfc0f48300726c861978ae5ae3ea"
"9dedcb1996794754f5e36c0c69b36abc5a2c3e6514f4556dc5b867cec2ec9731"
"fb55dffcb177fd89c2cbffeb14aaf920dae2ae60dcfa934cff252315f268470e"
- "032dfbd47f402ad97f60c2dda1c0496798638a340acd61bcdb6c3b5a18ad132b"
"SKIP"
"SKIP"
)
@@ -79,14 +73,15 @@ prepare() {
git config submodule.plugins/obs-browser.url $srcdir/obs-browser
git submodule update
- if [ "$TEST_DRAGDROPFIX" = 1 ]; then
- git revert 457adcedd --no-edit --no-commit
+ ## Add fixed drag & drop
+ # Revert 'UI: Disable drag/drop on Linux scenes/sources (for now)' (https://github.com/obsproject/obs-studio/commit/457adcedd319ca2317d7cd5300694d486e88af90)
+ git revert --no-commit 457adcedd319ca2317d7cd5300694d486e88af90
- cd "$srcdir/obs-studio/plugins/obs-browser"
- ## Manually unset XdndProxy ("Stop deleting dragged items, browser panel, pretty please") (https://github.com/obsproject/obs-browser/pull/304)
- patch -Np1 < "$srcdir/browser_unset_xdndproxy.patch"
- cd "$srcdir/obs-studio"
- fi
+ cd "$srcdir/obs-studio/plugins/obs-browser"
+ # browser-panel: Manually unset XdndProxy (https://github.com/obsproject/obs-browser/commit/c5ba29f66b2eb8cf63d0fb6a90edd47b650f412a)
+ git cherry-pick --no-commit c5ba29f66b2eb8cf63d0fb6a90edd47b650f412a
+
+ cd "$srcdir/obs-studio"
## libobs/util: Fix loading Python binary modules on *nix (https://github.com/obsproject/obs-studio/pull/3335)
patch -Np1 < "$srcdir/python_fix.patch"
diff --git a/browser_unset_xdndproxy.patch b/browser_unset_xdndproxy.patch
deleted file mode 100644
index 347a815947d2..000000000000
--- a/browser_unset_xdndproxy.patch
+++ /dev/null
@@ -1,170 +0,0 @@
-From 2e23319740c85fc1a4ed93756e4afc6854eb4dfe Mon Sep 17 00:00:00 2001
-From: Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
-Date: Thu, 22 Jul 2021 22:13:20 -0300
-Subject: [PATCH] browser-panel: Manually unset XdndProxy
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The explanation for this issue, and the subsequent fix I hereby propose, is
-long, too long. For that, my apologies.
-
-When a browser panel is created on an X11 environment, it does so passing a
-CefWindowInfo set up through `windowInfo.SetAsChild(windowId, rect)`. CEF
-then creates an X11 Window that is child of this `windowId` to render into.
-In addition to that, when the CEF window is shown, it walks up the window
-tree, and sets the XdndProxy atom of the topmost window to its own render
-X11 window [1]. CEF does so to sneakily steal drag events from the toplevel.
-
-However, this behavior is problematic for OBS Studio.
-
-When OBS Studio has custom browser panels added and visible, and these panels
-are attached to the main window, the CEF widgetry is created and added to the
-main window. CEF then happily walks up the window tree, and sets the XdndProxy
-property of OBS Studio's main window.
-
-This behavior is innocuous when the browser panel is in a detached dock, since
-CEF will set the XdndProxy atom of the dock window instead of OBS Studio's main
-window. CEF is also not aware of the dock window being attached to the main
-window, and won't try and reset the XdndProxy atom when it happens.
-
-Having the XdndProxy atom set in the main window is the root of all evil we've
-seen so far. That's because when this atom is set, the `xdndProxy()` function
-in QXcbDrag [2] reads the proxy window from OBS Studio's main window, and
-returns it. This function normally returns 0.
-
-In particular, when `xdndProxy()` is called inside `QXcbDrag::move()` [3] and
-returns a non-zero value, the `if (!proxy_target)` condition right after it
-[4] isn't hit, making Qt use the CEF window as a drag proxy. The CEF window
-is then propagated to the `current_proxy_target` class member [5].
-
-Then, when releasing the dragged item, `QXcbDrag::drop()` is called, and tries
-to find its own internal representation of the `current_proxy_target` window [6],
-which at this point is set to CEF's window - which Qt5 knows nothing about, and
-thus returns nullptr. This ends up skipping calling `QXcbDrag::handleDrop()` for
-OBS Studio's main window, sending the dragged item into the void, never to be
-seen again. Sorry about this terrible fate, dragged item 😢
-
-Fix this whole mess by manually inspecting the toplevel window after setting up
-each CEF browser, and deleting the XdndProxy atom if it exists.
-
-Fixes https://github.com/obsproject/obs-studio/issues/4488
-
-[1] https://bitbucket.org/chromiumembedded/cef/src/1ffa5528b3e3640751e19cf47d8bcb615151907b/libcef/browser/native/window_x11.cc#lines-187:207
-[2] https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/xcb/qxcbdrag.cpp?h=v5.15.2#n78
-[3] https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/xcb/qxcbdrag.cpp?h=v5.15.2#n413
-[4] https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/xcb/qxcbdrag.cpp?h=v5.15.2#n414
-[5] https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/xcb/qxcbdrag.cpp?h=v5.15.2#n435
-[6] https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/xcb/qxcbdrag.cpp?h=v5.15.2#n543
----
- panel/browser-panel-internal.hpp | 6 +++
- panel/browser-panel.cpp | 72 ++++++++++++++++++++++++++++++++
- 2 files changed, 78 insertions(+)
-
-diff --git a/panel/browser-panel-internal.hpp b/panel/browser-panel-internal.hpp
-index 03279c2b..cc4514af 100644
---- a/panel/browser-panel-internal.hpp
-+++ b/panel/browser-panel-internal.hpp
-@@ -73,6 +73,12 @@ class QCefWidgetInternal : public QCefWidget {
-
- void Resize();
-
-+#ifdef __linux__
-+private:
-+ bool needsDeleteXdndProxy = true;
-+ void unsetToplevelXdndProxy();
-+#endif
-+
- public slots:
- void Init();
- };
-diff --git a/panel/browser-panel.cpp b/panel/browser-panel.cpp
-index 68912c3b..aa07fb5b 100644
---- a/panel/browser-panel.cpp
-+++ b/panel/browser-panel.cpp
-@@ -235,6 +235,74 @@ void QCefWidgetInternal::closeBrowser()
- }
- }
-
-+#ifdef __linux__
-+static bool XWindowHasAtom(Display *display, Window w, Atom a)
-+{
-+ Atom type;
-+ int format;
-+ unsigned long nItems;
-+ unsigned long bytesAfter;
-+ unsigned char *data = NULL;
-+
-+ if (XGetWindowProperty(display, w, a, 0, LONG_MAX, False,
-+ AnyPropertyType, &type, &format, &nItems,
-+ &bytesAfter, &data) != Success)
-+ return false;
-+
-+ if (data)
-+ XFree(data);
-+
-+ return type != None;
-+}
-+
-+void QCefWidgetInternal::unsetToplevelXdndProxy()
-+{
-+ if (!cefBrowser)
-+ return;
-+
-+ CefWindowHandle browserHandle =
-+ cefBrowser->GetHost()->GetWindowHandle();
-+ Display *xDisplay = cef_get_xdisplay();
-+ Window toplevel, root, parent, *children;
-+ unsigned int nChildren;
-+ bool found = false;
-+
-+ toplevel = browserHandle;
-+
-+ // Find the toplevel
-+ Atom netWmPidAtom = XInternAtom(xDisplay, "_NET_WM_PID", False);
-+ do {
-+ if (XQueryTree(xDisplay, toplevel, &root, &parent, &children,
-+ &nChildren) == 0)
-+ return;
-+
-+ if (children)
-+ XFree(children);
-+
-+ if (root == parent ||
-+ !XWindowHasAtom(xDisplay, parent, netWmPidAtom)) {
-+ found = true;
-+ break;
-+ }
-+ toplevel = parent;
-+ } while (true);
-+
-+ if (!found)
-+ return;
-+
-+ // Check if the XdndProxy property is set
-+ Atom xDndProxyAtom = XInternAtom(xDisplay, "XdndProxy", False);
-+ if (needsDeleteXdndProxy &&
-+ !XWindowHasAtom(xDisplay, toplevel, xDndProxyAtom)) {
-+ QueueCEFTask([this]() { unsetToplevelXdndProxy(); });
-+ return;
-+ }
-+
-+ XDeleteProperty(xDisplay, toplevel, xDndProxyAtom);
-+ needsDeleteXdndProxy = false;
-+}
-+#endif
-+
- void QCefWidgetInternal::Init()
- {
- #ifndef __APPLE__
-@@ -281,6 +349,10 @@ void QCefWidgetInternal::Init()
- CefRefPtr<CefDictionaryValue>(),
- #endif
- rqc);
-+
-+#ifdef __linux__
-+ QueueCEFTask([this]() { unsetToplevelXdndProxy(); });
-+#endif
- });
-
- if (success) {