Browse Source

Implement X11 TransierForHint for LV2 embed UIs

tags/1.9.4
falkTX 10 years ago
parent
commit
a84c669dc6
10 changed files with 46 additions and 7 deletions
  1. +1
    -0
      source/backend/CarlaHost.h
  2. +8
    -0
      source/backend/plugin/CarlaPluginUi.cpp
  3. +1
    -0
      source/backend/plugin/CarlaPluginUi.hpp
  4. +5
    -0
      source/backend/plugin/Lv2Plugin.cpp
  5. +1
    -1
      source/backend/plugin/Makefile
  6. +16
    -0
      source/backend/standalone/CarlaStandalone.cpp
  7. +2
    -5
      source/carla
  8. +3
    -0
      source/carla-patchbay
  9. +3
    -0
      source/carla-rack
  10. +6
    -1
      source/plugin/carla-native-base.cpp

+ 1
- 0
source/backend/CarlaHost.h View File

@@ -1079,6 +1079,7 @@ CARLA_EXPORT const char* carla_get_host_osc_url_udp();
/*!
* Implemented in standalone.
*/
extern ulong carla_standalone_get_transient_win_id();
extern const char* carla_standalone_file_callback(FileCallbackOpcode action, bool isDir, const char* title, const char* filter);

#endif /* CARLA_HOST_H_INCLUDED */

+ 8
- 0
source/backend/plugin/CarlaPluginUi.cpp View File

@@ -149,6 +149,14 @@ public:
XStoreName(fDisplay, fWindow, title);
}

void setTransientWinId(const uintptr_t winId) override
{
CARLA_SAFE_ASSERT_RETURN(fDisplay != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fWindow != 0,);

XSetTransientForHint(fDisplay, fWindow, (Window)winId);
}

void* getPtr() const noexcept
{
return (void*)fWindow;


+ 1
- 0
source/backend/plugin/CarlaPluginUi.hpp View File

@@ -38,6 +38,7 @@ public:
virtual void idle() = 0;
virtual void setSize(const uint with, const uint height, const bool forceUpdate) = 0;
virtual void setTitle(const char* const title) = 0;
virtual void setTransientWinId(const uintptr_t winId) = 0;
virtual void* getPtr() const noexcept = 0;

#ifdef CARLA_OS_MAC


+ 5
- 0
source/backend/plugin/Lv2Plugin.cpp View File

@@ -24,6 +24,8 @@
#include "CarlaMathUtils.hpp"

#include "CarlaLv2Utils.hpp"

#include "CarlaHost.h"
#include "CarlaPluginUi.hpp"
#include "Lv2AtomQueue.hpp"

@@ -1158,6 +1160,9 @@ public:
if (fUi.window == nullptr)
return pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, -1, 0, 0.0f, msg);

if (const uintptr_t transientId = carla_standalone_get_transient_win_id())
fUi.window->setTransientWinId(transientId);

fUi.window->setTitle(fUi.title);

#if 0


+ 1
- 1
source/backend/plugin/Makefile View File

@@ -78,7 +78,7 @@ LadspaPlugin.cpp.o: LadspaPlugin.cpp $(CARLA_PLUGIN_INTERNAL_HPP) $(CARLA_ENGINE
DssiPlugin.cpp.o: DssiPlugin.cpp $(CARLA_PLUGIN_INTERNAL_HPP) $(CARLA_ENGINE_HPP) $(CARLA_DSSI_UTILS_HPP) $(CARLA_MATH_UTILS_HPP)
$(CXX) $< $(BUILD_CXX_FLAGS) $(QTCORE_FLAGS) -c -o $@

Lv2Plugin.cpp.o: Lv2Plugin.cpp $(CARLA_PLUGIN_INTERNAL_HPP) $(CARLA_ENGINE_HPP) $(CARLA_MATH_UTILS_HPP) $(CARLA_LV2_UTILS_HPP) $(CARLA_PLUGIN_UI_HPP) $(LV2_ATOM_QUEUE_HPP) $(CARLA_ENGINE_OSC_HPP)
Lv2Plugin.cpp.o: Lv2Plugin.cpp $(CARLA_PLUGIN_INTERNAL_HPP) $(CARLA_ENGINE_HPP) $(CARLA_MATH_UTILS_HPP) $(CARLA_LV2_UTILS_HPP) $(CARLA_HOST_H) $(CARLA_PLUGIN_UI_HPP) $(LV2_ATOM_QUEUE_HPP) $(CARLA_ENGINE_OSC_HPP)
$(CXX) $< $(BUILD_CXX_FLAGS) $(QTCORE_FLAGS) -c -o $@

VstPlugin.cpp.o: VstPlugin.cpp $(CARLA_PLUGIN_INTERNAL_HPP) $(CARLA_ENGINE_HPP) $(CARLA_VST_UTILS_HPP) $(CARLA_MATH_UTILS_HPP)


+ 16
- 0
source/backend/standalone/CarlaStandalone.cpp View File

@@ -113,6 +113,15 @@ struct CarlaBackendStandalone {

static CarlaBackendStandalone gStandalone;

// -------------------------------------------------------------------------------------------------------------------

static ulong gTransientWinId = 0;

ulong carla_standalone_get_transient_win_id()
{
return gTransientWinId;
}

// -------------------------------------------------------------------------------------------------------------------
// API

@@ -571,6 +580,13 @@ void carla_set_engine_option(EngineOption option, int value, const char* valueSt
switch (option)
{
case CB::ENGINE_OPTION_DEBUG:
if (value == -1729)
{
CARLA_SAFE_ASSERT_BREAK(valueStr != nullptr && valueStr[0] != '\0');
const long winId(std::atol(valueStr));
CARLA_SAFE_ASSERT_BREAK(winId != 0);
gTransientWinId = static_cast<ulong>(winId);
}
break;

case CB::ENGINE_OPTION_PROCESS_MODE:


+ 2
- 5
source/carla View File

@@ -303,11 +303,8 @@ if __name__ == '__main__':

Carla.gui = CarlaHostW()

# test
win = Carla.gui.winId()

if win:
os.environ["CARLA_TRANSIENT_WINDOW"] = str(win)
# set our gui as transient for all plugins UIs
Carla.host.set_engine_option(ENGINE_OPTION_DEBUG, -1729, str(Carla.gui.winId()))

# -------------------------------------------------------------
# Load project file if set


+ 3
- 0
source/carla-patchbay View File

@@ -87,6 +87,9 @@ if __name__ == '__main__':

Carla.gui = CarlaHostW()

# set our gui as transient for all plugins UIs
Carla.host.set_engine_option(ENGINE_OPTION_DEBUG, -1729, str(Carla.gui.winId()))

# -------------------------------------------------------------
# Load project file if set



+ 3
- 0
source/carla-rack View File

@@ -87,6 +87,9 @@ if __name__ == '__main__':

Carla.gui = CarlaHostW()

# set our gui as transient for all plugins UIs
Carla.host.set_engine_option(ENGINE_OPTION_DEBUG, -1729, str(Carla.gui.winId()))

# -------------------------------------------------------------
# Load project file if set



+ 6
- 1
source/plugin/carla-native-base.cpp View File

@@ -29,7 +29,12 @@

// -----------------------------------------------------------------------

const char* carla_file_callback(FileCallbackOpcode action, bool isDir, const char* title, const char* filter)
ulong carla_standalone_get_transient_win_id()
{
return 0;
}

const char* carla_standalone_file_callback(FileCallbackOpcode action, bool isDir, const char* title, const char* filter)
{
CARLA_SAFE_ASSERT_RETURN(title != nullptr && title[0] != '\0', nullptr);
CARLA_SAFE_ASSERT_RETURN(filter != nullptr && filter[0] != '\0', nullptr);


Loading…
Cancel
Save