-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS Browser Panel Support #197
Conversation
TODO:
|
The packaging is incredibly janky, so I'm just going to say it's Somebody Else's Problem |
Packaging? |
Getting |
Yea I'm confused, we already include it for the browser source. Were you meaning something different? |
No, you understood right. I guess that's not actually a problem. Is there some way to package the app in the same way that CI does but locally? |
Short answer is not very easily at the moment. Long answer is we used to be able to do that with the bundle_app.py script but some things changed and now the CI scripts seem to have some added (and probably unnecessary) complexity. I think they should be something that can be simplified in to a single script but it's multiple scripts at the moment on CI. I was going to take a look at it after we release 25 originally. |
It's very hard to resize panels with this. Seems like you need to get the mouse onto exactly the pixel between the panels, or the panel will grab the mouse event. |
@tbodt Checked this out today, resizing is indeed hard - even if the mouse cursor changed to the vertical/horizontal resize variant, you end up creating a selection box in the canvas. Also when closed in detached state and then reopened, the reopened window can't be resized, but dragged and re-attached. Panels stay in their attached and detached places between OBS sessions, so that part seems to work fine. |
Did some further checks today, most functionality seems fine (i.e. renaming the title, opening links in a new tab when modifier is pressed), the size is restored correctly for attached panels, but detached panels are reset, maybe the Reloading a panel is not possible as the default keystroke CMD+R is already taken by OBS to reset transforms, might be better to move those transform-keystrokes to CMD+Option+R, etc. As for packaging, CEF expects to be placed in a proper macOS app bundle which CMake doesn't generate, so the framework references need to be patched, which Cmake would do automatically when I've added a PR to the main project with a cleaned-up build script which just needs to be run with |
Maybe this is as good a time as any to implement a refresh button in the title bar of the dock itself. |
Would adding a couple pixels of margin around the CEF wrapper in the dock do the trick? Likely best to add it on all sides. |
From what I could tell this is an issue with all panels on macOS not just with the browser panel. Aside from the compilation fix above I'd say that the non-resizable window that you end up when
the panel needs to be fixed as well and then this might be good to go. Haven't had time to figure out to test the built-in Twitch panels with oAuth-flow though. |
Weird, because that's supposed to be controlled by macOS. I guess time to experiment with these? According to a quick Google, modifying the styling of the widget itself won't help. |
Follow-up from my previous comment - after experimenting with docks on Windows, I can (unfortunately) confirm that docks are locked to the Technically, Qt supports custom window decorations, but in my testing on Windows the grips around the window turn from 5px to 1px in custom mode, and I expect the behaviour would be similar on other platforms. It's a terrible experience and I wouldn't recommend the switch. |
I'm running into the |
@eric if I'm not mistaken this issue will occur when a more recent version of platform libraries or |
Is someone else going to take up the work on this pull request? |
For the curious, I'm pretty sure they changed the objc_msgSend prototype because they knew the varargs ABI wouldn't be compatible with normal parameters on the upcoming ARM macs, and decided to change the prototype a year early to get everyone ready |
Went ahead and rebased this as well |
There you have it. I was not aware docked state even has an issue. |
Some more info from Qt's docs:
When the title bar is vertical, the :vertical pseudo class is set. In addition, depending on QDockWidget::DockWidgetFeature, the :closable, :floatable and :movable pseudo states are set. Note: Use Warning: The style sheet has no effect when the QDockWidget is undocked as Qt uses native top level windows when undocked. |
So far I've figured out that despite the splitter being 5px wide (in OBS default dark theme) its QWidgetWindow has a mask that ignores any input outside a 1px wide region. I'm not sure where this mask comes from. The QSplitter widget sets a mask on itself, but my understanding is that widget masks affect only drawing, not input. On top of this it looks like there might be a bug in Qt handling of mouse events on masked windows, where the mouse down event passes through but not the mouse drag or mouse up event. |
Unrelated to the current discussion, I just realised a discrepency of featureset - on Windows, we listen for a Ctrl+R keypress to allow users to reload the panel's contents. A similar condition should be added for macOS (I assume Cmd+R would be best?). obs-browser/panel/browser-panel-client.cpp Lines 200 to 209 in 35b26e9
|
As mentioned in #197 (comment):
Even better would be non-global keyboard shortcuts (that is shortcuts that change based on window focus) but that's not how Qt works iirc. |
At least on Windows, when CEF is focused, Qt doesn't have focus so default shortcuts don't work. I assume this behaviour is different on macOS due to the command bar? I assume you've verified the behaviour yourself by adding in the relevant check? |
@WizardCM I wouldn't know where to implement those checks, but I can confirm that OBS intercepts all keystrokes, so even copy&paste functionality is intercepted (so no pasting passwords into the oauth panels). Right-clicking in the CEF window and choosing "copy/paste" works however. |
This needs to be changed at least for macOS: obs-browser/panel/browser-panel.cpp Line 83 in 1c34fd7
Possible fix:
With this Twitch oauth and panels worked fine, as did chat addons. |
@PatTheMav I can confirm on Ubuntu 20.04 that that line requires changing too. Nice catch! |
a9bc71c
to
bb43f41
Compare
I've seen @tbodt pushed some requested changes - great! Would you mind applying this change as well? macOS and Linux require it: #197 (comment) |
@PatTheMav I can't reproduce the crash. Is there something special I need to do? |
You need to delete the I've tested this PR with and without Twitch OAUTH support and also with CEF 3770 and CEF 4183, works fine with both versions. Our patched Qt 5.15.2 fixes the resize bug with detached panels and otherwise I didn't run into unexpected behaviour. I will try testing this with a debug build tomorrow to catch any low-level CEF issues, but looks fine so far. |
obs_get_abs_path_ptr on Mac uses realpath, which fails if the file doesn't exist.
I tested this today as well, deleted the obs-browser plugin config directory before and did not get any crash so far. Also tested our Twitch authentication with it, all worked as expected (including the quirks known from the Windows side of things). Good to merge from my POV. |
Confirmed everything works very well with latest OBS master on 10.14. I was unable to reproduce the quirks others have mentioned, so I have to assume they are introduced in 10.15 and above. |
🚀 |
Description
Mac support for browser panels.
Depends on obsproject/obs-studio#2386
Motivation and Context
How Has This Been Tested?
Build and run on 10.14.6, click around, not that many things crash
Types of changes
Checklist: