Guest User

Untitled

a guest
Apr 22nd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp
  2. index 62cf554..d547b71 100644
  3. --- a/xbmc/windowing/X11/WinSystemX11.cpp
  4. +++ b/xbmc/windowing/X11/WinSystemX11.cpp
  5. @@ -42,6 +42,32 @@
  6.  
  7. using namespace std;
  8.  
  9. +/* X11 Error handler and error functions */
  10. +static int x11_error_code = 0;
  11. +static int (*x11_old_error_handler)(Display *, XErrorEvent *);
  12. +
  13. +static int x11_error_handler(Display *dpy, XErrorEvent *error)
  14. +{
  15. + x11_error_code = error->error_code;
  16. + return 0;
  17. +}
  18. +
  19. +static void x11_trap_errors(void)
  20. +{
  21. + x11_error_code = 0;
  22. + x11_old_error_handler = XSetErrorHandler(x11_error_handler);
  23. +}
  24. +
  25. +static int x11_untrap_errors(void)
  26. +{
  27. + XSetErrorHandler(x11_old_error_handler);
  28. + if(x11_error_code)
  29. + {
  30. + CLog::Log(LOGERROR, "XLIB Error catched err(0x%08x)\n", x11_error_code);
  31. + }
  32. + return x11_error_code;
  33. +}
  34. +
  35. CWinSystemX11::CWinSystemX11() : CWinSystemBase()
  36. {
  37. m_eWindowSystem = WINDOW_SYSTEM_X11;
  38. @@ -471,8 +497,14 @@ void CWinSystemX11::CheckDisplayEvents()
  39. bool bGotEvent(false);
  40. bool bTimeout(false);
  41. XEvent Event;
  42. - while (XCheckTypedEvent(m_dpy, m_RREventBase + RRScreenChangeNotify, &Event))
  43. + bool bEvent = true;
  44. + while (true)
  45. {
  46. + x11_trap_errors();
  47. + bool bEvent = XCheckTypedEvent(m_dpy, m_RREventBase + RRScreenChangeNotify, &Event);
  48. + if(x11_untrap_errors() || !bEvent)
  49. + break;
  50. +
  51. if (Event.type == m_RREventBase + RRScreenChangeNotify)
  52. {
  53. CLog::Log(LOGDEBUG, "%s: Received RandR event %i", __FUNCTION__, Event.type);
Add Comment
Please, Sign In to add comment