20 #include <Carbon/Carbon.h> 21 extern "C" {
void CPSEnableForegroundOperation(ProcessSerialNumber* psn); }
26 #include "throw_event.h" 27 #include "graphicsWindow.h" 28 #include "renderBuffer.h" 30 #include "graphicsPipeSelection.h" 34 STICKYKEYS g_StartupStickyKeys = {
sizeof(STICKYKEYS), 0};
35 TOGGLEKEYS g_StartupToggleKeys = {
sizeof(TOGGLEKEYS), 0};
36 FILTERKEYS g_StartupFilterKeys = {
sizeof(FILTERKEYS), 0};
39 ConfigureDef(config_showbase);
40 ConfigureFn(config_showbase) {
45 PRC_DESC(
"The directories to search for particle files to be loaded."));
56 throw_event(
"NewFrame");
62 get_config_showbase() {
64 return config_showbase;
77 activate_osx_application();
98 static int num_fullscreen_testsizes = 0;
99 #define MAX_FULLSCREEN_TESTS 10 100 static int fullscreen_testsizes[MAX_FULLSCREEN_TESTS * 2];
103 add_fullscreen_testsize(
int xsize,
int ysize) {
104 if ((xsize == 0) && (ysize == 0)) {
105 num_fullscreen_testsizes = 0;
110 if (num_fullscreen_testsizes < MAX_FULLSCREEN_TESTS) {
111 fullscreen_testsizes[num_fullscreen_testsizes * 2] = xsize;
112 fullscreen_testsizes[num_fullscreen_testsizes * 2 + 1] = ysize;
113 num_fullscreen_testsizes++;
123 query_fullscreen_testresult(
int xsize,
int ysize) {
126 for (i=0; i < num_fullscreen_testsizes; i++) {
127 if((fullscreen_testsizes[i * 2] == xsize) &&
128 (fullscreen_testsizes[i * 2 + 1] == ysize))
135 store_accessibility_shortcut_keys() {
137 SystemParametersInfo(SPI_GETSTICKYKEYS,
sizeof(STICKYKEYS), &g_StartupStickyKeys, 0);
138 SystemParametersInfo(SPI_GETTOGGLEKEYS,
sizeof(TOGGLEKEYS), &g_StartupToggleKeys, 0);
139 SystemParametersInfo(SPI_GETFILTERKEYS,
sizeof(FILTERKEYS), &g_StartupFilterKeys, 0);
144 allow_accessibility_shortcut_keys(
bool allowKeys) {
149 SystemParametersInfo(SPI_SETSTICKYKEYS,
sizeof(STICKYKEYS), &g_StartupStickyKeys, 0);
150 SystemParametersInfo(SPI_SETTOGGLEKEYS,
sizeof(TOGGLEKEYS), &g_StartupToggleKeys, 0);
151 SystemParametersInfo(SPI_SETFILTERKEYS,
sizeof(FILTERKEYS), &g_StartupFilterKeys, 0);
156 STICKYKEYS skOff = g_StartupStickyKeys;
157 if( (skOff.dwFlags & SKF_STICKYKEYSON) == 0 )
160 skOff.dwFlags &= ~SKF_HOTKEYACTIVE;
161 skOff.dwFlags &= ~SKF_CONFIRMHOTKEY;
163 SystemParametersInfo(SPI_SETSTICKYKEYS,
sizeof(STICKYKEYS), &skOff, 0);
166 TOGGLEKEYS tkOff = g_StartupToggleKeys;
167 if( (tkOff.dwFlags & TKF_TOGGLEKEYSON) == 0 )
170 tkOff.dwFlags &= ~TKF_HOTKEYACTIVE;
171 tkOff.dwFlags &= ~TKF_CONFIRMHOTKEY;
173 SystemParametersInfo(SPI_SETTOGGLEKEYS,
sizeof(TOGGLEKEYS), &tkOff, 0);
176 FILTERKEYS fkOff = g_StartupFilterKeys;
177 if( (fkOff.dwFlags & FKF_FILTERKEYSON) == 0 )
180 fkOff.dwFlags &= ~FKF_HOTKEYACTIVE;
181 fkOff.dwFlags &= ~FKF_CONFIRMHOTKEY;
183 SystemParametersInfo(SPI_SETFILTERKEYS,
sizeof(FILTERKEYS), &fkOff, 0);
190 int TempGridZoneManager::
191 add_grid_zone(
unsigned int x,
195 unsigned int zoneBase,
196 unsigned int xZoneResolution,
197 unsigned int yZoneResolution) {
201 cerr<<
"adding grid zone with a zoneBase of "<<zoneBase<<
" and a zoneResolution of "<<zoneResolution;
202 _grids.append(TempGridZoneManager::GridZone(x, y, width, height, zoneBase, xZoneResolution, yZoneResolution));
203 return zoneBase+xZoneResolution*yZoneResolution;
206 void TempGridZoneManager::GridZone
207 GridZone(
unsigned int x,
211 unsigned int zoneBase,
212 unsigned int xZoneResolution,
213 unsigned int yZoneResolution) {
219 _xZoneResolution=xZoneResolution;
220 _yZoneResolution=yZoneResolution;
225 const float cellVis=3.0;
226 unsigned int xMargine=(
unsigned int)((
float)width/(float)xZoneResolution*cellVis+0.5);
227 unsigned int yMargine=(
unsigned int)((
float)height/(float)yZoneResolution*cellVis+0.5);
230 _xMaxVis=x+width+xMargine;
231 _yMaxVis=y+height+yMargine;
234 void TempGridZoneManager::
235 get_grids(
int x,
int y) {
236 TempGridZoneManager::ZoneSet canSee;
237 TempGridZoneManager::GridSet::const_iterator i=_grids.begin();
238 for (; i!=_grids.end(); ++i) {
239 if (x >= i._xMinVis && x < i._xMaxVis && y >= i._yMinVis && y < i._yMaxVis) {
240 add_to_zone_list(i, x, y, canSee);
245 void TempGridZoneManager::
246 add_to_zone_list(
const TempGridZoneManager::GridZone &gridZone,
249 TempGridZoneManager::ZoneSet &zoneSet) {
250 unsigned int xRes=gridZone._xZoneResolution;
251 unsigned int yRes=gridZone._yZoneResolution;
252 float xP=((float)(x-gridZone._x))/gridZone._width;
253 float yP=((
float)(y-gridZone._y))/gridZone._height;
254 int xCell=(int)(xP*xRes);
255 int yCell=(int)(yP*yRes);
259 int yBegin=max(0, yCell-range);
260 int yEnd=min(yRes, yCell+range);
261 int xBegin=max(0, xCell-range);
262 int xEnd=min(xRes, xCell+range);
263 unsigned int zone=gridZone._zoneBase+yBegin*xRes+xBegin;
265 for (yCell=yBegin; yCell < yEnd; ++yCell) {
266 for (xCell=xBegin; xCell < xEnd; ++xCell) {
267 zoneSet.append(zone+xCell);
273 int TempGridZoneManager::
274 get_zone_list(
int x,
int y,
int resolution) {
282 if (x < 0.0 || x > 1.0 || y < 0.0 || y > 1.0) {
285 cerr<<
"resolution="<<resolution;
286 xCell=min(
int(x*resolution), resolution-1)
287 yCell=min(
int(y*resolution), resolution-1)
288 cell=yCell*resolution+xCell
293 zone=zone-2*resolution
294 endZone=zone+5*resolution
296 while zone < endZone:
297 if yCell >= 0 and yCell < resolution:
299 zoneList.append(zone-2)
300 zoneList.append(zone-1)
302 zoneList.append(zone-1)
304 if xCell < resolution-2:
305 zoneList.append(zone+1)
306 zoneList.append(zone+2)
307 elif xCell < resolution-1:
308 zoneList.append(zone+1)
This is similar to a ConfigVariableList, but it returns its list as a DSearchPath, as a list of directories.
This class emulates the old dconfig-style interface to our Panda config system.
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
virtual int verify_window_sizes(int numsizes, int *dimen)
Determines which of the indicated window sizes are supported by available hardware (e...