mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-06 06:10:11 +01:00
Added a lightweight debugging facility to support troubleshooting
(for example) the stuck modifier key issue
This commit is contained in:
parent
cad8133cce
commit
7696bcddd0
2 changed files with 28 additions and 0 deletions
|
|
@ -72,6 +72,10 @@
|
|||
#include "darwin.h"
|
||||
#include "darwinClut8.h"
|
||||
|
||||
#ifdef ENABLE_DEBUG_LOG
|
||||
FILE *debug_log_fp = NULL;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* X server shared global variables
|
||||
*/
|
||||
|
|
@ -648,6 +652,20 @@ void OsVendorInit(void)
|
|||
{
|
||||
if (serverGeneration == 1) {
|
||||
DarwinPrintBanner();
|
||||
#ifdef ENABLE_DEBUG_LOG
|
||||
{
|
||||
char *home_dir=NULL, *log_file_path=NULL;
|
||||
home_dir = getenv("HOME");
|
||||
if (home_dir) asprintf(&log_file_path, "%s/%s", home_dir, DEBUG_LOG_NAME);
|
||||
if (log_file_path) {
|
||||
if (!access(log_file_path, F_OK)) {
|
||||
debug_log_fp = fopen(log_file_path, "a");
|
||||
if (debug_log_fp) ErrorF("Debug logging enabled to %s\n", log_file_path);
|
||||
}
|
||||
free(log_file_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Find the full path to the keymapping file.
|
||||
|
|
|
|||
|
|
@ -156,4 +156,14 @@ enum {
|
|||
kXDarwinWindowMoved // window has moved on screen
|
||||
};
|
||||
|
||||
#define ENABLE_DEBUG_LOG 1
|
||||
|
||||
#ifdef ENABLE_DEBUG_LOG
|
||||
extern FILE *debug_log_fp;
|
||||
#define DEBUG_LOG_NAME "x11-debug.txt"
|
||||
#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%d: " msg, __FUNCTION__, __LINE__, ##args )
|
||||
#else
|
||||
#define DEBUG_LOG(msg, args...)
|
||||
#endif
|
||||
|
||||
#endif /* _DARWIN_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue