UI: Disable QT's implicit colourspace conversion on macOS
Fixes issues as described in https://bugreports.qt.io/browse/QTBUG-47660 and halves CPU usage of OBS' UI by about 40-50%.master
parent
6460579fb6
commit
cab32e7e67
|
@ -144,6 +144,13 @@ bool IsAlwaysOnTop(QWidget *window)
|
|||
return (window->windowFlags() & Qt::WindowStaysOnTopHint) != 0;
|
||||
}
|
||||
|
||||
void disableColorSpaceConversion(QWidget *window)
|
||||
{
|
||||
NSView *view =
|
||||
(__bridge NSView *)reinterpret_cast<void *>(window->winId());
|
||||
view.window.colorSpace = NSColorSpace.sRGBColorSpace;
|
||||
}
|
||||
|
||||
void SetAlwaysOnTop(QWidget *window, bool enable)
|
||||
{
|
||||
Qt::WindowFlags flags = window->windowFlags();
|
||||
|
|
|
@ -67,4 +67,5 @@ QString GetMonitorName(const QString &id);
|
|||
void EnableOSXVSync(bool enable);
|
||||
void EnableOSXDockIcon(bool enable);
|
||||
void InstallNSApplicationSubclass();
|
||||
void disableColorSpaceConversion(QWidget *window);
|
||||
#endif
|
||||
|
|
|
@ -1867,6 +1867,10 @@ void OBSBasic::OBSInit()
|
|||
SystemTray(true);
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
disableColorSpaceConversion(this);
|
||||
#endif
|
||||
|
||||
bool has_last_version = config_has_user_value(App()->GlobalConfig(),
|
||||
"General", "LastVersion");
|
||||
bool first_run =
|
||||
|
|
Loading…
Reference in New Issue