ServerCache.cpp 4.55 KB
Newer Older
1 2
/**************************************************************************/
/*                                                                        */
3
/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/.         */
4 5 6 7 8 9 10 11
/*                                                                        */
/* NXCOMP, NX protocol compression and NX extensions to this software     */
/* are copyright of NoMachine. Redistribution and use of the present      */
/* software is allowed according to terms specified in the file LICENSE   */
/* which comes in the source distribution.                                */
/*                                                                        */
/* Check http://www.nomachine.com/licensing.html for applicability.       */
/*                                                                        */
12
/* NX and NoMachine are trademarks of Medialogic S.p.A.                   */
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
/*                                                                        */
/* All rights reserved.                                                   */
/*                                                                        */
/**************************************************************************/

#include "ServerCache.h"

//
// Some global caches used to store information
// common to all X connections.
//

BlockCache ServerCache::lastInitReply;
BlockCache ServerCache::lastKeymap;
unsigned char ServerCache::getKeyboardMappingLastKeysymsPerKeycode = 0;
BlockCache ServerCache::getKeyboardMappingLastMap;
BlockCache ServerCache::getModifierMappingLastMap;
BlockCache ServerCache::xResources;
BlockCacheSet ServerCache::queryFontFontCache(16);

ServerCache::ServerCache() :

  replySequenceCache(6), eventSequenceCache(6),
  lastTimestamp(0), visualCache(8), colormapCache(8),

  errorMinorCache(8),

  colormapNotifyWindowCache(8), colormapNotifyColormapCache(8),

  createNotifyWindowCache(8), createNotifyLastWindow(0),

  exposeWindowCache(12),

  focusInWindowCache(8),

  keyPressLastKey(0),

  mapNotifyEventCache(8), mapNotifyWindowCache(8),

  motionNotifyTimestampCache(8), motionNotifyLastRootX(0),
  motionNotifyLastRootY(0), motionNotifyRootXCache(8),
  motionNotifyRootYCache(8), motionNotifyEventXCache(8),
  motionNotifyEventYCache(8), motionNotifyStateCache(8),

  noExposeDrawableCache(8), noExposeMinorCache(8),

  propertyNotifyWindowCache(8), propertyNotifyAtomCache(8),

  reparentNotifyWindowCache(8),

  selectionClearWindowCache(8), selectionClearAtomCache(8),

  visibilityNotifyWindowCache(8),

  getGeometryRootCache(8),

  getInputFocusWindowCache(8),

  getKeyboardMappingKeysymCache(8),

  getPropertyTypeCache(8),
  getPropertyTextCompressor(textCache, SERVER_TEXT_CACHE_SIZE),

  getSelectionOwnerCache(8),

  getWindowAttributesClassCache(8), getWindowAttributesPlanesCache(8),
  getWindowAttributesPixelCache(8), getWindowAttributesAllEventsCache(8),
  getWindowAttributesYourEventsCache(8),
  getWindowAttributesDontPropagateCache(8),

  queryPointerRootCache(8), queryPointerChildCache(8),

  translateCoordsChildCache(8), translateCoordsXCache(8),
  translateCoordsYCache(8),

  queryTreeWindowCache(8),

  getAtomNameTextCompressor(textCache, SERVER_TEXT_CACHE_SIZE)

{
  unsigned int i;

  for (i = 0; i < 3; i++)
  {
    configureNotifyWindowCache[i] = new IntCache(8);
  }

  for (i = 0; i < 5; i++)
  {
    configureNotifyGeomCache[i] = new IntCache(8);
  }

  for (i = 0; i < 5; i++)
  {
    exposeGeomCache[i] = new IntCache(8);
  }

  for (i = 0; i < 3; i++)
  {
    motionNotifyWindowCache[i] = new IntCache(8);
  }

  for (i = 0; i < 5; i++)
  {
    getGeometryGeomCache[i] = new IntCache(8);
  }

  for (i = 0; i < 23; i++)
  {
    keyPressCache[i] = 0;
  }

  for (i = 0; i < 6; i++)
  {
    queryFontCharInfoCache[i] = new IntCache(8);
    queryFontLastCharInfo[i] = 0;
  }

  for (i = 0; i < 12; i++)
  {
    genericReplyIntCache[i] = new IntCache(8);
  }

  for (i = 0; i < 14; i++)
  {
    genericEventIntCache[i] = new IntCache(8);
  }
}


ServerCache::~ServerCache()
{
  unsigned int i;

  for (i = 0; i < 3; i++)
  {
    delete configureNotifyWindowCache[i];
  }

  for (i = 0; i < 5; i++)
  {
    delete configureNotifyGeomCache[i];
  }

  for (i = 0; i < 5; i++)
  {
    delete exposeGeomCache[i];
  }

  for (i = 0; i < 3; i++)
  {
    delete motionNotifyWindowCache[i];
  }

  for (i = 0; i < 5; i++)
  {
    delete getGeometryGeomCache[i];
  }

  for (i = 0; i < 6; i++)
  {
    delete queryFontCharInfoCache[i];
  }

  for (i = 0; i < 12; i++)
  {
    delete genericReplyIntCache[i];
  }

  for (i = 0; i < 14; i++)
  {
    delete genericEventIntCache[i];
  }
}