Browse Source

Add ExternalWindow::isEmbed()

Signed-off-by: falkTX <falktx@falktx.com>
pull/312/head
falkTX 3 years ago
parent
commit
1d80bc8b8c
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 9 additions and 1 deletions
  1. +8
    -0
      distrho/extra/ExternalWindow.hpp
  2. +1
    -1
      examples/EmbedExternalUI/EmbedExternalExampleUI.cpp

+ 8
- 0
distrho/extra/ExternalWindow.hpp View File

@@ -114,6 +114,14 @@ public:
} }


#if DISTRHO_PLUGIN_HAS_EMBED_UI #if DISTRHO_PLUGIN_HAS_EMBED_UI
/**
Whether this Window is embed into another (usually not DGL-controlled) Window.
*/
bool isEmbed() const noexcept
{
return pData.parentWindowHandle != 0;
}

/** /**
Get the "native" window handle. Get the "native" window handle.
This can be reimplemented in order to pass the child window to hosts that can use such informaton. This can be reimplemented in order to pass the child window to hosts that can use such informaton.


+ 1
- 1
examples/EmbedExternalUI/EmbedExternalExampleUI.cpp View File

@@ -57,7 +57,7 @@ public:


const int screen = DefaultScreen(fDisplay); const int screen = DefaultScreen(fDisplay);
const ::Window root = RootWindow(fDisplay, screen); const ::Window root = RootWindow(fDisplay, screen);
const ::Window parent = getParentWindowHandle() != 0 ? (::Window)getParentWindowHandle() : root;
const ::Window parent = isEmbed() ? (::Window)getParentWindowHandle() : root;


XSetWindowAttributes attr = {}; XSetWindowAttributes attr = {};
attr.event_mask = KeyPressMask|KeyReleaseMask; attr.event_mask = KeyPressMask|KeyReleaseMask;


Loading…
Cancel
Save