You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Geometry.h 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Copyright (C) 2006-2008 Constantin Kaplinsky. All Rights Reserved.
  2. *
  3. * This is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This software is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this software; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  16. * USA.
  17. */
  18. //
  19. // Geometry.h
  20. //
  21. #ifndef __GEOMETRY_H__
  22. #define __GEOMETRY_H__
  23. #include <rfb/Rect.h>
  24. #include <rfb/Configuration.h>
  25. class Geometry
  26. {
  27. public:
  28. Geometry(int fullWidth, int fullHeight);
  29. void recalc(int fullWidth, int fullHeight);
  30. // Return coordinates and dimensions that specify a rectangular part
  31. // of the desktop that would be shown to RFB clients. This
  32. // information is extracted in the constructor from the "Geometry"
  33. // parameter.
  34. int width() const { return m_rect.width(); }
  35. int height() const { return m_rect.height(); }
  36. int offsetLeft() const { return m_rect.tl.x; }
  37. int offsetTop() const { return m_rect.tl.y; }
  38. // Return the same information as a Rect structure.
  39. const rfb::Rect& getRect() const { return m_rect; }
  40. protected:
  41. // Parse a string, extract size and coordinates,
  42. // and return that rectangle clipped to m_rect.
  43. rfb::Rect parseString(const char *arg) const;
  44. static rfb::StringParameter m_geometryParam;
  45. int m_fullWidth;
  46. int m_fullHeight;
  47. rfb::Rect m_rect;
  48. };
  49. #endif // __GEOMETRY_H__