fixed tab width in xeleven file
This commit is contained in:
parent
83b648ae03
commit
3213c68084
@ -9,48 +9,48 @@
|
|||||||
|
|
||||||
// Function to display a message box
|
// Function to display a message box
|
||||||
void showMessageBox(Display *display, const char *title, const char *message) {
|
void showMessageBox(Display *display, const char *title, const char *message) {
|
||||||
// Open a connection to the X server
|
// Open a connection to the X server
|
||||||
int screen = DefaultScreen(display);
|
int screen = DefaultScreen(display);
|
||||||
|
|
||||||
// Create a simple window
|
// Create a simple window
|
||||||
Window window = XCreateSimpleWindow(
|
Window window = XCreateSimpleWindow(
|
||||||
display, RootWindow(display, screen),
|
display, RootWindow(display, screen),
|
||||||
100, 100, 400, 200, 1,
|
100, 100, 400, 200, 1,
|
||||||
BlackPixel(display, screen), WhitePixel(display, screen)
|
BlackPixel(display, screen), WhitePixel(display, screen)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set the window title
|
// Set the window title
|
||||||
XStoreName(display, window, title);
|
XStoreName(display, window, title);
|
||||||
|
|
||||||
// Select events to handle
|
// Select events to handle
|
||||||
XSelectInput(display, window, ExposureMask | KeyPressMask);
|
XSelectInput(display, window, ExposureMask | KeyPressMask);
|
||||||
|
|
||||||
// Create a graphics context for drawing
|
// Create a graphics context for drawing
|
||||||
GC gc = XCreateGC(display, window, 0, NULL);
|
GC gc = XCreateGC(display, window, 0, NULL);
|
||||||
|
|
||||||
// Map the window (make it visible)
|
// Map the window (make it visible)
|
||||||
XMapWindow(display, window);
|
XMapWindow(display, window);
|
||||||
|
|
||||||
// Event loop
|
// Event loop
|
||||||
XEvent event;
|
XEvent event;
|
||||||
while (1) {
|
while (1) {
|
||||||
XNextEvent(display, &event);
|
XNextEvent(display, &event);
|
||||||
|
|
||||||
// Handle expose event (window needs to be redrawn)
|
// Handle expose event (window needs to be redrawn)
|
||||||
if (event.type == Expose) {
|
if (event.type == Expose) {
|
||||||
// Draw the message in the window
|
// Draw the message in the window
|
||||||
XDrawString(display, window, gc, 50, 100, message, strlen(message));
|
XDrawString(display, window, gc, 50, 100, message, strlen(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle key press event (close the window)
|
// Handle key press event (close the window)
|
||||||
if (event.type == KeyPress) {
|
if (event.type == KeyPress) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
XFreeGC(display, gc);
|
XFreeGC(display, gc);
|
||||||
XDestroyWindow(display, window);
|
XDestroyWindow(display, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Loading…
Reference in New Issue
Block a user