Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <X11/Xlib.h>
  2. static Window
  3. new_window(Display *d, const char *x)
  4. {
  5. const int s = DefaultScreen(d);
  6. Window w;
  7.  
  8. w = XCreateSimpleWindow(d, RootWindow(d, s),
  9. 0, 0, 200, 200, 1,
  10. BlackPixel(d, s),
  11. WhitePixel(d, s));
  12. XStoreName(d, w, x);
  13. return w;
  14. }
  15.  
  16. int
  17. main(void)
  18. {
  19. Display *d;
  20. Window w0, w1;
  21.  
  22. d = XOpenDisplay(NULL);
  23. if (!d) return 1;
  24.  
  25. w0 = new_window(d, "w0");
  26. w1 = new_window(d, "w1");
  27.  
  28. XMapWindow(d, w1);
  29. XMapWindow(d, w0);
  30.  
  31. for (;;) {
  32. XEvent e;
  33.  
  34. XNextEvent(d, &e);
  35. }
  36. XCloseDisplay(d);
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement