浏览代码

UI: Use native color dialog on macOS

gxalpha 2 年之前
父节点
当前提交
e438037960
共有 4 个文件被更改,包括 16 次插入9 次删除
  1. 4 2
      UI/context-bar-controls.cpp
  2. 8 5
      UI/properties-view.cpp
  3. 2 1
      UI/window-basic-main.cpp
  4. 2 1
      UI/window-basic-settings-a11y.cpp

+ 4 - 2
UI/context-bar-controls.cpp

@@ -573,7 +573,8 @@ void ColorSourceToolbar::on_choose_clicked()
 	QColorDialog::ColorDialogOptions options;
 
 	options |= QColorDialog::ShowAlphaChannel;
-#ifndef _WIN32
+#ifdef __linux__
+	// TODO: Revisit hang on Ubuntu with native dialog
 	options |= QColorDialog::DontUseNativeDialog;
 #endif
 
@@ -695,7 +696,8 @@ void TextSourceToolbar::on_selectColor_clicked()
 	QColorDialog::ColorDialogOptions options;
 
 	options |= QColorDialog::ShowAlphaChannel;
-#ifndef _WIN32
+#ifdef __linux__
+	// TODO: Revisit hang on Ubuntu with native dialog
 	options |= QColorDialog::DontUseNativeDialog;
 #endif
 

+ 8 - 5
UI/properties-view.cpp

@@ -1813,15 +1813,18 @@ bool WidgetInfo::ColorChangedInternal(const char *setting, bool supportAlpha)
 		options |= QColorDialog::ShowAlphaChannel;
 	}
 
-	/* The native dialog on OSX has all kinds of problems, like closing
-	 * other open QDialogs on exit, and
-	 * https://bugreports.qt-project.org/browse/QTBUG-34532
-	 */
-#ifndef _WIN32
+#ifdef __linux__
+	// TODO: Revisit hang on Ubuntu with native dialog
 	options |= QColorDialog::DontUseNativeDialog;
 #endif
 
 	color = QColorDialog::getColor(color, view, QT_UTF8(desc), options);
+
+#ifdef __APPLE__
+	// TODO: Revisit when QTBUG-42661 is fixed
+	widget->window()->raise();
+#endif
+
 	if (!color.isValid())
 		return false;
 

+ 2 - 1
UI/window-basic-main.cpp

@@ -9721,7 +9721,8 @@ void OBSBasic::ColorChange()
 				obs_data_get_string(curPrivData, "color");
 			const char *customColor = *oldColor != 0 ? oldColor
 								 : "#55FF0000";
-#ifndef _WIN32
+#ifdef __linux__
+			// TODO: Revisit hang on Ubuntu with native dialog
 			options |= QColorDialog::DontUseNativeDialog;
 #endif
 

+ 2 - 1
UI/window-basic-settings-a11y.cpp

@@ -36,7 +36,8 @@ QColor OBSBasicSettings::GetColor(uint32_t colorVal, QString label)
 {
 	QColorDialog::ColorDialogOptions options;
 
-#ifndef _WIN32
+#ifdef __linux__
+	// TODO: Revisit hang on Ubuntu with native dialog
 	options |= QColorDialog::DontUseNativeDialog;
 #endif