You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

265 lines
7.7KB

  1. diff --git a/modules/juce_audio_plugin_client/LV2/juce_LV2_Wrapper.cpp b/modules/juce_audio_plugin_client/LV2/juce_LV2_Wrapper.cpp
  2. index 2f4b727..97e8a96 100644
  3. --- a/modules/juce_audio_plugin_client/LV2/juce_LV2_Wrapper.cpp
  4. +++ b/modules/juce_audio_plugin_client/LV2/juce_LV2_Wrapper.cpp
  5. @@ -52,7 +52,7 @@
  6. #define JucePlugin_WantsLV2State 1
  7. #endif
  8. -#if JUCE_LINUX
  9. +#if JUCE_LINUX && ! JUCE_LINUX_EMBED
  10. #include <X11/Xlib.h>
  11. #undef KeyPress
  12. #endif
  13. @@ -79,12 +79,12 @@
  14. #include "../utility/juce_IncludeModuleHeaders.h"
  15. +#if JUCE_LINUX && ! JUCE_LINUX_EMBED
  16. namespace juce
  17. {
  18. - #if JUCE_LINUX
  19. extern Display* display;
  20. - #endif
  21. }
  22. +#endif
  23. #define JUCE_LV2_STATE_STRING_URI "urn:juce:stateString"
  24. #define JUCE_LV2_STATE_BINARY_URI "urn:juce:stateBinary"
  25. @@ -200,6 +200,7 @@ const String makeManifestFile (AudioProcessor* const filter, const String& binar
  26. text += " rdfs:seeAlso <" + binary + ".ttl> .\n";
  27. text += "\n";
  28. +#if ! JUCE_LINUX_EMBED
  29. // UIs
  30. if (filter->hasEditor())
  31. {
  32. @@ -211,19 +212,20 @@ const String makeManifestFile (AudioProcessor* const filter, const String& binar
  33. text += "\n";
  34. text += "<" + pluginURI + "#ParentUI>\n";
  35. -#if JUCE_MAC
  36. + #if JUCE_MAC
  37. text += " a ui:CocoaUI ;\n";
  38. -#elif JUCE_LINUX
  39. + #elif JUCE_LINUX
  40. text += " a ui:X11UI ;\n";
  41. -#elif JUCE_WINDOWS
  42. + #elif JUCE_WINDOWS
  43. text += " a ui:WindowsUI ;\n";
  44. -#endif
  45. + #endif
  46. text += " ui:binary <" + binary + PLUGIN_EXT "> ;\n";
  47. text += " lv2:requiredFeature <" LV2_INSTANCE_ACCESS_URI "> ;\n";
  48. text += " lv2:optionalFeature ui:noUserResize ;\n";
  49. text += " lv2:extensionData <" LV2_PROGRAMS__UIInterface "> .\n";
  50. text += "\n";
  51. }
  52. +#endif
  53. #if JucePlugin_WantsLV2Presets
  54. const String presetSeparator(pluginURI.contains("#") ? ":" : "#");
  55. @@ -273,6 +275,7 @@ const String makePluginFile (AudioProcessor* const filter, const int maxNumInput
  56. text += " <" LV2_PROGRAMS__Interface "> ;\n";
  57. text += "\n";
  58. +#if ! JUCE_LINUX_EMBED
  59. // UIs
  60. if (filter->hasEditor())
  61. {
  62. @@ -280,6 +283,7 @@ const String makePluginFile (AudioProcessor* const filter, const int maxNumInput
  63. text += " <" + pluginURI + "#ParentUI> ;\n";
  64. text += "\n";
  65. }
  66. +#endif
  67. uint32 portIndex = 0;
  68. @@ -570,6 +574,7 @@ private:
  69. };
  70. #endif
  71. +#if ! JUCE_LINUX_EMBED
  72. //==============================================================================
  73. /**
  74. Lightweight DocumentWindow subclass for external ui
  75. @@ -1105,6 +1110,8 @@ private:
  76. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JuceLv2UIWrapper)
  77. };
  78. +#endif /* JUCE_LINUX_EMBED */
  79. +
  80. //==============================================================================
  81. /**
  82. Juce LV2 handle
  83. @@ -1249,7 +1256,9 @@ public:
  84. {
  85. const MessageManagerLock mmLock;
  86. +#if ! JUCE_LINUX_EMBED
  87. ui = nullptr;
  88. +#endif
  89. filter = nullptr;
  90. if (progDesc.name != nullptr)
  91. @@ -1818,8 +1827,10 @@ public:
  92. String stateData (CharPointer_UTF8(static_cast<const char*>(data)));
  93. filter->setStateInformationString (stateData);
  94. + #if ! JUCE_LINUX_EMBED
  95. if (ui != nullptr)
  96. ui->repaint();
  97. + #endif
  98. return LV2_STATE_SUCCESS;
  99. }
  100. @@ -1828,8 +1839,10 @@ public:
  101. {
  102. filter->setCurrentProgramStateInformation (data, size);
  103. + #if ! JUCE_LINUX_EMBED
  104. if (ui != nullptr)
  105. ui->repaint();
  106. + #endif
  107. return LV2_STATE_SUCCESS;
  108. }
  109. @@ -1852,6 +1865,7 @@ public:
  110. #endif
  111. }
  112. +#if ! JUCE_LINUX_EMBED
  113. //==============================================================================
  114. JuceLv2UIWrapper* getUI (LV2UI_Write_Function writeFunction, LV2UI_Controller controller, LV2UI_Widget* widget,
  115. const LV2_Feature* const* features, bool isExternal)
  116. @@ -1865,6 +1879,7 @@ public:
  117. return ui;
  118. }
  119. +#endif
  120. private:
  121. #if JUCE_LINUX
  122. @@ -1874,7 +1889,9 @@ private:
  123. #endif
  124. ScopedPointer<AudioProcessor> filter;
  125. +#if ! JUCE_LINUX_EMBED
  126. ScopedPointer<JuceLv2UIWrapper> ui;
  127. +#endif
  128. HeapBlock<float*> channels;
  129. MidiBuffer midiEvents;
  130. int numInChans, numOutChans;
  131. @@ -2033,6 +2050,7 @@ static const void* juceLV2_ExtensionData (const char* uri)
  132. return nullptr;
  133. }
  134. +#if ! JUCE_LINUX_EMBED
  135. //==============================================================================
  136. // LV2 UI descriptor functions
  137. @@ -2068,6 +2086,7 @@ static void juceLV2UI_Cleanup (LV2UI_Handle handle)
  138. {
  139. ((JuceLv2UIWrapper*)handle)->lv2Cleanup();
  140. }
  141. +#endif
  142. //==============================================================================
  143. // static LV2 Descriptor objects
  144. @@ -2083,6 +2102,7 @@ static const LV2_Descriptor JuceLv2Plugin = {
  145. juceLV2_ExtensionData
  146. };
  147. +#if ! JUCE_LINUX_EMBED
  148. static const LV2UI_Descriptor JuceLv2UI_External = {
  149. strdup(String(getPluginURI() + "#ExternalUI").toRawUTF8()),
  150. juceLV2UI_InstantiateExternal,
  151. @@ -2098,14 +2118,17 @@ static const LV2UI_Descriptor JuceLv2UI_Parent = {
  152. nullptr,
  153. nullptr
  154. };
  155. +#endif
  156. static const struct DescriptorCleanup {
  157. DescriptorCleanup() {}
  158. ~DescriptorCleanup()
  159. {
  160. free((void*)JuceLv2Plugin.URI);
  161. +#if ! JUCE_LINUX_EMBED
  162. free((void*)JuceLv2UI_External.URI);
  163. free((void*)JuceLv2UI_Parent.URI);
  164. +#endif
  165. }
  166. } _descCleanup;
  167. @@ -2130,6 +2153,7 @@ JUCE_EXPORTED_FUNCTION const LV2_Descriptor* lv2_descriptor (uint32 index)
  168. return (index == 0) ? &JuceLv2Plugin : nullptr;
  169. }
  170. +#if ! JUCE_LINUX_EMBED
  171. JUCE_EXPORTED_FUNCTION const LV2UI_Descriptor* lv2ui_descriptor (uint32 index);
  172. JUCE_EXPORTED_FUNCTION const LV2UI_Descriptor* lv2ui_descriptor (uint32 index)
  173. {
  174. @@ -2143,5 +2167,6 @@ JUCE_EXPORTED_FUNCTION const LV2UI_Descriptor* lv2ui_descriptor (uint32 index)
  175. return nullptr;
  176. }
  177. }
  178. +#endif
  179. #endif
  180. diff --git a/modules/juce_audio_processors/juce_audio_processors.cpp b/modules/juce_audio_processors/juce_audio_processors.cpp
  181. index 8df41ca..4c0a6a1 100644
  182. --- a/modules/juce_audio_processors/juce_audio_processors.cpp
  183. +++ b/modules/juce_audio_processors/juce_audio_processors.cpp
  184. @@ -47,7 +47,7 @@
  185. #endif
  186. #endif
  187. -#if JUCE_PLUGINHOST_VST && JUCE_LINUX
  188. +#if JUCE_PLUGINHOST_VST && JUCE_LINUX && ! JUCE_LINUX_EMBED
  189. #include <X11/Xlib.h>
  190. #include <X11/Xutil.h>
  191. #undef KeyPress
  192. @@ -161,7 +161,9 @@ void AutoResizingNSViewComponentWithParent::timerCallback()
  193. #include "format/juce_AudioPluginFormat.cpp"
  194. #include "format/juce_AudioPluginFormatManager.cpp"
  195. #include "processors/juce_AudioProcessor.cpp"
  196. -#include "processors/juce_AudioProcessorEditor.cpp"
  197. +#if ! JUCE_LINUX_EMBED
  198. + #include "processors/juce_AudioProcessorEditor.cpp"
  199. +#endif
  200. #include "processors/juce_AudioProcessorGraph.cpp"
  201. #include "processors/juce_GenericAudioProcessorEditor.cpp"
  202. #include "processors/juce_PluginDescription.cpp"
  203. diff --git a/modules/juce_events/juce_events.cpp b/modules/juce_events/juce_events.cpp
  204. index 729a78f..6d69c40 100644
  205. --- a/modules/juce_events/juce_events.cpp
  206. +++ b/modules/juce_events/juce_events.cpp
  207. @@ -55,10 +55,12 @@
  208. #import <IOKit/pwr_mgt/IOPMLib.h>
  209. #elif JUCE_LINUX
  210. - #include <X11/Xlib.h>
  211. - #include <X11/Xresource.h>
  212. - #include <X11/Xutil.h>
  213. - #undef KeyPress
  214. + #if ! JUCE_LINUX_EMBED
  215. + #include <X11/Xlib.h>
  216. + #include <X11/Xresource.h>
  217. + #include <X11/Xutil.h>
  218. + #undef KeyPress
  219. + #endif
  220. #include <unistd.h>
  221. #endif
  222. @@ -91,6 +93,9 @@ namespace juce
  223. #elif JUCE_WINDOWS
  224. #include "native/juce_win32_Messaging.cpp"
  225. +#elif JUCE_LINUX_EMBED
  226. + #include "native/juce_linux-embed_Messaging.cpp"
  227. +
  228. #elif JUCE_LINUX
  229. #include "native/juce_ScopedXLock.h"
  230. #include "native/juce_linux_Messaging.cpp"