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
|
||||
void showMessageBox(Display *display, const char *title, const char *message) {
|
||||
// Open a connection to the X server
|
||||
int screen = DefaultScreen(display);
|
||||
// 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)
|
||||
);
|
||||
// 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);
|
||||
// Set the window title
|
||||
XStoreName(display, window, title);
|
||||
|
||||
// Select events to handle
|
||||
XSelectInput(display, window, ExposureMask | KeyPressMask);
|
||||
// Select events to handle
|
||||
XSelectInput(display, window, ExposureMask | KeyPressMask);
|
||||
|
||||
// Create a graphics context for drawing
|
||||
GC gc = XCreateGC(display, window, 0, NULL);
|
||||
// Create a graphics context for drawing
|
||||
GC gc = XCreateGC(display, window, 0, NULL);
|
||||
|
||||
// Map the window (make it visible)
|
||||
XMapWindow(display, window);
|
||||
// Map the window (make it visible)
|
||||
XMapWindow(display, window);
|
||||
|
||||
// Event loop
|
||||
XEvent event;
|
||||
while (1) {
|
||||
XNextEvent(display, &event);
|
||||
// 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 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;
|
||||
}
|
||||
}
|
||||
// Handle key press event (close the window)
|
||||
if (event.type == KeyPress) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up
|
||||
XFreeGC(display, gc);
|
||||
XDestroyWindow(display, window);
|
||||
// Clean up
|
||||
XFreeGC(display, gc);
|
||||
XDestroyWindow(display, window);
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user