mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
X11: Ignore ConfigureNotify events containing stale information
This commit is contained in:
parent
89d019b5da
commit
6648e13fa6
3 changed files with 18 additions and 3 deletions
|
|
@ -116,7 +116,7 @@ public:
|
||||||
// ConfigureNotify events, many of which has stale size information. By not calling
|
// ConfigureNotify events, many of which has stale size information. By not calling
|
||||||
// XWindowSystem::setBounds we are not actualising these old, incorrect sizes.
|
// XWindowSystem::setBounds we are not actualising these old, incorrect sizes.
|
||||||
if (! inConfigureNotifyHandler)
|
if (! inConfigureNotifyHandler)
|
||||||
XWindowSystem::getInstance()->setBounds (windowH, physicalBounds, isNowFullScreen);
|
moveResizeSerial = jmax (moveResizeSerial, XWindowSystem::getInstance()->setBounds (windowH, physicalBounds, isNowFullScreen).value_or (0));
|
||||||
|
|
||||||
fullScreen = isNowFullScreen;
|
fullScreen = isNowFullScreen;
|
||||||
|
|
||||||
|
|
@ -429,6 +429,11 @@ public:
|
||||||
bool focused = false;
|
bool focused = false;
|
||||||
bool inConfigureNotifyHandler = false;
|
bool inConfigureNotifyHandler = false;
|
||||||
|
|
||||||
|
unsigned long getMoveResizeSerial() const
|
||||||
|
{
|
||||||
|
return moveResizeSerial;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
class LinuxRepaintManager
|
class LinuxRepaintManager
|
||||||
|
|
@ -605,6 +610,7 @@ private:
|
||||||
double currentScaleFactor = 1.0;
|
double currentScaleFactor = 1.0;
|
||||||
Array<Component*> glRepaintListeners;
|
Array<Component*> glRepaintListeners;
|
||||||
ScopedWindowAssociation association;
|
ScopedWindowAssociation association;
|
||||||
|
unsigned long moveResizeSerial = 0;
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LinuxComponentPeer)
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LinuxComponentPeer)
|
||||||
|
|
|
||||||
|
|
@ -1736,7 +1736,7 @@ void XWindowSystem::setVisible (::Window windowH, bool shouldBeVisible) const
|
||||||
X11Symbols::getInstance()->xUnmapWindow (display, windowH);
|
X11Symbols::getInstance()->xUnmapWindow (display, windowH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XWindowSystem::setBounds (::Window windowH, Rectangle<int> newBounds, bool isFullScreen) const
|
std::optional<unsigned long> XWindowSystem::setBounds (::Window windowH, Rectangle<int> newBounds, bool isFullScreen) const
|
||||||
{
|
{
|
||||||
jassert (windowH != 0);
|
jassert (windowH != 0);
|
||||||
|
|
||||||
|
|
@ -1792,12 +1792,16 @@ void XWindowSystem::setBounds (::Window windowH, Rectangle<int> newBounds, bool
|
||||||
return {};
|
return {};
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
const auto serial = X11Symbols::getInstance()->xNextRequest (display);
|
||||||
X11Symbols::getInstance()->xMoveResizeWindow (display, windowH,
|
X11Symbols::getInstance()->xMoveResizeWindow (display, windowH,
|
||||||
newBounds.getX() - nativeWindowBorder.getLeft(),
|
newBounds.getX() - nativeWindowBorder.getLeft(),
|
||||||
newBounds.getY() - nativeWindowBorder.getTop(),
|
newBounds.getY() - nativeWindowBorder.getTop(),
|
||||||
(unsigned int) newBounds.getWidth(),
|
(unsigned int) newBounds.getWidth(),
|
||||||
(unsigned int) newBounds.getHeight());
|
(unsigned int) newBounds.getHeight());
|
||||||
|
return serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XWindowSystem::startHostManagedResize (::Window windowH,
|
void XWindowSystem::startHostManagedResize (::Window windowH,
|
||||||
|
|
@ -3780,6 +3784,11 @@ void XWindowSystem::dismissBlockingModals (LinuxComponentPeer* peer) const
|
||||||
|
|
||||||
void XWindowSystem::handleConfigureNotifyEvent (LinuxComponentPeer* peer, XConfigureEvent& confEvent) const
|
void XWindowSystem::handleConfigureNotifyEvent (LinuxComponentPeer* peer, XConfigureEvent& confEvent) const
|
||||||
{
|
{
|
||||||
|
// If the incoming event serial is smaller than the serial of a move/resize request we sent previously,
|
||||||
|
// then we should ignore the incoming event because it will conflict with the pending request.
|
||||||
|
if (confEvent.serial < peer->getMoveResizeSerial())
|
||||||
|
return;
|
||||||
|
|
||||||
const ScopedValueSetter<bool> scope { peer->inConfigureNotifyHandler, true };
|
const ScopedValueSetter<bool> scope { peer->inConfigureNotifyHandler, true };
|
||||||
|
|
||||||
peer->updateWindowBounds();
|
peer->updateWindowBounds();
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ public:
|
||||||
void setTitle (::Window, const String&) const;
|
void setTitle (::Window, const String&) const;
|
||||||
void setIcon (::Window , const Image&) const;
|
void setIcon (::Window , const Image&) const;
|
||||||
void setVisible (::Window, bool shouldBeVisible) const;
|
void setVisible (::Window, bool shouldBeVisible) const;
|
||||||
void setBounds (::Window, Rectangle<int>, bool fullScreen) const;
|
[[nodiscard]] std::optional<unsigned long> setBounds (::Window, Rectangle<int>, bool fullScreen) const;
|
||||||
void updateConstraints (::Window) const;
|
void updateConstraints (::Window) const;
|
||||||
|
|
||||||
ComponentPeer::OptionalBorderSize getBorderSize (::Window) const;
|
ComponentPeer::OptionalBorderSize getBorderSize (::Window) const;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue