desktop.cpp 567 B

12345678910111213141516171819202122232425262728293031
  1. #if defined(Hiro_Desktop)
  2. namespace hiro {
  3. auto pDesktop::size() -> Size {
  4. @autoreleasepool {
  5. NSRect primary = [[[NSScreen screens] objectAtIndex:0] frame];
  6. return {
  7. (int)primary.size.width,
  8. (int)primary.size.height
  9. };
  10. }
  11. }
  12. auto pDesktop::workspace() -> Geometry {
  13. @autoreleasepool {
  14. auto screen = Desktop::size();
  15. NSRect area = [[[NSScreen screens] objectAtIndex:0] visibleFrame];
  16. return {
  17. (int)area.origin.x,
  18. (int)area.origin.y,
  19. (int)area.size.width,
  20. (int)area.size.height
  21. };
  22. }
  23. }
  24. }
  25. #endif