|
@@ -19,7 +19,10 @@ |
|
|
#include "CarlaUtils.hpp" |
|
|
#include "CarlaUtils.hpp" |
|
|
|
|
|
|
|
|
#include <dlfcn.h> |
|
|
#include <dlfcn.h> |
|
|
#include <X11/Xlib.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_X11 |
|
|
|
|
|
# include <X11/Xlib.h> |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
@@ -59,12 +62,6 @@ struct ScopedLibOpen { |
|
|
CARLA_DECLARE_NON_COPY_STRUCT(ScopedLibOpen); |
|
|
CARLA_DECLARE_NON_COPY_STRUCT(ScopedLibOpen); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
|
|
|
// Function typedefs |
|
|
|
|
|
|
|
|
|
|
|
typedef int (*XWindowFunc)(Display*, Window); |
|
|
|
|
|
typedef int (*XNextEventFunc)(Display*, XEvent*); |
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
// Current state |
|
|
// Current state |
|
|
|
|
|
|
|
@@ -75,8 +72,10 @@ typedef enum { |
|
|
WindowMapSubwindows |
|
|
WindowMapSubwindows |
|
|
} WindowMappingType; |
|
|
} WindowMappingType; |
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_X11 |
|
|
static Display* gCurrentlyMappedDisplay = nullptr; |
|
|
static Display* gCurrentlyMappedDisplay = nullptr; |
|
|
static Window gCurrentlyMappedWindow = 0; |
|
|
static Window gCurrentlyMappedWindow = 0; |
|
|
|
|
|
#endif |
|
|
static CarlaInterposedCallback gInterposedCallback = nullptr; |
|
|
static CarlaInterposedCallback gInterposedCallback = nullptr; |
|
|
static uint gInterposedSessionManager = LIBJACK_SESSION_MANAGER_NONE; |
|
|
static uint gInterposedSessionManager = LIBJACK_SESSION_MANAGER_NONE; |
|
|
static uint gInterposedHints = 0x0; |
|
|
static uint gInterposedHints = 0x0; |
|
@@ -84,8 +83,15 @@ static WindowMappingType gCurrentWindowType = WindowMapNone; |
|
|
static bool gCurrentWindowMapped = false; |
|
|
static bool gCurrentWindowMapped = false; |
|
|
static bool gCurrentWindowVisible = false; |
|
|
static bool gCurrentWindowVisible = false; |
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_X11 |
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
// Calling the real functions |
|
|
|
|
|
|
|
|
// Function typedefs |
|
|
|
|
|
|
|
|
|
|
|
typedef int (*XWindowFunc)(Display*, Window); |
|
|
|
|
|
typedef int (*XNextEventFunc)(Display*, XEvent*); |
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
|
|
|
// Calling the real X11 functions |
|
|
|
|
|
|
|
|
static int real_XMapWindow(Display* display, Window window) |
|
|
static int real_XMapWindow(Display* display, Window window) |
|
|
{ |
|
|
{ |
|
@@ -350,6 +356,8 @@ int XNextEvent(Display* display, XEvent* event) |
|
|
return real_XUnmapWindow(display, gCurrentlyMappedWindow); |
|
|
return real_XUnmapWindow(display, gCurrentlyMappedWindow); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif // HAVE_X11 |
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
// Full control helper |
|
|
// Full control helper |
|
|
|
|
|
|
|
@@ -373,13 +381,16 @@ int jack_carla_interposed_action(uint action, uint value, void* ptr) |
|
|
// show gui |
|
|
// show gui |
|
|
if (value != 0) |
|
|
if (value != 0) |
|
|
{ |
|
|
{ |
|
|
|
|
|
#ifdef HAVE_X11 |
|
|
gCurrentWindowVisible = true; |
|
|
gCurrentWindowVisible = true; |
|
|
if (gCurrentlyMappedDisplay == nullptr || gCurrentlyMappedWindow == 0) |
|
|
if (gCurrentlyMappedDisplay == nullptr || gCurrentlyMappedWindow == 0) |
|
|
|
|
|
#endif |
|
|
{ |
|
|
{ |
|
|
carla_stdout("NOTICE: Interposer show-gui request ignored"); |
|
|
carla_stdout("NOTICE: Interposer show-gui request ignored"); |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_X11 |
|
|
gCurrentWindowMapped = true; |
|
|
gCurrentWindowMapped = true; |
|
|
|
|
|
|
|
|
switch (gCurrentWindowType) |
|
|
switch (gCurrentWindowType) |
|
@@ -393,19 +404,24 @@ int jack_carla_interposed_action(uint action, uint value, void* ptr) |
|
|
default: |
|
|
default: |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
#endif |
|
|
} |
|
|
} |
|
|
// hide gui |
|
|
// hide gui |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
|
|
|
#ifdef HAVE_X11 |
|
|
gCurrentWindowVisible = false; |
|
|
gCurrentWindowVisible = false; |
|
|
if (gCurrentlyMappedDisplay == nullptr || gCurrentlyMappedWindow == 0) |
|
|
if (gCurrentlyMappedDisplay == nullptr || gCurrentlyMappedWindow == 0) |
|
|
|
|
|
#endif |
|
|
{ |
|
|
{ |
|
|
carla_stdout("NOTICE: Interposer hide-gui request ignored"); |
|
|
carla_stdout("NOTICE: Interposer hide-gui request ignored"); |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_X11 |
|
|
gCurrentWindowMapped = false; |
|
|
gCurrentWindowMapped = false; |
|
|
return real_XUnmapWindow(gCurrentlyMappedDisplay, gCurrentlyMappedWindow); |
|
|
return real_XUnmapWindow(gCurrentlyMappedDisplay, gCurrentlyMappedWindow); |
|
|
|
|
|
#endif |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
@@ -413,8 +429,10 @@ int jack_carla_interposed_action(uint action, uint value, void* ptr) |
|
|
gCurrentWindowType = WindowMapNone; |
|
|
gCurrentWindowType = WindowMapNone; |
|
|
gCurrentWindowMapped = false; |
|
|
gCurrentWindowMapped = false; |
|
|
gCurrentWindowVisible = false; |
|
|
gCurrentWindowVisible = false; |
|
|
|
|
|
#ifdef HAVE_X11 |
|
|
gCurrentlyMappedDisplay = nullptr; |
|
|
gCurrentlyMappedDisplay = nullptr; |
|
|
gCurrentlyMappedWindow = 0; |
|
|
gCurrentlyMappedWindow = 0; |
|
|
|
|
|
#endif |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|