From 7901eb6ca104e54bc77ff7b6102df8f5d9dee24e Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 2 Nov 2020 14:43:08 +0000 Subject: [PATCH] Linux: Use synchronous X11 error handling in debug builds --- .../juce_gui_basics/native/x11/juce_linux_X11_Symbols.cpp | 1 + .../juce_gui_basics/native/x11/juce_linux_X11_Symbols.h | 4 ++++ .../native/x11/juce_linux_XWindowSystem.cpp | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.cpp b/modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.cpp index e00e103520..3c650291ac 100644 --- a/modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.cpp +++ b/modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.cpp @@ -181,6 +181,7 @@ bool X11Symbols::loadAllSymbols() makeSymbolBinding (xSetWMNormalHints, "XSetWMNormalHints"), makeSymbolBinding (xStringListToTextProperty, "XStringListToTextProperty"), makeSymbolBinding (xSync, "XSync"), + makeSymbolBinding (xSynchronize, "XSynchronize"), makeSymbolBinding (xTranslateCoordinates, "XTranslateCoordinates"), makeSymbolBinding (xrmUniqueQuark, "XrmUniqueQuark"), makeSymbolBinding (xUngrabPointer, "XUngrabPointer"), diff --git a/modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.h b/modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.h index 8d9bb68156..d1cb01b34f 100644 --- a/modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.h +++ b/modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.h @@ -453,6 +453,10 @@ public: (::Display*, Bool), void) + JUCE_GENERATE_FUNCTION_WITH_DEFAULT (XSynchronize, xSynchronize, + (::Display*, Bool), + int) + JUCE_GENERATE_FUNCTION_WITH_DEFAULT (XTranslateCoordinates, xTranslateCoordinates, (::Display*, ::Window, ::Window, int, int, int*, int*, ::Window*), Bool) diff --git a/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp index 917fc747b8..0a9a1069e5 100644 --- a/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp +++ b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp @@ -30,6 +30,10 @@ namespace juce #if JUCE_DEBUG && ! defined (JUCE_DEBUG_XERRORS) #define JUCE_DEBUG_XERRORS 1 + + #if ! defined (JUCE_DEBUG_XERRORS_SYNCHRONOUSLY) + #define JUCE_DEBUG_XERRORS_SYNCHRONOUSLY 1 + #endif #endif #if JUCE_MODULE_AVAILABLE_juce_gui_extra @@ -2719,6 +2723,10 @@ bool XWindowSystem::initialiseXDisplay() if (display == nullptr) return false; + #if JUCE_DEBUG_XERRORS_SYNCHRONOUSLY + X11Symbols::getInstance()->xSynchronize (display, True); + #endif + // Create a context to store user data associated with Windows we create windowHandleXContext = (XContext) X11Symbols::getInstance()->xrmUniqueQuark();