Add Linux browser panel support [CEF 4280 / Chromium 87] #254
No reviewers
Labels
No labels
area/accessibility
area/dependency
Confirmed
Crash Report
Delayed
Design Issue
Duplicate
Feedback required
Good first issue
kind/bug
kind/cleanup
kind/enhancement
platform/linux
platform/macos
platform/windows
priority/high
Question
Request for Comments
Seeking Other Contributors
Seeking Testers
Won't Fix / By Design
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-obsproject/obs-browser!254
Loading…
Reference in a new issue
No description provided.
Delete branch "linux-browser-panels"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
TODO
Description
Add Linux browser panel support.
Motivation and Context
Bringing the browser plugin to parity with Windows.
How Has This Been Tested?
Needs testing on other OSs to make sure it doesn't break anything.
Types of changes
Checklist:
Just a few notes based on a visual readthrough. I imagine between this and #197, one will need rebased when the other is merged.
Might as well change the comment to reflect this isn't just WIN32 anymore.
Shouldn't this be
#if !defined(_WIN32) && !defined(__APPLE__)?Note that you use
defineinstead ofdefinedfor the second condition.@ -238,4 +253,4 @@/* Make sure Init isn't called more than once. */if (cefBrowser)return;Probably don't need this whitespace addition, unless the visual separation is truly needed.
@ -273,1 +278,4 @@timer.stop();if (!container) {container =I think in C++ files we use camelCase for variables. I'd probably use
browserWindowfor this.All requested fixes in the review are now fixed.
A couple more things.
@ -287,3 +300,3 @@#elif#elseQSize size = this->size() * devicePixelRatio();#endifWhat is the difference between RECT and CefRect? Is this a platform specific difference?
If you're removing the
#ifdef _WIN32here forSUPPORTS_FRACTIONAL_SCALING, doesn't that mean the instance on line 233/235 should also be moved/removed?Ubuntu 20.04:
When I create a custom browser dock.
When I try to open the Service Integration window (specifically to connect Twitch).
Browser sources work fine.
OK, after a bit of debugging myself, the cause for the second error above is
github.com/obsproject/obs-browser@ce8f6f8269/panel/browser-panel.cpp (L99)Essentially,
path.Get()returnsnull.github.com/obsproject/obs-browser@ce8f6f8269/panel/browser-panel.cpp (L82-L83)I think this is because the value it's based on,
rpath, ends up being an absolute path rather than an expected relative path, so the conversion fails.Would @tbodt's solution on macOS work here too?
https://github.com/obsproject/obs-browser/pull/197/files#diff-69dd8c025b947c895c80b4705d56a61d880c8841834614a0643b6cb727e4cd19R98-R99
@ -287,3 +300,3 @@#elif#elseQSize size = this->size() * devicePixelRatio();#endifMy guess based on the documentation is that CefRect is a platform-agnostic method.
https://magpcss.org/ceforum/apidocs3/projects/(default)/CefWindowInfo.html#SetAsChild(cef_window_handle_t,RECT)
@ -287,3 +300,3 @@#elif#elseQSize size = this->size() * devicePixelRatio();#endifChanged to CefRect, still needs confirmation it still compiles on Windows.
Fixed.
Didn't work for me.
@ -287,3 +300,3 @@#elif#elseQSize size = this->size() * devicePixelRatio();#endifMy hope is that if we use CefRect everywhere, it's more uniform and less code in ifdefs.
Service integration should be working with the latest push.
I've spent a few hours trying to bypass this error. No luck. If I remove the
windowInfo.SetAsChildcall, a secondary window does open, but that's not the goal.I tried a number of variations, including using
this->effectiveWindowId()or manually settingwindowInfo.parent_window. Everything would return the same error.The only way I was able to change the behaviour is using
XConfigureWindowandXReparentWindowafterCreateBrowserSync, which leaves an extra empty black window which then freaks out and cannot be closed. The panel itself renders correctly but cannot be interacted with or resized.I don't know X well enough to be able to do this using X functions correctly.
@WizardCM could you check if it works better for you now? I removed all of the QT functions from the CEF threads, and it seems it is more stable. It also seemed to work better on the latest CEF (CEF 4280).
@cg2121 Nice work! I can confirm that they now correctly appear inside the dock (and within the Service Integration login container).
As a side note, I'm using CEF 4183 as that's what we hope to upgrade to.
However, while the child windows are correctly added, the following things don't work:
When closing service integration login, bothFixed in CEF 4280BadWindow: 25andBadWindow: BadNameoccur (if I resize before closing, I also getBadWindow: BadColorfor every resize event)After triggering 3, on shutdown I getFixed in CEF 4280Trace/breakpoint trap (core dumped)- the breakpoint is at../sysdeps/nptl/futex-internal.h@WizardCM the crash on exit appears to only happen on CEF 4183, but resizing and clicking work fine for me.
@cg2121 Hmm, in that case I might try bumping to 4240 or 4280 for my testing.
I doubt that'll fix resizing and clicking though, if my experience so far is anything to go by. :(
@cg2121 I can confirm that 4240 doesn't have any change in behaviour at all, but 4280 fixes the crash on shutdown and the two BadWindow errors when closing service integration login.
The rest of the issues remain.
What OS did you test on so far? Can you please add that information to the original post?
I've tested it so far on Ubuntu 20.04 with QT 5.12.8.
On Fri, 2020-12-11 at 11:44 -0800, Clayton Groeneveld wrote:
I've been testing on Debian Unstable
So far everything I have thrown at it has worked.
For my builds I'm using this to make starting with Accell easy.
@WizardCM by chance, are you using a VM to test it?
@ -287,3 +300,3 @@#elif#elseQSize size = this->size() * devicePixelRatio();#endifNope. It has to use RECT on Windows.
I've now tested on Windows. Resizing doesn't quite work as expected, though.
Correct, I'm using my PXE boot in a Hyper-V VM. For some reason it has had trouble booting on real hardware recently, I hope to troubleshoot that this weekend.
@ -287,3 +300,3 @@#elif#elseQSize size = this->size() * devicePixelRatio();#endifThat's unfortunate. Oh well.
The obs-browser library lookup is now un-hardcoded. Requires https://github.com/obsproject/obs-studio/pull/3871 to work.
This library lookup is fixed now.
I just built this code on Ubuntu 20.04:
I've fixed the Windows resize issue. All I had to do was to set the window container as frameless.
I can confirm that the lib lookup function works perfectly, even with nonstandard locations for OBS.
Heads up: the issues I was running into with resizing and interaction are caused by the
USE_QT_LOOPCMake flag, which is designed to fix conflicts between Qt, CEF & GTK. I have this enabled to emulate production builds as much as possible. Getting browser panels to work properly with this flag will require a fair bit of rework of the panel code, but should solve a lot of issues.@eNBeWe This is why we use 3809 on Linux. Basically, 3770 doesn't seem to set the default font size, so all text is tiny (everything else should be fine). Alternatively, add this commit.
This is likely because non-free codecs are not enabled in Spotify builds.
I just tried to port this over to the mac branch and got a "use of undeclared identifier": there apparently is no such function. Is this a typo, or in an unmerged branch or something?
Ah, https://github.com/obsproject/obs-studio/pull/3871.
With the newer CEF versions (tested with 4280), the USE_QT_LOOP on Linux doesn't seem necessary. From what I can tell, the crashes don't happen anymore with newer CEF versions, as I haven't been able to reproduce them.
If that turns out to be the case, then this PR is ready to go.
Confirmed with another developer that they aren't getting the crashes anymore either, so as is this can be merged without problems, at least for Linux.
@tbodt added a fix for this in https://github.com/obsproject/obs-browser/pull/197, so maybe adapt that here as well?
I guess merging https://github.com/obsproject/obs-browser/pull/197 first makes sense, then the PRs for "modern" CEF versions required for macOS (because that would include CEF 4280 as well), and finally this PR?
I've added the fix from #197. It also works on Linux without problems.
Thank for working on this! I've been testing on Ubuntu 20.04 with OBS 26.0.1 with the following patches applied:
I've also dropped
USE_QT_LOOP=TRUEfrom my build. Working great, no issues encountered.Tested the Snap package mentioned to me by @flexiondotorg ( https://snapcraft.io/obs-studio ), looking good over here on Arch Linux. Docked my Twitch chat window without issues.
@cg2121 Now that macOS panel support has been merged, please rebase your branch.
In the meantime, I'm going to try and get
USE_QT_LOOPon linux to behave, just so we don't destroy existing configurations if possible. It won't be a requirement for this PR to be merged, but it's something I think would be worth doing.It has been updated to the latest master.
I managed to get this going, but when I tried to embed https://pretzel.rocks/ the player seems to be unable to function - it errors out playing each song and immediately skips to the next song.