Created
November 18, 2014 22:12
-
-
Save gszauer/1769de5e122bf5061f46 to your computer and use it in GitHub Desktop.
This file contains 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(int argc, char** argv) { | |
Display* display; | |
Window window; | |
Screen* screen; | |
XEvent ev; | |
int screenId; | |
// Open the display using the env var | |
display = XOpenDisplay(NULL); | |
if (display == NULL) { | |
printf("%s\n", "Could not open display"); | |
return 1; | |
} | |
screen = DefaultScreenOfDisplay(display); | |
screenId = DefaultScreen(display); | |
// Open the window | |
window = XCreateSimpleWindow(display, RootWindowOfScreen(screen), 0, 0, 320, 200, 1, BlackPixel(display, screenId), WhitePixel(display, screenId)); | |
printf("%s\n", "Raise window"); | |
XClearWindow(display, window); | |
XMapRaised(display, window); | |
while (true) { | |
// Do something | |
XNextEvent(display, &ev); | |
} | |
// Cleanup | |
XCloseDisplay(display); | |
return 1; | |
} | |
// gcc -lX11 -L/usr/X11/lib -I/opt/X11/include -o test test.cpp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment