wm.h 822 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* Window manager: fixed-size draggable terminal windows + a system bar. */
  2. #ifndef WM_H
  3. #define WM_H
  4. #include "terminal.h"
  5. #define MAX_WINDOWS 4
  6. /* System bar (banner + "+ New" button + clock + rainbow) at the top. */
  7. #define WM_BAR_H 25
  8. #define WM_BTN_X 132
  9. #define WM_BTN_Y 3
  10. #define WM_BTN_W 56
  11. #define WM_BTN_H 14
  12. /* Window chrome. */
  13. #define WM_TITLE_H 16
  14. #define WM_CLOSE_W 14
  15. struct window {
  16. int used;
  17. unsigned int x, y; /* pixel origin (title bar top-left) */
  18. unsigned int pw, ph; /* pixel size */
  19. char title[16];
  20. int focused;
  21. unsigned int pid; /* owning terminal process pid (0 = none) */
  22. struct term *term;
  23. };
  24. void wm_run(void);
  25. int wm_spawn_terminal(void);
  26. struct window *wm_focused_window(void);
  27. int wm_is_focused(const struct window *w);
  28. void wm_request_redraw(void);
  29. #endif