No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

transient.c 847B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* cc transient.c -o transient -lX11 */
  2. #include <stdlib.h>
  3. #include <unistd.h>
  4. #include <X11/Xlib.h>
  5. #include <X11/Xutil.h>
  6. int main(void) {
  7. Display *d;
  8. Window r, f, t = None;
  9. XSizeHints h;
  10. XEvent e;
  11. d = XOpenDisplay(NULL);
  12. if (!d)
  13. exit(1);
  14. r = DefaultRootWindow(d);
  15. f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0);
  16. h.min_width = h.max_width = h.min_height = h.max_height = 400;
  17. h.flags = PMinSize | PMaxSize;
  18. XSetWMNormalHints(d, f, &h);
  19. XStoreName(d, f, "floating");
  20. XMapWindow(d, f);
  21. XSelectInput(d, f, ExposureMask);
  22. while (1) {
  23. XNextEvent(d, &e);
  24. if (t == None) {
  25. sleep(5);
  26. t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0);
  27. XSetTransientForHint(d, t, f);
  28. XStoreName(d, t, "transient");
  29. XMapWindow(d, t);
  30. XSelectInput(d, t, ExposureMask);
  31. }
  32. }
  33. XCloseDisplay(d);
  34. exit(0);
  35. }