mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Merge remote-tracking branch 'origin/2.6.x' into feature/backmerge
This commit is contained in:
commit
27a75d2c6c
@ -94,14 +94,26 @@ constexpr unsigned long eventMask = FocusChangeMask | ButtonPressMask | ButtonRe
|
|||||||
|
|
||||||
constexpr unsigned int maxTrialsCount = 5;
|
constexpr unsigned int maxTrialsCount = 5;
|
||||||
|
|
||||||
// Filter the events received by windows (only allow those matching a specific window)
|
// Filter the events received by windows (only allow those matching a specific window or those needed for the IM to work)
|
||||||
// NOLINTNEXTLINE(readability-non-const-parameter)
|
// NOLINTNEXTLINE(readability-non-const-parameter)
|
||||||
Bool checkEvent(::Display*, XEvent* event, XPointer userData)
|
Bool checkEvent(::Display*, XEvent* event, XPointer userData)
|
||||||
{
|
{
|
||||||
// Just check if the event matches the window
|
if (event->xany.window == reinterpret_cast<::Window>(userData))
|
||||||
// The input method sometimes sends ClientMessages with a different window ID,
|
{
|
||||||
// our event loop has to process them for the IM to work
|
// The event matches the current window so pick it up
|
||||||
return (event->xany.window == reinterpret_cast<::Window>(userData)) || (event->type == ClientMessage);
|
return true;
|
||||||
|
}
|
||||||
|
if (event->type == ClientMessage)
|
||||||
|
{
|
||||||
|
// The input method sometimes sends ClientMessage with a different window ID.
|
||||||
|
// Our event loop has to process them for the IM to work.
|
||||||
|
// We assume ClientMessage events not having WM_PROTOCOLS message type are such events.
|
||||||
|
// ClientMessage events having WM_PROTOCOLS message type should be handled by their own window,
|
||||||
|
// so we ignore them here. They will eventually be picked up with the first condition.
|
||||||
|
static const Atom wmProtocols = sf::priv::getAtom("WM_PROTOCOLS");
|
||||||
|
return event->xclient.message_type != wmProtocols;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the name of the current executable
|
// Find the name of the current executable
|
||||||
|
Loading…
Reference in New Issue
Block a user