1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-03 03:30:06 +00:00

Linux: Improved XEmbed support

This commit makes some minor improvements to the XEmbedComponent class and adds support for embedding JUCE windows in other hosts using the XEmbed protocol. It also includes some minor fixes for X11 peers when they have a parent window.
This commit is contained in:
ed 2019-06-27 14:21:44 +01:00
parent fd76cbc70d
commit f9dad9d608
3 changed files with 103 additions and 82 deletions

View file

@ -38,40 +38,6 @@ void juce_deleteKeyProxyWindow (ComponentPeer*);
class XEmbedComponent::Pimpl : private ComponentListener
{
public:
enum
{
maxXEmbedVersionToSupport = 0
};
enum Flags
{
XEMBED_MAPPED = (1<<0)
};
enum
{
XEMBED_EMBEDDED_NOTIFY = 0,
XEMBED_WINDOW_ACTIVATE = 1,
XEMBED_WINDOW_DEACTIVATE = 2,
XEMBED_REQUEST_FOCUS = 3,
XEMBED_FOCUS_IN = 4,
XEMBED_FOCUS_OUT = 5,
XEMBED_FOCUS_NEXT = 6,
XEMBED_FOCUS_PREV = 7,
XEMBED_MODALITY_ON = 10,
XEMBED_MODALITY_OFF = 11,
XEMBED_REGISTER_ACCELERATOR = 12,
XEMBED_UNREGISTER_ACCELERATOR = 13,
XEMBED_ACTIVATE_ACCELERATOR = 14
};
enum
{
XEMBED_FOCUS_CURRENT = 0,
XEMBED_FOCUS_FIRST = 1,
XEMBED_FOCUS_LAST = 2
};
//==============================================================================
struct SharedKeyWindow : public ReferenceCountedObject
{
@ -201,7 +167,14 @@ public:
static_cast<unsigned int> (newBounds.getHeight()));
}
XSelectInput (dpy, client, StructureNotifyMask | PropertyChangeMask | FocusChangeMask);
auto eventMask = StructureNotifyMask | PropertyChangeMask | FocusChangeMask;
XWindowAttributes clientAttr;
XGetWindowAttributes (dpy, client, &clientAttr);
if ((eventMask & clientAttr.your_event_mask) != eventMask)
XSelectInput (dpy, client, clientAttr.your_event_mask | eventMask);
getXEmbedMappedFlag();
if (shouldReparent)
@ -365,7 +338,7 @@ private:
Window getParentX11Window()
{
if (auto peer = owner.getPeer())
if (auto* peer = owner.getPeer())
return reinterpret_cast<Window> (peer->getNativeHandle());
return {};