File fix-LV2-headless-build.patch of Package surge-xt

diff --git a/src/surge-xt/SurgeSynthEditor.cpp b/src/surge-xt/SurgeSynthEditor.cpp
index e6c4bbf..ef3eda8 100644
--- a/src/surge-xt/SurgeSynthEditor.cpp
+++ b/src/surge-xt/SurgeSynthEditor.cpp
@@ -253,8 +253,8 @@ SurgeSynthEditor::SurgeSynthEditor(SurgeSynthProcessor &p)
     setResizable(true, processor.wrapperType == juce::AudioProcessor::wrapperType_VST);
 
     sge->audioLatencyNotified = processor.inputIsLatent;
-
-    sge->open(nullptr);
+    if (juce::Desktop::getInstance().isHeadless() == false)
+        sge->open(nullptr);
 
     idleTimer = std::make_unique<IdleTimer>(this);
     idleTimer->startTimer(1000 / 60);
@@ -735,4 +735,4 @@ void SurgeSynthEditor::setPitchModSustainGUI(int pitch, int mod, int sus)
         sw->isOn = sus > 64;
         sw->repaint();
     }
-}
\ No newline at end of file
+}
diff --git a/src/surge-xt/gui/SurgeGUIEditor.cpp b/src/surge-xt/gui/SurgeGUIEditor.cpp
index aa1a90b..362aff1 100644
--- a/src/surge-xt/gui/SurgeGUIEditor.cpp
+++ b/src/surge-xt/gui/SurgeGUIEditor.cpp
@@ -3014,10 +3014,13 @@ void SurgeGUIEditor::setZoomFactor(float zf, bool resizeWindow)
 
 void SurgeGUIEditor::setBitmapZoomFactor(float zf)
 {
-    float dbs = juce::Desktop::getInstance().getDisplays().getPrimaryDisplay()->scale;
-    int fullPhysicalZoomFactor = (int)(zf * dbs);
-    if (bitmapStore != nullptr)
-        bitmapStore->setPhysicalZoomFactor(fullPhysicalZoomFactor);
+    if (juce::Desktop::getInstance().isHeadless() == false)
+    {
+        float dbs = juce::Desktop::getInstance().getDisplays().getPrimaryDisplay()->scale;
+        int fullPhysicalZoomFactor = (int)(zf * dbs);
+        if (bitmapStore != nullptr)
+            bitmapStore->setPhysicalZoomFactor(fullPhysicalZoomFactor);
+    }
 }
 
 void SurgeGUIEditor::showMinimumZoomError() const
@@ -5238,6 +5241,9 @@ int SurgeGUIEditor::findLargestFittingZoomBetween(
     float baseW, float baseH)
 {
     // Here is a very crude implementation
+    if (juce::Desktop::getInstance().isHeadless() == true)
+        return 1;
+
     int result = zoomHigh;
     auto screenDim = juce::Desktop::getInstance().getDisplays().getPrimaryDisplay()->totalArea;
     float sx = screenDim.getWidth() * percentageOfScreenAvailable / 100.0;
openSUSE Build Service is sponsored by