@@ -305,6 +305,7 @@ CARLA_EXPORT void carla_set_process_name(const char* name); | |||||
* window control */ | * window control */ | ||||
CARLA_EXPORT int carla_cocoa_get_window(void* nsViewPtr); | CARLA_EXPORT int carla_cocoa_get_window(void* nsViewPtr); | ||||
CARLA_EXPORT void carla_cocoa_set_transient_window_for(void* nsViewChild, void* nsViewParent); | |||||
CARLA_EXPORT void carla_x11_reparent_window(uintptr_t winId1, uintptr_t winId2); | CARLA_EXPORT void carla_x11_reparent_window(uintptr_t winId1, uintptr_t winId2); | ||||
@@ -43,6 +43,19 @@ int carla_cocoa_get_window(void* nsViewPtr) | |||||
#endif | #endif | ||||
} | } | ||||
void carla_cocoa_set_transient_window_for(void* nsViewChildPtr, void* nsViewParentPtr) | |||||
{ | |||||
CARLA_SAFE_ASSERT_RETURN(nsViewChildPtr != nullptr,); | |||||
CARLA_SAFE_ASSERT_RETURN(nsViewParentPtr != nullptr,); | |||||
#if defined(CARLA_OS_MAC) && !defined(CARLA_PLUGIN_EXPORT) | |||||
NSView* const nsViewChild = (NSView*)nsViewChildPtr; | |||||
NSView* const nsViewParent = (NSView*)nsViewParentPtr; | |||||
[[nsViewParent window] addChildWindow:[nsViewChild window] | |||||
ordered:NSWindowAbove]; | |||||
#endif | |||||
} | |||||
void carla_x11_reparent_window(uintptr_t winId1, uintptr_t winId2) | void carla_x11_reparent_window(uintptr_t winId1, uintptr_t winId2) | ||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(winId1 != 0,); | CARLA_SAFE_ASSERT_RETURN(winId1 != 0,); | ||||
@@ -1122,7 +1122,9 @@ class PluginRefreshW(QDialog): | |||||
self.ui.ch_vst3.setEnabled(False) | self.ui.ch_vst3.setEnabled(False) | ||||
self.ui.ch_vst3.setVisible(False) | self.ui.ch_vst3.setVisible(False) | ||||
if not MACOS: | |||||
if MACOS: | |||||
self.setWindowModality(Qt.WindowModal) | |||||
else: | |||||
self.ui.ch_au.setEnabled(False) | self.ui.ch_au.setEnabled(False) | ||||
self.ui.ch_au.setVisible(False) | self.ui.ch_au.setVisible(False) | ||||
@@ -1434,7 +1436,9 @@ class PluginDatabaseW(QDialog): | |||||
self.ui.ch_bridged_wine.setChecked(False) | self.ui.ch_bridged_wine.setChecked(False) | ||||
self.ui.ch_bridged_wine.setEnabled(False) | self.ui.ch_bridged_wine.setEnabled(False) | ||||
if not MACOS: | |||||
if MACOS: | |||||
self.setWindowModality(Qt.WindowModal) | |||||
else: | |||||
self.ui.ch_au.setChecked(False) | self.ui.ch_au.setChecked(False) | ||||
self.ui.ch_au.setEnabled(False) | self.ui.ch_au.setEnabled(False) | ||||
self.ui.ch_au.setVisible(False) | self.ui.ch_au.setVisible(False) | ||||
@@ -214,6 +214,9 @@ class DriverSettingsW(QDialog): | |||||
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) | self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) | ||||
if MACOS: | |||||
self.setWindowModality(Qt.WindowModal) | |||||
# ------------------------------------------------------------------------------------------------------------- | # ------------------------------------------------------------------------------------------------------------- | ||||
# Load settings | # Load settings | ||||
@@ -372,6 +375,9 @@ class RuntimeDriverSettingsW(QDialog): | |||||
self.adjustSize() | self.adjustSize() | ||||
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) | self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) | ||||
if MACOS: | |||||
self.setWindowModality(Qt.WindowModal) | |||||
# ------------------------------------------------------------------------------------------------------------- | # ------------------------------------------------------------------------------------------------------------- | ||||
# Load runtime settings | # Load runtime settings | ||||
@@ -554,6 +560,9 @@ class CarlaSettingsW(QDialog): | |||||
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) | self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) | ||||
if MACOS: | |||||
self.setWindowModality(Qt.WindowModal) | |||||
# ------------------------------------------------------------------------------------------------------------- | # ------------------------------------------------------------------------------------------------------------- | ||||
# Load settings | # Load settings | ||||
@@ -330,6 +330,9 @@ class CarlaUtils(): | |||||
self.lib.carla_cocoa_get_window.argtypes = [c_uintptr] | self.lib.carla_cocoa_get_window.argtypes = [c_uintptr] | ||||
self.lib.carla_cocoa_get_window.restype = c_int | self.lib.carla_cocoa_get_window.restype = c_int | ||||
self.lib.carla_cocoa_set_transient_window_for.argtypes = [c_uintptr, c_uintptr] | |||||
self.lib.carla_cocoa_set_transient_window_for.restype = None | |||||
self.lib.carla_x11_reparent_window.argtypes = [c_uintptr, c_uintptr] | self.lib.carla_x11_reparent_window.argtypes = [c_uintptr, c_uintptr] | ||||
self.lib.carla_x11_reparent_window.restype = None | self.lib.carla_x11_reparent_window.restype = None | ||||
@@ -480,6 +483,9 @@ class CarlaUtils(): | |||||
def cocoa_get_window(self, winId): | def cocoa_get_window(self, winId): | ||||
return self.lib.carla_cocoa_get_window(winId) | return self.lib.carla_cocoa_get_window(winId) | ||||
def cocoa_set_transient_window_for(self, childWinId, parentWinId): | |||||
self.lib.carla_cocoa_set_transient_window_for(childWinId, parentWinId) | |||||
def x11_reparent_window(self, winId1, winId2): | def x11_reparent_window(self, winId1, winId2): | ||||
self.lib.carla_x11_reparent_window(winId1, winId2) | self.lib.carla_x11_reparent_window(winId1, winId2) | ||||
@@ -240,6 +240,9 @@ class CarlaAboutW(QDialog): | |||||
self.setWindowFlags(flags) | self.setWindowFlags(flags) | ||||
if MACOS: | |||||
self.setWindowModality(Qt.WindowModal) | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# JUCE About dialog | # JUCE About dialog | ||||
@@ -262,6 +265,9 @@ class JuceAboutW(QDialog): | |||||
self.setWindowFlags(flags) | self.setWindowFlags(flags) | ||||
if MACOS: | |||||
self.setWindowModality(Qt.WindowModal) | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Plugin Parameter | # Plugin Parameter | ||||
@@ -737,7 +743,9 @@ class PluginEdit(QDialog): | |||||
self.ui.rb_pan.setEnabled(False) | self.ui.rb_pan.setEnabled(False) | ||||
self.ui.rb_pan.setVisible(False) | self.ui.rb_pan.setVisible(False) | ||||
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) | |||||
flags = self.windowFlags() | |||||
flags &= ~Qt.WindowContextHelpButtonHint | |||||
self.setWindowFlags(flags) | |||||
self.reloadAll() | self.reloadAll() | ||||
@@ -1292,6 +1300,12 @@ class PluginEdit(QDialog): | |||||
QDialog.setVisible(self, yesNo) | QDialog.setVisible(self, yesNo) | ||||
if MACOS and yesNo: | |||||
parent = self.parent() | |||||
if parent is None: | |||||
return | |||||
gCarla.utils.cocoa_set_transient_window_for(self.windowHandle().winId(), parent.windowHandle().winId()) | |||||
#------------------------------------------------------------------ | #------------------------------------------------------------------ | ||||
def idleSlow(self): | def idleSlow(self): | ||||
@@ -31,7 +31,7 @@ from PyQt5.QtWidgets import QAbstractSpinBox, QApplication, QComboBox, QDialog, | |||||
import ui_inputdialog_value | import ui_inputdialog_value | ||||
from carla_shared import countDecimalPoints | |||||
from carla_shared import countDecimalPoints, MACOS | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Get a fixed value within min/max bounds | # Get a fixed value within min/max bounds | ||||
@@ -57,27 +57,32 @@ class CustomInputDialog(QDialog): | |||||
self.ui = ui_inputdialog_value.Ui_Dialog() | self.ui = ui_inputdialog_value.Ui_Dialog() | ||||
self.ui.setupUi(self) | self.ui.setupUi(self) | ||||
decimals = countDecimalPoints(step, stepSmall) | |||||
self.ui.label.setText(label) | self.ui.label.setText(label) | ||||
self.ui.doubleSpinBox.setDecimals(countDecimalPoints(step, stepSmall)) | |||||
self.ui.doubleSpinBox.setDecimals(decimals) | |||||
self.ui.doubleSpinBox.setRange(minimum, maximum) | self.ui.doubleSpinBox.setRange(minimum, maximum) | ||||
self.ui.doubleSpinBox.setSingleStep(step) | self.ui.doubleSpinBox.setSingleStep(step) | ||||
self.ui.doubleSpinBox.setValue(current) | self.ui.doubleSpinBox.setValue(current) | ||||
self.ui.doubleSpinBox.setPrefix(prefix) | self.ui.doubleSpinBox.setPrefix(prefix) | ||||
self.ui.doubleSpinBox.setSuffix(suffix) | self.ui.doubleSpinBox.setSuffix(suffix) | ||||
if MACOS: | |||||
self.setWindowModality(Qt.WindowModal) | |||||
if not scalePoints: | if not scalePoints: | ||||
self.ui.groupBox.setVisible(False) | self.ui.groupBox.setVisible(False) | ||||
self.resize(200, 0) | self.resize(200, 0) | ||||
else: | else: | ||||
text = "<table>" | text = "<table>" | ||||
for scalePoint in scalePoints: | for scalePoint in scalePoints: | ||||
text += "<tr><td align='right'>%f</td><td align='left'> - %s</td></tr>" % (scalePoint['value'], scalePoint['label']) | |||||
valuestr = ("%i" if decimals == 0 else "%f") % scalePoint['value'] | |||||
text += "<tr><td align='right'>%s</td><td align='left'> - %s</td></tr>" % (valuestr, scalePoint['label']) | |||||
text += "</table>" | text += "</table>" | ||||
self.ui.textBrowser.setText(text) | self.ui.textBrowser.setText(text) | ||||
self.resize(200, 300) | self.resize(200, 300) | ||||
self.fRetValue = current | self.fRetValue = current | ||||
self.adjustSize() | |||||
self.accepted.connect(self.slot_setReturnValue) | self.accepted.connect(self.slot_setReturnValue) | ||||
def returnValue(self): | def returnValue(self): | ||||