display_module.js 800 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. 'use strict';
  2. /**
  3. * @type {{_display(): Meta_Display, number_of_displays(): int}}
  4. */
  5. export const DisplayApi = {
  6. /**
  7. * Returns the Wayland display or screen
  8. *
  9. * @returns {Meta.Display}
  10. */
  11. _display() {
  12. return global.display || global.screen;
  13. },
  14. /**
  15. * @returns {int}
  16. * @public
  17. */
  18. number_displays() {
  19. return this._display().get_n_monitors();
  20. },
  21. /**
  22. * @param {number} displayIndex the monitor number
  23. * @returns {Meta.Rectangle}
  24. */
  25. display_geometry_for_index(displayIndex) {
  26. return this._display().get_monitor_geometry(displayIndex);
  27. },
  28. /**
  29. * @param {Meta.Cursor} cursor the new cursor to set
  30. */
  31. set_cursor(cursor) {
  32. this._display().set_cursor(cursor);
  33. },
  34. };