Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

XorgGlue.c 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright 2011-2015 Pierre Ossman for Cendio AB
  3. *
  4. * This is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This software is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this software; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  17. * USA.
  18. */
  19. #ifdef HAVE_DIX_CONFIG_H
  20. #include <dix-config.h>
  21. #endif
  22. #include <assert.h>
  23. #include "scrnintstr.h"
  24. #ifdef RANDR
  25. #include "randrstr.h"
  26. #endif
  27. #include "XorgGlue.h"
  28. const char *vncGetDisplay(void)
  29. {
  30. return display;
  31. }
  32. unsigned long vncGetServerGeneration(void)
  33. {
  34. return serverGeneration;
  35. }
  36. void vncFatalError(const char *format, ...)
  37. {
  38. va_list args;
  39. char buffer[4096];
  40. va_start(args, format);
  41. vsnprintf(buffer, sizeof(buffer), format, args);
  42. va_end(args);
  43. FatalError("%s", buffer);
  44. }
  45. int vncGetScreenCount(void)
  46. {
  47. return screenInfo.numScreens;
  48. }
  49. void vncGetScreenFormat(int scrIdx, int *depth, int *bpp,
  50. int *trueColour, int *bigEndian,
  51. int *redMask, int *greenMask, int *blueMask)
  52. {
  53. int i;
  54. VisualPtr vis = NULL;
  55. assert(depth);
  56. assert(bpp);
  57. assert(trueColour);
  58. assert(bigEndian);
  59. assert(redMask);
  60. assert(greenMask);
  61. assert(blueMask);
  62. *depth = screenInfo.screens[scrIdx]->rootDepth;
  63. for (i = 0; i < screenInfo.numPixmapFormats; i++) {
  64. if (screenInfo.formats[i].depth == *depth) {
  65. *bpp = screenInfo.formats[i].bitsPerPixel;
  66. break;
  67. }
  68. }
  69. if (i == screenInfo.numPixmapFormats)
  70. FatalError("No pixmap format for root depth\n");
  71. *bigEndian = (screenInfo.imageByteOrder == MSBFirst);
  72. for (i = 0; i < screenInfo.screens[scrIdx]->numVisuals; i++) {
  73. if (screenInfo.screens[scrIdx]->visuals[i].vid ==
  74. screenInfo.screens[scrIdx]->rootVisual) {
  75. vis = &screenInfo.screens[scrIdx]->visuals[i];
  76. break;
  77. }
  78. }
  79. if (i == screenInfo.screens[scrIdx]->numVisuals)
  80. FatalError("No visual record for root visual\n");
  81. *trueColour = (vis->class == TrueColor);
  82. *redMask = vis->redMask;
  83. *greenMask = vis->greenMask;
  84. *blueMask = vis->blueMask;
  85. }
  86. int vncGetScreenX(int scrIdx)
  87. {
  88. return screenInfo.screens[scrIdx]->x;
  89. }
  90. int vncGetScreenY(int scrIdx)
  91. {
  92. return screenInfo.screens[scrIdx]->y;
  93. }