2020-07-15 18:45:59 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#include "platform/linux/linux_xlib_helper.h"
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Platform {
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
class XErrorHandlerRestorer::Private {
|
|
|
|
public:
|
2020-12-10 02:32:30 +00:00
|
|
|
Private()
|
|
|
|
: _oldErrorHandler(XSetErrorHandler(nullptr)) {
|
|
|
|
}
|
|
|
|
|
|
|
|
~Private() {
|
|
|
|
XSetErrorHandler(_oldErrorHandler);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
int (*_oldErrorHandler)(Display *, XErrorEvent *);
|
2020-07-15 18:45:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
XErrorHandlerRestorer::XErrorHandlerRestorer()
|
|
|
|
: _private(std::make_unique<Private>()) {
|
|
|
|
}
|
|
|
|
|
|
|
|
XErrorHandlerRestorer::~XErrorHandlerRestorer() = default;
|
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace Platform
|