wm_abi.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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_BTN_CHAT_X (WM_BTN_GALLERY_X + WM_BTN_GALLERY_W + WM_BTN_GAP)
  44. #define WM_BTN_CHAT_Y WM_BTN_Y
  45. #define WM_BTN_CHAT_W 56
  46. #define WM_BTN_CHAT_H WM_BTN_H
  47. #define WM_BTN_DISKS_X (WM_BTN_CHAT_X + WM_BTN_CHAT_W + WM_BTN_GAP)
  48. #define WM_BTN_DISKS_Y WM_BTN_Y
  49. #define WM_BTN_DISKS_W 64
  50. #define WM_BTN_DISKS_H WM_BTN_H
  51. /* Right edge of the launcher buttons: the notice text and the right-aligned
  52. * status (clock, sensors, power) never draw left of it. */
  53. #define WM_BTN_END_X (WM_BTN_DISKS_X + WM_BTN_DISKS_W)
  54. #define WM_TITLE_H 22
  55. #define WM_CLOSE_W 16
  56. /* Keep at least this much of the title bar on-screen when a window is dragged
  57. * past an edge, so it can always be grabbed and brought back. */
  58. #define WM_DRAG_VISIBLE 48
  59. /* Fixed user virtual addresses for the WM's mappings. The shadow is one
  60. * mapping; each window gets a private content slot large enough for a
  61. * full-screen RGB565 canvas (1280x1024 minus the chrome is ~2.5 MB). */
  62. #define WM_SHADOW_VA 0x58000000u
  63. #define WM_CONTENT_VA_BASE 0x59000000u
  64. #define WM_CONTENT_SLOT 0x00400000u /* 4 MB per window */
  65. /* Window content kind. */
  66. #define WM_KIND_NONE 0
  67. #define WM_KIND_GFX 1
  68. /* Canvas-window flags (struct win_create.flags). A popover is chromeless,
  69. * always on top and anchored by the WM under the top-bar network icon; its
  70. * canvas fills the whole window rectangle. */
  71. #define WIN_F_POPOVER 0x1u
  72. struct wm_screen_info {
  73. unsigned int width;
  74. unsigned int height;
  75. unsigned int pitch;
  76. unsigned int bpp;
  77. unsigned int bytes;
  78. void *fb;
  79. };
  80. struct wm_mouse_info {
  81. unsigned int x;
  82. unsigned int y;
  83. unsigned int buttons; /* bit0 left, bit1 right, bit2 middle */
  84. };
  85. struct wm_status {
  86. struct wm_mouse_info mouse;
  87. unsigned int full_redraw;
  88. unsigned int boot_ready; /* storage is mounted; spawn the first terminal */
  89. unsigned int kexec_busy;
  90. unsigned int kexec_progress;
  91. unsigned int kexec_total;
  92. /* Panel backlight, for the WM's brightness OSD. seq changes on every
  93. * key/command adjustment; level is 0 when no PWM was found. */
  94. unsigned int backlight_present;
  95. unsigned int backlight_level;
  96. unsigned int backlight_seq;
  97. };
  98. struct wm_window_info {
  99. unsigned int used;
  100. unsigned int focused;
  101. unsigned int pid;
  102. unsigned int popover; /* WIN_F_POPOVER: no title bar, drawn on top */
  103. int x, y;
  104. unsigned int w, h; /* outer window rectangle */
  105. unsigned int content_w, content_h;
  106. unsigned int dirty;
  107. unsigned int dirty_seq;
  108. unsigned int dmg_x, dmg_y, dmg_w, dmg_h; /* content-relative pixels */
  109. unsigned int content_gen;
  110. char title[16];
  111. };
  112. /* SYS_WIN_PRESENT argument: the content-relative part of the canvas that
  113. * changed since the last present. w == 0 or h == 0 means the whole canvas,
  114. * so a caller that does not track damage keeps the old behaviour. */
  115. struct wm_win_present {
  116. unsigned int x, y, w, h;
  117. };
  118. struct wm_map_info {
  119. void *va;
  120. unsigned int kind;
  121. unsigned int w, h;
  122. unsigned int stride; /* bytes per row for gfx, cells*2 for text */
  123. unsigned int generation;
  124. };
  125. struct wm_rect {
  126. int x, y;
  127. unsigned int w, h;
  128. };
  129. struct wm_present_info {
  130. unsigned int count; /* 0..4 */
  131. unsigned int immediate; /* 1: flush now (drag); 0: budgeted */
  132. struct wm_rect rect[4];
  133. };
  134. struct wm_geom {
  135. int x, y;
  136. };
  137. struct wm_size {
  138. unsigned int w, h;
  139. };
  140. /* Generic canvas-window client API (gfx commands own their own window). */
  141. struct win_create {
  142. unsigned int w, h;
  143. unsigned int flags; /* WIN_F_* */
  144. char title[16];
  145. };
  146. struct win_info {
  147. void *fb; /* mapped RGB565 back buffer */
  148. unsigned int width, height;
  149. unsigned int id;
  150. };
  151. /* Pointer input for generic canvas windows. The ring-3 WM queues press and
  152. * release edges; the command polls the current position for hover and drags. */
  153. struct win_pointer {
  154. int x, y; /* relative to the canvas, may be outside */
  155. unsigned int buttons; /* bit0 left, bit1 right, bit2 middle */
  156. unsigned int inside; /* pointer is over this window's content */
  157. unsigned int focused;
  158. };
  159. /* Scroll accumulated for this window since the previous call, in pixels.
  160. * Positive dy means later content (wheel down under natural scrolling). */
  161. struct win_scroll {
  162. int dx, dy;
  163. };
  164. #define WIN_EV_POINTER_DOWN 1
  165. #define WIN_EV_POINTER_UP 2
  166. struct win_event {
  167. unsigned int type; /* WIN_EV_POINTER_* */
  168. int x, y; /* content-relative */
  169. unsigned int buttons; /* buttons after the event */
  170. };
  171. #endif