Browse Source

libjack: Detect when LD_PRELOAD does not work

tags/1.9.8
falkTX 7 years ago
parent
commit
04dc8d1ff5
2 changed files with 22 additions and 5 deletions
  1. +5
    -3
      source/interposer/interposer-jack-x11.cpp
  2. +17
    -2
      source/libjack/libjack.cpp

+ 5
- 3
source/interposer/interposer-jack-x11.cpp View File

@@ -228,19 +228,21 @@ int jack_carla_interposed_action(int action, void* ptr)
{ {
case 1: // set callback case 1: // set callback
gInterposedCallback = (CarlaInterposedCallback)ptr; gInterposedCallback = (CarlaInterposedCallback)ptr;
break;
return 1;


case 2: // show gui case 2: // show gui
gCurrentWindowVisible = true; gCurrentWindowVisible = true;
if (gCurrentlyMappedDisplay == nullptr || gCurrentlyMappedWindow == 0) if (gCurrentlyMappedDisplay == nullptr || gCurrentlyMappedWindow == 0)
break;
return 0;

gCurrentWindowMapped = true; gCurrentWindowMapped = true;
return real_XMapWindow(gCurrentlyMappedDisplay, gCurrentlyMappedWindow); return real_XMapWindow(gCurrentlyMappedDisplay, gCurrentlyMappedWindow);


case 3: // hide gui case 3: // hide gui
gCurrentWindowVisible = false; gCurrentWindowVisible = false;
if (gCurrentlyMappedDisplay == nullptr || gCurrentlyMappedWindow == 0) if (gCurrentlyMappedDisplay == nullptr || gCurrentlyMappedWindow == 0)
break;
return 0;

gCurrentWindowMapped = false; gCurrentWindowMapped = false;
return real_XUnmapWindow(gCurrentlyMappedDisplay, gCurrentlyMappedWindow); return real_XUnmapWindow(gCurrentlyMappedDisplay, gCurrentlyMappedWindow);




+ 17
- 2
source/libjack/libjack.cpp View File

@@ -30,7 +30,7 @@ CARLA_EXPORT
int jack_carla_interposed_action(int, void*) int jack_carla_interposed_action(int, void*)
{ {
carla_stderr2("Non-export jack_carla_interposed_action called, this should not happen!!"); carla_stderr2("Non-export jack_carla_interposed_action called, this should not happen!!");
return 0;
return 1337;
} }


CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE
@@ -843,7 +843,22 @@ bool CarlaJackAppClient::handleNonRtData()
break; break;


case kPluginBridgeNonRtClientShowUI: case kPluginBridgeNonRtClientShowUI:
jack_carla_interposed_action(2, nullptr);
if (jack_carla_interposed_action(2, nullptr) == 1337)
{
// failed, LD_PRELOAD did not work?
const char* const message("Cannot show UI, LD_PRELOAD not working?");
const std::size_t messageSize(std::strlen(message));

const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex);

fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerUiClosed);
fShmNonRtServerControl.commitWrite();

fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerError);
fShmNonRtServerControl.writeUInt(messageSize);
fShmNonRtServerControl.writeCustomData(message, messageSize);
fShmNonRtServerControl.commitWrite();
}
break; break;


case kPluginBridgeNonRtClientHideUI: case kPluginBridgeNonRtClientHideUI:


Loading…
Cancel
Save