wm_abi.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /* Shared window-manager ABI: kernel <-> ring-3 WM.
  2. * Only plain types and syscall numbers live here; the kernel window state and
  3. * all font/pixel decisions stay elsewhere. */
  4. #ifndef WM_ABI_H
  5. #define WM_ABI_H
  6. #define WM_MAX_WINDOWS 8
  7. /* Shared chrome layout (the WM draws it, the kernel only stores geometry). */
  8. #define WM_BAR_H 30
  9. #define WM_BTN_X 132
  10. #define WM_BTN_Y 5
  11. #define WM_BTN_W 56
  12. #define WM_BTN_H 20
  13. /* The other top-bar buttons follow the terminal button. */
  14. #define WM_BTN_GAP 6
  15. #define WM_BTN_CLOCK_X (WM_BTN_X + WM_BTN_W + WM_BTN_GAP)
  16. #define WM_BTN_CLOCK_Y WM_BTN_Y
  17. #define WM_BTN_CLOCK_W 64
  18. #define WM_BTN_CLOCK_H WM_BTN_H
  19. #define WM_BTN_COLORS_X (WM_BTN_CLOCK_X + WM_BTN_CLOCK_W + WM_BTN_GAP)
  20. #define WM_BTN_COLORS_Y WM_BTN_Y
  21. #define WM_BTN_COLORS_W 72
  22. #define WM_BTN_COLORS_H WM_BTN_H
  23. #define WM_BTN_FILES_X (WM_BTN_COLORS_X + WM_BTN_COLORS_W + WM_BTN_GAP)
  24. #define WM_BTN_FILES_Y WM_BTN_Y
  25. #define WM_BTN_FILES_W 64
  26. #define WM_BTN_FILES_H WM_BTN_H
  27. #define WM_BTN_MINES_X (WM_BTN_FILES_X + WM_BTN_FILES_W + WM_BTN_GAP)
  28. #define WM_BTN_MINES_Y WM_BTN_Y
  29. #define WM_BTN_MINES_W 56
  30. #define WM_BTN_MINES_H WM_BTN_H
  31. #define WM_BTN_WEB_X (WM_BTN_MINES_X + WM_BTN_MINES_W + WM_BTN_GAP)
  32. #define WM_BTN_WEB_Y WM_BTN_Y
  33. #define WM_BTN_WEB_W 56
  34. #define WM_BTN_WEB_H WM_BTN_H
  35. #define WM_BTN_CARDS_X (WM_BTN_WEB_X + WM_BTN_WEB_W + WM_BTN_GAP)
  36. #define WM_BTN_CARDS_Y WM_BTN_Y
  37. #define WM_BTN_CARDS_W 56
  38. #define WM_BTN_CARDS_H WM_BTN_H
  39. #define WM_BTN_GALLERY_X (WM_BTN_CARDS_X + WM_BTN_CARDS_W + WM_BTN_GAP)
  40. #define WM_BTN_GALLERY_Y WM_BTN_Y
  41. #define WM_BTN_GALLERY_W 72
  42. #define WM_BTN_GALLERY_H WM_BTN_H
  43. #define WM_TITLE_H 22
  44. #define WM_CLOSE_W 16
  45. /* Fixed user virtual addresses for the WM's mappings. The shadow is one
  46. * mapping; each window gets a private content slot (large enough for the
  47. * current canvas and future bigger ones). */
  48. #define WM_SHADOW_VA 0x58000000u
  49. #define WM_CONTENT_VA_BASE 0x59000000u
  50. #define WM_CONTENT_SLOT 0x00200000u /* 2 MB per window */
  51. /* Window content kind. */
  52. #define WM_KIND_NONE 0
  53. #define WM_KIND_TEXT 1
  54. #define WM_KIND_GFX 2
  55. struct wm_screen_info {
  56. unsigned int width;
  57. unsigned int height;
  58. unsigned int pitch;
  59. unsigned int bpp;
  60. unsigned int bytes;
  61. void *fb;
  62. };
  63. struct wm_mouse_info {
  64. unsigned int x;
  65. unsigned int y;
  66. unsigned int buttons; /* bit0 left, bit1 right, bit2 middle */
  67. };
  68. struct wm_status {
  69. struct wm_mouse_info mouse;
  70. unsigned int full_redraw;
  71. unsigned int kexec_busy;
  72. unsigned int kexec_progress;
  73. unsigned int kexec_total;
  74. };
  75. struct wm_window_info {
  76. unsigned int used;
  77. unsigned int kind; /* WM_KIND_* */
  78. unsigned int focused;
  79. unsigned int pid;
  80. int x, y;
  81. unsigned int w, h; /* outer window rectangle */
  82. unsigned int content_w, content_h;
  83. unsigned int cols, rows; /* text cells (0 for gfx) */
  84. unsigned int cursor;
  85. unsigned int cursor_visible;
  86. unsigned int dirty;
  87. unsigned int dirty_seq;
  88. unsigned int dmg_col0, dmg_row0, dmg_cols, dmg_rows;
  89. unsigned int content_gen;
  90. char title[16];
  91. };
  92. struct wm_map_info {
  93. void *va;
  94. unsigned int kind;
  95. unsigned int w, h;
  96. unsigned int stride; /* bytes per row for gfx, cells*2 for text */
  97. unsigned int generation;
  98. };
  99. struct wm_rect {
  100. int x, y;
  101. unsigned int w, h;
  102. };
  103. struct wm_present_info {
  104. unsigned int count; /* 0..4 */
  105. unsigned int immediate; /* 1: flush now (drag); 0: budgeted */
  106. struct wm_rect rect[4];
  107. };
  108. struct wm_geom {
  109. int x, y;
  110. };
  111. struct wm_size {
  112. unsigned int w, h;
  113. };
  114. /* Generic canvas-window client API (gfx commands own their own window). */
  115. struct win_create {
  116. unsigned int w, h;
  117. char title[16];
  118. };
  119. struct win_info {
  120. void *fb; /* mapped RGB565 back buffer */
  121. unsigned int width, height;
  122. unsigned int id;
  123. };
  124. /* Pointer input for generic canvas windows. The ring-3 WM queues press and
  125. * release edges; the command polls the current position for hover and drags. */
  126. struct win_pointer {
  127. int x, y; /* relative to the canvas, may be outside */
  128. unsigned int buttons; /* bit0 left, bit1 right, bit2 middle */
  129. unsigned int inside; /* pointer is over this window's content */
  130. unsigned int focused;
  131. };
  132. #define WIN_EV_POINTER_DOWN 1
  133. #define WIN_EV_POINTER_UP 2
  134. struct win_event {
  135. unsigned int type; /* WIN_EV_POINTER_* */
  136. int x, y; /* content-relative */
  137. unsigned int buttons; /* buttons after the event */
  138. };
  139. #endif