static int winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr) { char pszErrorMsg[100]; XGetErrorText (pDisplay, pErr->error_code, pszErrorMsg, sizeof (pszErrorMsg)); ErrorF ("winClipboardErrorHandler - ERROR: \n\t%s\n", pszErrorMsg); if (pErr->error_code == BadWindow || pErr->error_code == BadMatch || pErr->error_code == BadDrawable) { #if 0 pthread_exit (NULL); #endif } #if 0 pthread_exit (NULL); #endif return 0; }
void errorstring_x11display(const x11display_t * x11disp, int x11_errcode, char * buffer, uint8_t buffer_size) { int err ; int x11_err ; if (!buffer_size) { err = EINVAL ; PRINTUINT8_ERRLOG(buffer_size) ; goto ONERR; } x11_err = XGetErrorText(x11disp->sys_display, x11_errcode, buffer, buffer_size) ; if (x11_err) { err = EINVAL ; TRACESYSCALL_ERRLOG("XGetErrorText", err) ; PRINTINT_ERRLOG(x11_err) ; goto ONERR; } buffer[buffer_size-1] = 0 ; return ; ONERR: if (buffer_size) { snprintf(buffer, buffer_size, "%d", x11_errcode) ; buffer[buffer_size-1] = 0 ; } TRACEEXIT_ERRLOG(err); return ; }
static int ErrorHandle(Display *disp, XErrorEvent *err) { char msg[80]; XGetErrorText(disp, err->error_code, msg, 80); printf("X Error code: %s\n", msg); }
int errorHandler(Display *d, XErrorEvent *e) { char msg[80]; char req[80]; char number[80]; if (mode == wm_initialising && e->request_code == X_ChangeWindowAttributes && e->error_code == BadAccess) panic("another window manager is already running."); if (ignore_badwindow && (e->error_code == BadWindow || e->error_code == BadColor)) return 0; XGetErrorText(d, e->error_code, msg, sizeof(msg)); sprintf(number, "%d", e->request_code); XGetErrorDatabaseText(d, "XRequest", number, number, req, sizeof(req)); fprintf(stderr, "%s: protocol request %s on resource %#x failed: %s\n", argv0, req, (unsigned int) e->resourceid, msg); if (mode == wm_initialising) panic("can't initialise."); return 0; }
int SRGP__handlerForXerrors (Display *d, XErrorEvent *err) { char msg[80]; XGetErrorText (d, err->error_code, msg, 80); SRGP__error (ERR_X_SERVER, msg); }
static int x_error_handler(Display *display, XErrorEvent *error) { if ( !catchedErrorPce(PCE, NAME_xError) ) { char msg[1024]; char request[100]; char buf[100]; /* XSetInputFocus() can generate a */ /* BadMatch that is hard to avoid */ if ( error->request_code == X_SetInputFocus && error->error_code == BadMatch ) return 0; XGetErrorText(display, error->error_code, msg, 1024); sprintf(buf, "%d", error->request_code); XGetErrorDatabaseText(display, "XRequest", buf, "Unknown request", request, 100); Cprintf("X error of failed request: %s\n", msg); Cprintf("Major opcode of failed request: %d (%s)\n", error->request_code, request); Cprintf("Minor opcode of failed request: %d\n", error->minor_code); Cprintf("Resource id in failed request: 0x%x\n", (unsigned int) error->resourceid); Cprintf("Serial number of failed request: %ld\n", error->serial); errorPce(NIL, NAME_xError); } return 0; /* what to return here? */ }
static int _x11_error_handler(Display* display, XErrorEvent* event) { char errmsg[512]; XGetErrorText(display, event->error_code, errmsg, sizeof(errmsg)); log_warnf(HASH_WINDOW, WARNING_SYSTEM_CALL_FAIL, STRING_CONST("X error event occurred: %s"), errmsg); return 0; }
static int winMultiWindowWMErrorHandler (Display *pDisplay, XErrorEvent *pErr) { char pszErrorMsg[100]; if (pErr->request_code == X_ChangeWindowAttributes && pErr->error_code == BadAccess) { ErrorF ("ChangeWindowAttributes BadAccess.\n"); pthread_exit (NULL); } XGetErrorText (pDisplay, pErr->error_code, pszErrorMsg, sizeof (pszErrorMsg)); ErrorF ("ERROR: %s\n", pszErrorMsg); if (pErr->error_code==BadWindow || pErr->error_code==BadMatch || pErr->error_code==BadDrawable) { pthread_exit (NULL); } pthread_exit (NULL); return 0; }
static int _x_error(Display* display, XErrorEvent* error) { char error_string[1024]; XGetErrorText(error->display, error->error_code, error_string, 1024); __error() << error_string; return 0; }
int wmfs_error_handler(Display *d, XErrorEvent *event) { char mess[256]; /* Check if there is another WM running */ if(event->error_code == BadAccess && W->root == event->resourceid) errl(EXIT_FAILURE, "Another Window Manager is already running."); /* Ignore focus change error for unmapped client * 42 = X_SetInputFocus * 28 = X_GrabButton */ if(client_gb_win(event->resourceid)) if(event->error_code == BadWindow || event->request_code == 42 || event->request_code == 28) return 0; if(XGetErrorText(d, event->error_code, mess, 128)) warnxl("%s(%d) opcodes %d/%d\n resource #%lx\n", mess, event->error_code, event->request_code, event->minor_code, event->resourceid); return 1; }
static int xerror_handler(Display *d, XErrorEvent *e) { if(e->request_code == X_GetImage) return 0; char buf[128]; /* * construct the similar message format like X11 is using by default, but again, little * bit different so we knows it comes from here */ snprintf(buf, sizeof(buf), "%d", e->request_code); XGetErrorDatabaseText(d, "XRequest", buf, "%d", buf, sizeof(buf)); fprintf(stderr, "%s: ", buf); XGetErrorText(d, e->error_code, buf, sizeof(buf)); fprintf(stderr, "%s\n", buf); XGetErrorDatabaseText(d, "XlibMessage", "ResourceID", "%d", buf, sizeof(buf)); fprintf(stderr, " "); fprintf(stderr, buf, e->resourceid); fprintf(stderr, "\n"); return 0; }
static int x11ErrorHandler(Display *d, XErrorEvent *e) { char msg[80], req[80], number[80]; bool ignore_badwindow = TRUE; // maybe temporary if(initting && (e->request_code == X_ChangeWindowAttributes || e->request_code == X_GrabKey) && (e->error_code == BadAccess)) { fputs(i18n("kwin: it looks like there's already a window manager running. kwin not started.\n").local8Bit(), stderr); exit(1); } if(ignore_badwindow && (e->error_code == BadWindow || e->error_code == BadColor)) return 0; XGetErrorText(d, e->error_code, msg, sizeof(msg)); sprintf(number, "%d", e->request_code); XGetErrorDatabaseText(d, "XRequest", number, "<unknown>", req, sizeof(req)); fprintf(stderr, "kwin: %s(0x%lx): %s\n", req, e->resourceid, msg); if(initting) { fputs(i18n("kwin: failure during initialization; aborting").local8Bit(), stderr); exit(1); } return 0; }
static std::string getErrorText(Display *display, int code, int length) noexcept { std::vector<char> buf(length); if(!XGetErrorText(display, code, buf.data(), length)) return "Unknown error"; return std::string(buf.data()); }
static int _errorHandler( Display *d, XErrorEvent *err ) { static char buf[1024]; switch( err->error_code ) { case BadAccess: case BadAlloc: case BadAtom: case BadColor: case BadCursor: case BadDrawable: case BadFont: case BadGC: case BadIDChoice: case BadImplementation: case BadLength: case BadMatch : case BadName: case BadPixmap: case BadRequest: case BadValue: case BadWindow: default:; } XGetErrorText( d, err->error_code, buf, 1024 ); fprintf( stderr, "%s (#%lu %u.%u)\n", buf, //err->type err->serial, err->request_code, err->minor_code); return 0; }
JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getErrorText(JNIEnv *env, jclass unused, jlong display_ptr, jlong error_code) { Display *disp = (Display *)(intptr_t)display_ptr; char err_msg_buffer[ERR_MSG_SIZE]; XGetErrorText(disp, error_code, err_msg_buffer, ERR_MSG_SIZE); err_msg_buffer[ERR_MSG_SIZE - 1] = '\0'; return NewStringNativeWithLength(env, err_msg_buffer, strlen(err_msg_buffer)); }
static int errorhandler(Display *display, XErrorEvent *errorev) { XGetErrorText(display, errorev->error_code, ErrorMessage, 1024); externalerror(ErrorMessage); return 0; }
int errorhandler(Display *d, XErrorEvent *event) { char mess[256]; /* Check if there is another WM running */ if(BadAccess == event->error_code && ROOT == event->resourceid) errx(EXIT_FAILURE, "Another Window Manager is already running."); /* Ignore focus change error for unmapped client */ /* Too lazy to add Xproto.h so: * 42 = X_SetInputFocus * 28 = X_GrabButton */ if(client_gb_win(event->resourceid)) if(event->error_code == BadWindow || event->request_code == 42 || event->request_code == 28) return 0; XGetErrorText(d, event->error_code, mess, 128); warnx("%s(%d) opcodes %d/%d\n resource #%lx\n", mess, event->error_code, event->request_code, event->minor_code, event->resourceid); return 1; }
int FcitxXErrorHandler(Display * dpy, XErrorEvent * event) { if (!x11handle) return 0; if (FcitxInstanceGetIsDestroying(x11handle->owner)) return 0; char str[256]; FILE* fp = NULL; fp = FcitxXDGGetFileUserWithPrefix("log", "crash.log", "w" , NULL); if (fp) { XGetErrorText(dpy, event->error_code, str, 255); fprintf(fp, "fcitx: %s\n", str); } FcitxInstanceSaveAllIM(x11handle->owner); if (fp) fclose(fp); if (event->error_code != 3 && event->error_code != BadMatch) { // xterm will generate 3 FcitxInstanceEnd(x11handle->owner); } return 0; }
static int gui_x_error (Display *display, XErrorEvent *error) { /* * The X error handling routine. * * Arguments: * "display" is the X display the error orignated from. * "error" is the XErrorEvent that we are handling. * * Results: * Either we were expecting some sort of error to occur, * in which case we set the "gdk_error_code" flag, or this * error was unexpected, in which case we will print an * error message and exit. (Since trying to continue will * most likely simply lead to more errors). */ if (error->error_code) { { char buf[64]; XGetErrorText(display, error->error_code, buf, 63); fprintf(SE_ERR, "%s\n serial %ld error_code %d request_code %d minor_code %d\n", buf, error->serial, error->error_code, error->request_code, error->minor_code); } #ifdef SE_NO_CHECK error0("gui_x_error.", NULL); #endif return 0; } }
void linux_x_error(Display* display, const char* function_name, int error_code) { char error_text[BUFFER_SIZE]; XGetErrorText(display, error_code, error_text, BUFFER_SIZE); fprintf(stderr, "Error in function %s(): %s\n", function_name, error_text); return; }
int xerrors(Display *d, XErrorEvent *event) { char msg[100]; char req[100]; char nmb[100]; if(wm_init == TRUE && event->error_code == BadAccess) { logmsg << "Another WM is already running\n"; exit(1); } #ifndef DEBUGMSG if(event->error_code == BadWindow || event->error_code == BadMatch) return 0; #endif XGetErrorText(d, event->error_code, msg, sizeof(msg)); sprintf(nmb, "%d", event->request_code); XGetErrorDatabaseText(d, "XRequest", nmb, nmb, req, sizeof(req)); logmsg << "WM: " << req << " on resource " << event->resourceid << " failed: " << msg << '\n'; return 0; }
static int caml_gr_error_handler(Display *display, XErrorEvent *error) { char errmsg[512]; XGetErrorText(error->display, error->error_code, errmsg, sizeof(errmsg)); caml_gr_fail("Xlib error: %s", errmsg); return 0; }
/** * The error handler catches all X errors, writes the error * message to the debug log and continues. * * This is done to prevent abortion of the plugin viewer * in case the plugin does some invalid X operation. * */ static int x_errhandler(Display *dpy, XErrorEvent *error) { char errstr[256]; XGetErrorText(dpy, error->error_code, errstr, 256); kdDebug(1430) << "Detected X Error: " << errstr << endl; return 1; }
void FormatXError(Display *dpy, XErrorEvent *error, char *buffer, int size) { int i, p; XGetErrorText(dpy, error->error_code, buffer, size); i = strlen(buffer); if (i > size-100) return; buffer += i; if (error->request_code >= sizeof(requestCodes)/sizeof(char*)) { sprintf(buffer, "\n Request code: %i\n", error->request_code); } else { sprintf(buffer, "\n Request code: %i %s\n", error->request_code, requestCodes[error->request_code]); } i += p = strlen(buffer); if (i > size - 40) return; buffer += p; sprintf(buffer, " Request minor code: %i\n", error->minor_code); i += p = strlen(buffer); if (i > size - 30) return; buffer += p; sprintf(buffer, " Resource ID: 0x%x\n", (unsigned int)error->resourceid); i += p = strlen(buffer); if (i > size - 30) return; buffer += p; sprintf(buffer, " Error serial: %li\n", error->serial); return; }
int ErrorHandler(Display* pDisp, XErrorEvent* pEvent) { char chBuf[64]; XGetErrorText(pDisp,pEvent->error_code,chBuf,sizeof(chBuf)); fprintf(stderr,"X Error: %d %s\n", pEvent->error_code, chBuf); gnLastXError = pEvent->error_code; return 0; }
// Reports the specified error, appending information about the last X error // void _glfwInputXError(int error, const char* message) { char buffer[8192]; XGetErrorText(_glfw.x11.display, _glfw.x11.errorCode, buffer, sizeof(buffer)); _glfwInputError(error, "%s: %s", message, buffer); }
static int x_errhandler(Display *d, XErrorEvent *e) { #if SDL_VIDEO_DRIVER_X11_VIDMODE extern int vm_error; #endif #if SDL_VIDEO_DRIVER_X11_DGAMOUSE extern int dga_error; #endif #if SDL_VIDEO_DRIVER_X11_VIDMODE /* VidMode errors are non-fatal. :) */ /* Are the errors offset by one from the error base? e.g. the error base is 143, the code is 148, and the actual error is XF86VidModeExtensionDisabled (4) ? */ if ( (vm_error >= 0) && (((e->error_code == BadRequest)&&(e->request_code == vm_error)) || ((e->error_code > vm_error) && (e->error_code <= (vm_error+XF86VidModeNumberErrors)))) ) { #ifdef X11_DEBUG { char errmsg[1024]; XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg)); printf("VidMode error: %s\n", errmsg); } #endif return(0); } #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ #if SDL_VIDEO_DRIVER_X11_DGAMOUSE /* DGA errors can be non-fatal. :) */ if ( (dga_error >= 0) && ((e->error_code > dga_error) && (e->error_code <= (dga_error+XF86DGANumberErrors))) ) { #ifdef X11_DEBUG { char errmsg[1024]; XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg)); printf("DGA error: %s\n", errmsg); } #endif return(0); } #endif /* SDL_VIDEO_DRIVER_X11_DGAMOUSE */ return(X_handler(d,e)); }
int handleXError(Display* display, XErrorEvent* event) { if (event) { char buffer[1024]; XGetErrorText(display, event->error_code, buffer, 1024); EOUT("X11: " << buffer); } }
/** * Our own XError handle function. * Default handlers just show the error and exit application immediately. * This is very horrible for application, because many errors not critical and could be ignored. * The main target for this function creation - prevent sView to quit after * multiple BadMatch errors happens on fullscreen->windowed switching * (looking like a vendors OpenGL driver bug). * Thus, now we just show up the error description and just ignore it - hopes we will well. * Function behaviour could be extended in future. */ int stXErrorHandler(Display* theDisplay, XErrorEvent* theErrorEvent) { char aBuffer[4096]; XGetErrorText(theDisplay, theErrorEvent->error_code, aBuffer, 4096); ST_DEBUG_LOG("XError happend: " + aBuffer + "; ignored"); // have no idea WHAT we should return here.... return 0; }
static int CatchFalseAlarm(Display *display, XErrorEvent *err) { char msg[80]; XGetErrorText(display, err->error_code, msg, 80); dprintf(D_FULLDEBUG, "Caught Error code(%d): %s\n", err->error_code, msg); return 0; }