Browse Source

XWindowSystem: Only restack sibling windows

Previously, BadMatch errors were seen when there were several modal
windows, each with a native titlebar. Moving a window would attempt to
restack the windows, which was not possible because the JUCE windows
were not siblings. We actually need to restack the top level windows,
i.e. the windows containing the server-side decorations.
v6.1.6
reuk 3 years ago
parent
commit
c9daf4288d
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
2 changed files with 29 additions and 2 deletions
  1. +27
    -2
      modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp
  2. +2
    -0
      modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.h

+ 27
- 2
modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp View File

@@ -1920,10 +1920,13 @@ void XWindowSystem::toBehind (::Window windowH, ::Window otherWindow) const
{
jassert (windowH != 0 && otherWindow != 0);
Window newStack[] = { otherWindow, windowH };
const auto topLevelA = findTopLevelWindowOf (windowH);
const auto topLevelB = findTopLevelWindowOf (otherWindow);
Window newStack[] = { topLevelA, topLevelB };
XWindowSystemUtilities::ScopedXLock xLock;
X11Symbols::getInstance()->xRestackWindows (display, newStack, 2);
X11Symbols::getInstance()->xRestackWindows (display, newStack, numElementsInArray (newStack));
}
bool XWindowSystem::isFocused (::Window windowH) const
@@ -2653,6 +2656,28 @@ String XWindowSystem::getTextFromClipboard() const
}
//==============================================================================
::Window XWindowSystem::findTopLevelWindowOf (::Window w) const
{
if (w == 0)
return 0;
Window* windowList = nullptr;
uint32 windowListSize = 0;
Window parent, root;
XWindowSystemUtilities::ScopedXLock xLock;
const auto result = X11Symbols::getInstance()->xQueryTree (display, w, &root, &parent, &windowList, &windowListSize);
const auto deleter = makeXFreePtr (windowList);
if (result == 0)
return 0;
if (parent == root)
return w;
return findTopLevelWindowOf (parent);
}
bool XWindowSystem::isParentWindowOf (::Window windowH, ::Window possibleChild) const
{
if (windowH == 0 || possibleChild == 0)


+ 2
- 0
modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.h View File

@@ -239,6 +239,8 @@ private:
void dismissBlockingModals (LinuxComponentPeer*) const;
void dismissBlockingModals (LinuxComponentPeer*, const XConfigureEvent&) const;
::Window findTopLevelWindowOf (::Window) const;
static void windowMessageReceive (XEvent&);
//==============================================================================


Loading…
Cancel
Save