mouse.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef MOUSE_H
  2. #define MOUSE_H
  3. void mouse_init(void);
  4. void mouse_poll_update(void);
  5. /* IRQ12 handler: PS/2 AUX data, used when a hardware cursor is active. */
  6. void mouse_irq(void);
  7. int mouse_is_present(void);
  8. /* 1 when a PS/2 mouse was detected; the protocol accessors below are
  9. PS/2-specific (the USB backend lives in usbhid.h). */
  10. int mouse_ps2_present(void);
  11. int mouse_streaming_enabled(void);
  12. unsigned int mouse_device_id(void);
  13. int mouse_cursor_visible(void);
  14. /* Active cursor backend: 0 = software, 1 = Cirrus, 2 = Radeon, 3 = Intel. */
  15. int mouse_cursor_backend(void);
  16. /* Human-readable form of the above ("software", "nvidia hw", ...). */
  17. const char *mouse_cursor_backend_name(void);
  18. unsigned int mouse_packet_size(void);
  19. /* Current cursor position (hotspot) in framebuffer pixels. */
  20. unsigned int mouse_get_x(void);
  21. unsigned int mouse_get_y(void);
  22. /* Button state bitmask: bit0 = left, bit1 = right, bit2 = middle. */
  23. unsigned int mouse_buttons_state(void);
  24. /* Consume accumulated wheel/touchpad scroll in pixels. Positive dy means
  25. * later content (a wheel-down event under natural scrolling). */
  26. void mouse_scroll_take(int *dx, int *dy);
  27. /* Restore the saved background under the cursor (erase the cursor). Call
  28. before a scene redraw so mouse_redraw_cursor() re-saves a clean background. */
  29. void mouse_cursor_erase(void);
  30. /* Re-save the region under the cursor and redraw it on top (after the WM
  31. redraws windows underneath a stationary cursor). */
  32. void mouse_redraw_cursor(void);
  33. /* While a WM frame owns the shadow buffer, movement must update the position
  34. * and buttons without drawing a software cursor underneath the frame. The
  35. * WM erases/redraws the cursor itself at BEGIN/PRESENT. */
  36. void mouse_set_auto_draw(int on);
  37. /* Cursor shape (enum cursor_shape, include/cursor_abi.h). The WM server
  38. * resolves the shape under the pointer on every poll; an unknown value
  39. * selects CURSOR_DEFAULT. Animated shapes advance from mouse_poll_update. */
  40. void mouse_set_shape(int shape);
  41. int mouse_get_shape(void);
  42. /* Re-fetch the current image after kernel/cursor.c (re)loaded the bundle. */
  43. void mouse_cursor_reload(void);
  44. #endif