Created
February 10, 2024 11:07
-
-
Save ssghost/afb4bc1141722faceb06a946e6b0ff1f to your computer and use it in GitHub Desktop.
Simple X11 Window Creation in C - Not for production, only for fun (gcc gui.c -lX11)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <X11/Xlib.h> | |
int main() { | |
XEvent event; | |
Display* display = XOpenDisplay(NULL); | |
Window w = XCreateSimpleWindow(display, DefaultRootWindow(display), 50, 50, 250, 250, 1, BlackPixel(display, 0), WhitePixel(display, 0)); | |
XMapWindow(display, w); | |
XSelectInput(display, w, ExposureMask); | |
for (;;) { | |
XNextEvent(display, &event); | |
if (event.type == Expose) { | |
XDrawString(display, w, DefaultGC(display, 0), 100, 100, "Thanks for Watching!", 20); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment