mirror of
https://github.com/Ximi1970/systray-x.git
synced 2026-05-06 20:46:33 +02:00
Setup x11 error handler
This commit is contained in:
@@ -40,6 +40,11 @@ WindowCtrlUnix::WindowCtrlUnix( QObject *parent ) : QObject( parent )
|
||||
m_tb_window_states = QMap< quint64, Preferences::WindowState >();
|
||||
m_tb_window_hints = QMap< quint64, SizeHints >();
|
||||
|
||||
/*
|
||||
* Set the X11 error handler
|
||||
*/
|
||||
SetErrorHandler();
|
||||
|
||||
/*
|
||||
* Get the base display and window
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
/*
|
||||
* System includes
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -457,3 +458,27 @@ void MoveWindow( void* display, quint64 window, int x, int y )
|
||||
{
|
||||
XMoveWindow( (Display*)display, window, x, y );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The error handler
|
||||
*/
|
||||
int ErrorHandler( Display* display, XErrorEvent* event )
|
||||
{
|
||||
fprintf( stderr, "Error code: %x", event->error_code );
|
||||
|
||||
char buf[ 1024 ];
|
||||
XGetErrorText( display, event->error_code, buf, 1024 );
|
||||
fprintf( stderr, "%s\n", buf );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the error handler
|
||||
*/
|
||||
void SetErrorHandler()
|
||||
{
|
||||
XSetErrorHandler( ErrorHandler );
|
||||
}
|
||||
|
||||
@@ -261,4 +261,9 @@ void GetWindowPosition( void *display, quint64 window, long* pos_x, long* pos
|
||||
*/
|
||||
void MoveWindow( void* display, quint64 window, int x, int y );
|
||||
|
||||
/**
|
||||
* @brief SetErrorHandler. Set the x11 error handler.
|
||||
*/
|
||||
void SetErrorHandler();
|
||||
|
||||
#endif // SYSTRAY_X_LIB_H
|
||||
|
||||
Reference in New Issue
Block a user