wm.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. /* The terminal whose screen is `screen`, or NULL (the sys_gfx service uses the
  30. * inherited screen pointer to find a command's window). */
  31. struct term *wm_term_for_screen(struct text_screen *screen);
  32. /* Pixel size of a window's content area (its canvas size). Returns 0/-1. */
  33. int wm_content_size(struct term *t, unsigned int *w, unsigned int *h);
  34. #endif