- /* mini X11 drawing demo for Ilja */
- #include <X11/Xlib.h>
- #include <X11/Xutil.h>
- #include <unistd.h>
- #include <malloc.h>
- #include <stdio.h>
- int main(int argc,char *argv[])
- {
- Display *display = XOpenDisplay(NULL);
- int screen_num = DefaultScreen(display);
- Window root = RootWindow(display,screen_num);
- Visual *visual = DefaultVisual(display,screen_num);
- Window win = XCreateSimpleWindow(display,root,50,50,456,456,1,0,0);
- XSelectInput(display,win,ExposureMask);
- XMapWindow(display,win);
- XGCValues values; /* initial values for the GC. */
- unsigned long valuemask=0;
- GC gc = XCreateGC(display, win, valuemask, &values);
- XSetForeground(display, gc, WhitePixel(display, screen_num));
- XEvent event;
- while(1)
- {
- int j=0;
- XNextEvent(display,&event);
- if(event.type == Expose)
- {
- XDrawLine(display,win,gc, 50, 50, 400, 400);
- XDrawLine(display,win,gc, 400, 400, 50, 400);
- XDrawLine(display,win,gc, 50, 400, 50, 50);
- XFlush(display);
- }
- }
- sleep(10);
- XCloseDisplay(display);
- return 0;
- }
Mini-X11 demo for Ilja Mainz
Posted by Anonymous on Sun 17th Apr 2022 18:16
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.