#ifdef __linux__ #include #include #include #include #include // Function to display a message box void showMessageBox(Display *display, const char *title, const char *message) { // Open a connection to the X server int screen = DefaultScreen(display); // Create a simple window Window window = XCreateSimpleWindow( display, RootWindow(display, screen), 100, 100, 400, 200, 1, BlackPixel(display, screen), WhitePixel(display, screen) ); // Set the window title XStoreName(display, window, title); // Select events to handle XSelectInput(display, window, ExposureMask | KeyPressMask); // Create a graphics context for drawing GC gc = XCreateGC(display, window, 0, NULL); // Map the window (make it visible) XMapWindow(display, window); // Event loop XEvent event; while (1) { XNextEvent(display, &event); // Handle expose event (window needs to be redrawn) if (event.type == Expose) { // Draw the message in the window XDrawString(display, window, gc, 50, 100, message, strlen(message)); } // Handle key press event (close the window) if (event.type == KeyPress) { break; } } // Clean up XFreeGC(display, gc); XDestroyWindow(display, window); } #endif