wm_abi.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. /* The WM's start button is the NebOS banner at the top left; it opens the
  10. * start menu. The bar notice and the right-aligned status area (clock,
  11. * sensors, network, power) never draw left of this edge. */
  12. #define WM_BAR_LEFT_END 160
  13. #define WM_TITLE_H 22
  14. #define WM_CLOSE_W 16
  15. /* No visible frame: the title bar and content start at the window origin. */
  16. #define WM_BORDER_W 0
  17. /* Invisible resize band around a normal window: WM_RESIZE_IN px inside the
  18. * outer edge and WM_RESIZE_OUT px outside it. Presses in the inside part
  19. * are not routed to the window content; the whole band starts a resize. */
  20. #define WM_RESIZE_IN 1
  21. #define WM_RESIZE_OUT 3
  22. /* Keep at least this much of the title bar on-screen when a window is dragged
  23. * past an edge, so it can always be grabbed and brought back. */
  24. #define WM_DRAG_VISIBLE 48
  25. /* Fixed user virtual addresses for the WM's mappings. The shadow is one
  26. * mapping; each window gets a private content slot large enough for a
  27. * full-screen RGB565 canvas (1280x1024 minus the chrome is ~2.5 MB). */
  28. #define WM_SHADOW_VA 0x58000000u
  29. #define WM_CONTENT_VA_BASE 0x59000000u
  30. #define WM_CONTENT_SLOT 0x00400000u /* 4 MB per window */
  31. /* Window content kind. */
  32. #define WM_KIND_NONE 0
  33. #define WM_KIND_GFX 1
  34. /* Canvas-window flags (struct win_create.flags). A popover is chromeless,
  35. * always on top and anchored by the WM under the top-bar network icon; its
  36. * canvas fills the whole window rectangle. */
  37. #define WIN_F_POPOVER 0x1u
  38. struct wm_screen_info {
  39. unsigned int width;
  40. unsigned int height;
  41. unsigned int pitch;
  42. unsigned int bpp;
  43. unsigned int bytes;
  44. void *fb;
  45. };
  46. struct wm_mouse_info {
  47. unsigned int x;
  48. unsigned int y;
  49. unsigned int buttons; /* bit0 left, bit1 right, bit2 middle */
  50. };
  51. struct wm_status {
  52. struct wm_mouse_info mouse;
  53. unsigned int full_redraw;
  54. unsigned int boot_ready; /* storage is mounted; spawn the first terminal */
  55. unsigned int kexec_busy;
  56. unsigned int kexec_progress;
  57. unsigned int kexec_total;
  58. /* Panel backlight, for the WM's brightness OSD. seq changes on every
  59. * key/command adjustment; level is 0 when no PWM was found. */
  60. unsigned int backlight_present;
  61. unsigned int backlight_level;
  62. unsigned int backlight_seq;
  63. };
  64. struct wm_window_info {
  65. unsigned int used;
  66. unsigned int focused;
  67. unsigned int pid;
  68. unsigned int popover; /* WIN_F_POPOVER: no title bar, drawn on top */
  69. int x, y;
  70. unsigned int w, h; /* outer window rectangle */
  71. unsigned int content_w, content_h;
  72. unsigned int dirty;
  73. unsigned int dirty_seq;
  74. unsigned int dmg_x, dmg_y, dmg_w, dmg_h; /* content-relative pixels */
  75. unsigned int content_gen;
  76. char title[16];
  77. };
  78. /* SYS_WIN_PRESENT argument: the content-relative part of the canvas that
  79. * changed since the last present. w == 0 or h == 0 means the whole canvas,
  80. * so a caller that does not track damage keeps the old behaviour. */
  81. struct wm_win_present {
  82. unsigned int x, y, w, h;
  83. };
  84. struct wm_map_info {
  85. void *va;
  86. unsigned int kind;
  87. unsigned int w, h;
  88. unsigned int stride; /* bytes per row for gfx, cells*2 for text */
  89. unsigned int generation;
  90. };
  91. struct wm_rect {
  92. int x, y;
  93. unsigned int w, h;
  94. };
  95. struct wm_present_info {
  96. unsigned int count; /* 0..4 */
  97. unsigned int immediate; /* 1: flush now (drag); 0: budgeted */
  98. struct wm_rect rect[4];
  99. };
  100. struct wm_geom {
  101. int x, y;
  102. };
  103. struct wm_size {
  104. unsigned int w, h;
  105. };
  106. /* Generic canvas-window client API (gfx commands own their own window). */
  107. struct win_create {
  108. unsigned int w, h;
  109. unsigned int flags; /* WIN_F_* */
  110. char title[16];
  111. };
  112. struct win_info {
  113. void *fb; /* mapped RGB565 back buffer */
  114. unsigned int width, height;
  115. unsigned int id;
  116. };
  117. /* Pointer input for generic canvas windows. The ring-3 WM queues press and
  118. * release edges; the command polls the current position for hover and drags. */
  119. struct win_pointer {
  120. int x, y; /* relative to the canvas, may be outside */
  121. unsigned int buttons; /* bit0 left, bit1 right, bit2 middle */
  122. unsigned int inside; /* pointer is over this window's content */
  123. unsigned int focused;
  124. };
  125. /* Scroll accumulated for this window since the previous call, in pixels.
  126. * Positive dy means later content (wheel down under natural scrolling). */
  127. struct win_scroll {
  128. int dx, dy;
  129. };
  130. #define WIN_EV_POINTER_DOWN 1
  131. #define WIN_EV_POINTER_UP 2
  132. struct win_event {
  133. unsigned int type; /* WIN_EV_POINTER_* */
  134. int x, y; /* content-relative */
  135. unsigned int buttons; /* buttons after the event */
  136. };
  137. #endif