mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
x_error_count, etc
This commit is contained in:
parent
42a456b2db
commit
24c91f85f3
@ -70,3 +70,49 @@ get_hidden_cursor() {
|
|||||||
}
|
}
|
||||||
return _hidden_cursor;
|
return _hidden_cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: x11GraphicsPipe::disable_x_error_messages
|
||||||
|
// Access: Public, Static
|
||||||
|
// Description: Globally disables the printing of error messages that
|
||||||
|
// are raised by the X11 system, for instance in order
|
||||||
|
// to test whether a particular X11 operation will
|
||||||
|
// succeed. Reenable error messages with a later call
|
||||||
|
// to enable_x_error_messages().
|
||||||
|
//
|
||||||
|
// The return value is the current value of
|
||||||
|
// get_x_error_count().
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE int x11GraphicsPipe::
|
||||||
|
disable_x_error_messages() {
|
||||||
|
_x_error_messages_enabled = false;
|
||||||
|
return _x_error_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: x11GraphicsPipe::enable_x_error_messages
|
||||||
|
// Access: Public, Static
|
||||||
|
// Description: Reenables the printing of error messages after a
|
||||||
|
// previous call to disable_x_error_messages().
|
||||||
|
//
|
||||||
|
// The return value is the current value of
|
||||||
|
// get_x_error_count().
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE int x11GraphicsPipe::
|
||||||
|
enable_x_error_messages() {
|
||||||
|
_x_error_messages_enabled = true;
|
||||||
|
return _x_error_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: x11GraphicsPipe::get_x_error_count
|
||||||
|
// Access: Public, Static
|
||||||
|
// Description: Returns the number of times an error indication has
|
||||||
|
// been raised by the X11 system since application
|
||||||
|
// start, including errors raised while error messages
|
||||||
|
// were disabled.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE int x11GraphicsPipe::
|
||||||
|
get_x_error_count() {
|
||||||
|
return _x_error_count;
|
||||||
|
}
|
||||||
|
@ -30,6 +30,8 @@ TypeHandle x11GraphicsPipe::_type_handle;
|
|||||||
bool x11GraphicsPipe::_error_handlers_installed = false;
|
bool x11GraphicsPipe::_error_handlers_installed = false;
|
||||||
x11GraphicsPipe::ErrorHandlerFunc *x11GraphicsPipe::_prev_error_handler;
|
x11GraphicsPipe::ErrorHandlerFunc *x11GraphicsPipe::_prev_error_handler;
|
||||||
x11GraphicsPipe::IOErrorHandlerFunc *x11GraphicsPipe::_prev_io_error_handler;
|
x11GraphicsPipe::IOErrorHandlerFunc *x11GraphicsPipe::_prev_io_error_handler;
|
||||||
|
bool x11GraphicsPipe::_x_error_messages_enabled = true;
|
||||||
|
int x11GraphicsPipe::_x_error_count = 0;
|
||||||
|
|
||||||
LightReMutex x11GraphicsPipe::_x_mutex;
|
LightReMutex x11GraphicsPipe::_x_mutex;
|
||||||
|
|
||||||
@ -257,9 +259,20 @@ install_error_handlers() {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
int x11GraphicsPipe::
|
int x11GraphicsPipe::
|
||||||
error_handler(Display *display, XErrorEvent *error) {
|
error_handler(Display *display, XErrorEvent *error) {
|
||||||
|
++_x_error_count;
|
||||||
|
|
||||||
static const int msg_len = 80;
|
static const int msg_len = 80;
|
||||||
char msg[msg_len];
|
char msg[msg_len];
|
||||||
XGetErrorText(display, error->error_code, msg, msg_len);
|
XGetErrorText(display, error->error_code, msg, msg_len);
|
||||||
|
|
||||||
|
if (!_x_error_messages_enabled) {
|
||||||
|
if (x11display_cat.is_debug()) {
|
||||||
|
x11display_cat.debug()
|
||||||
|
<< msg << "\n";
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
x11display_cat.error()
|
x11display_cat.error()
|
||||||
<< msg << "\n";
|
<< msg << "\n";
|
||||||
|
|
||||||
|
@ -44,6 +44,10 @@ public:
|
|||||||
|
|
||||||
INLINE Cursor get_hidden_cursor();
|
INLINE Cursor get_hidden_cursor();
|
||||||
|
|
||||||
|
static INLINE int disable_x_error_messages();
|
||||||
|
static INLINE int enable_x_error_messages();
|
||||||
|
static INLINE int get_x_error_count();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual PreferredWindowThread get_preferred_window_thread() const;
|
virtual PreferredWindowThread get_preferred_window_thread() const;
|
||||||
|
|
||||||
@ -81,6 +85,9 @@ private:
|
|||||||
static bool _error_handlers_installed;
|
static bool _error_handlers_installed;
|
||||||
static ErrorHandlerFunc *_prev_error_handler;
|
static ErrorHandlerFunc *_prev_error_handler;
|
||||||
static IOErrorHandlerFunc *_prev_io_error_handler;
|
static IOErrorHandlerFunc *_prev_io_error_handler;
|
||||||
|
|
||||||
|
static bool _x_error_messages_enabled;
|
||||||
|
static int _x_error_count;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// This Mutex protects any X library calls, which all have to be
|
// This Mutex protects any X library calls, which all have to be
|
||||||
|
Loading…
x
Reference in New Issue
Block a user