@@ -35,12 +35,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
35
35
#include < unistd.h>
36
36
#include < sys/utsname.h>
37
37
#endif
38
-
38
+ #if defined(__hpux)
39
+ #define _PSTAT64
40
+ #include < sys/pstat.h>
41
+ #endif
39
42
#if !defined(_WIN32) && !defined(__APPLE__) && \
40
43
!defined(__ANDROID__) && !defined(SERVER)
41
44
#define XORG_USED
42
45
#endif
43
-
44
46
#ifdef XORG_USED
45
47
#include < X11/Xlib.h>
46
48
#include < X11/Xutil.h>
@@ -99,39 +101,29 @@ void signal_handler_init(void)
99
101
#else // _WIN32
100
102
#include < signal.h>
101
103
102
- BOOL WINAPI event_handler (DWORD sig)
103
- {
104
- switch (sig)
105
- {
106
- case CTRL_C_EVENT:
107
- case CTRL_CLOSE_EVENT:
108
- case CTRL_LOGOFF_EVENT:
109
- case CTRL_SHUTDOWN_EVENT:
110
-
111
- if (g_killed == false )
112
- {
113
- dstream<<DTIME<<" INFO: event_handler(): "
114
- <<" Ctrl+C, Close Event, Logoff Event or Shutdown Event, shutting down." <<std::endl;
115
- // Comment out for less clutter when testing scripts
116
- /* dstream<<DTIME<<"INFO: event_handler(): "
117
- <<"Printing debug stacks"<<std::endl;
118
- debug_stacks_print();*/
119
-
120
- g_killed = true ;
121
- }
122
- else
123
- {
124
- (void )signal (SIGINT, SIG_DFL);
125
- }
126
-
127
- break ;
128
- case CTRL_BREAK_EVENT:
129
- break ;
104
+ BOOL WINAPI event_handler (DWORD sig)
105
+ {
106
+ switch (sig) {
107
+ case CTRL_C_EVENT:
108
+ case CTRL_CLOSE_EVENT:
109
+ case CTRL_LOGOFF_EVENT:
110
+ case CTRL_SHUTDOWN_EVENT:
111
+ if (g_killed == false ) {
112
+ dstream << DTIME << " INFO: event_handler(): "
113
+ << " Ctrl+C, Close Event, Logoff Event or Shutdown Event,"
114
+ " shutting down." << std::endl;
115
+ g_killed = true ;
116
+ } else {
117
+ (void )signal (SIGINT, SIG_DFL);
130
118
}
131
-
132
- return TRUE ;
119
+ break ;
120
+ case CTRL_BREAK_EVENT:
121
+ break ;
133
122
}
134
123
124
+ return TRUE ;
125
+ }
126
+
135
127
void signal_handler_init (void )
136
128
{
137
129
SetConsoleCtrlHandler ( (PHANDLER_ROUTINE)event_handler,TRUE );
@@ -143,7 +135,8 @@ void signal_handler_init(void)
143
135
/*
144
136
Multithreading support
145
137
*/
146
- int getNumberOfProcessors () {
138
+ int getNumberOfProcessors ()
139
+ {
147
140
#if defined(_SC_NPROCESSORS_ONLN)
148
141
149
142
return sysconf (_SC_NPROCESSORS_ONLN);
@@ -177,7 +170,8 @@ int getNumberOfProcessors() {
177
170
178
171
179
172
#ifndef __ANDROID__
180
- bool threadBindToProcessor (threadid_t tid, int pnumber) {
173
+ bool threadBindToProcessor (threadid_t tid, int pnumber)
174
+ {
181
175
#if defined(_WIN32)
182
176
183
177
HANDLE hThread = OpenThread (THREAD_ALL_ACCESS, 0 , tid);
@@ -201,7 +195,7 @@ bool threadBindToProcessor(threadid_t tid, int pnumber) {
201
195
#elif defined(__sun) || defined(sun)
202
196
203
197
return processor_bind (P_LWPID, MAKE_LWPID_PTHREAD (tid),
204
- pnumber, NULL ) == 0 ;
198
+ pnumber, NULL ) == 0 ;
205
199
206
200
#elif defined(_AIX)
207
201
@@ -212,7 +206,7 @@ bool threadBindToProcessor(threadid_t tid, int pnumber) {
212
206
pthread_spu_t answer;
213
207
214
208
return pthread_processor_bind_np (PTHREAD_BIND_ADVISORY_NP,
215
- &answer, pnumber, tid) == 0 ;
209
+ &answer, pnumber, tid) == 0 ;
216
210
217
211
#elif defined(__APPLE__)
218
212
@@ -221,7 +215,7 @@ bool threadBindToProcessor(threadid_t tid, int pnumber) {
221
215
thread_port_t threadport = pthread_mach_thread_np (tid);
222
216
tapol.affinity_tag = pnumber + 1 ;
223
217
return thread_policy_set (threadport, THREAD_AFFINITY_POLICY,
224
- (thread_policy_t )&tapol, THREAD_AFFINITY_POLICY_COUNT) == KERN_SUCCESS;
218
+ (thread_policy_t )&tapol, THREAD_AFFINITY_POLICY_COUNT) == KERN_SUCCESS;
225
219
226
220
#else
227
221
@@ -231,7 +225,8 @@ bool threadBindToProcessor(threadid_t tid, int pnumber) {
231
225
}
232
226
#endif
233
227
234
- bool threadSetPriority (threadid_t tid, int prio) {
228
+ bool threadSetPriority (threadid_t tid, int prio)
229
+ {
235
230
#if defined(_WIN32)
236
231
237
232
HANDLE hThread = OpenThread (THREAD_ALL_ACCESS, 0 , tid);
@@ -286,14 +281,14 @@ void pathRemoveFile(char *path, char delim)
286
281
path[i] = 0 ;
287
282
}
288
283
289
- bool detectMSVCBuildDir (char *c_path )
284
+ bool detectMSVCBuildDir (const std::string &path )
290
285
{
291
- std::string path (c_path);
292
286
const char *ends[] = {
293
287
" bin\\ Release" ,
294
288
" bin\\ Debug" ,
295
289
" bin\\ Build" ,
296
- NULL };
290
+ NULL
291
+ };
297
292
return (removeStringEnd (path, ends) != " " );
298
293
}
299
294
@@ -333,224 +328,322 @@ std::string get_sysinfo()
333
328
#endif
334
329
}
335
330
336
- void initializePaths ()
331
+
332
+ bool getCurrentWorkingDir (char *buf, size_t len)
337
333
{
338
- #if RUN_IN_PLACE
339
- /*
340
- Use relative paths if RUN_IN_PLACE
341
- */
334
+ #ifdef _WIN32
335
+ DWORD ret = GetCurrentDirectory (len, buf);
336
+ return (ret != 0 ) && (ret <= len);
337
+ #else
338
+ return getcwd (buf, len);
339
+ #endif
340
+ }
342
341
343
- infostream<<" Using relative paths (RUN_IN_PLACE)" <<std::endl;
344
342
345
- /*
346
- Windows
347
- */
348
- # if defined(_WIN32)
343
+ bool getExecPathFromProcfs ( char *buf, size_t buflen)
344
+ {
345
+ # ifndef _WIN32
346
+ buflen--;
349
347
350
- const DWORD buflen = 1000 ;
351
- char buf[buflen];
352
- DWORD len;
348
+ ssize_t len;
349
+ if ((len = readlink (" /proc/self/exe" , buf, buflen)) == -1 &&
350
+ (len = readlink (" /proc/curproc/file" , buf, buflen)) == -1 &&
351
+ (len = readlink (" /proc/curproc/exe" , buf, buflen)) == -1 )
352
+ return false ;
353
353
354
- // Find path of executable and set path_share relative to it
355
- len = GetModuleFileName (GetModuleHandle (NULL ), buf, buflen);
356
- assert (len < buflen);
357
- pathRemoveFile (buf, ' \\ ' );
354
+ buf[len] = ' \0 ' ;
355
+ return true ;
356
+ #else
357
+ return false ;
358
+ #endif
359
+ }
358
360
359
- if (detectMSVCBuildDir (buf)){
360
- infostream<<" MSVC build directory detected" <<std::endl;
361
- path_share = std::string (buf) + " \\ ..\\ .." ;
362
- path_user = std::string (buf) + " \\ ..\\ .." ;
363
- }
364
- else {
365
- path_share = std::string (buf) + " \\ .." ;
366
- path_user = std::string (buf) + " \\ .." ;
367
- }
361
+ // // Windows
362
+ #if defined(_WIN32)
368
363
369
- /*
370
- Linux
371
- */
372
- #elif defined(linux) || defined(__linux)
364
+ bool getCurrentExecPath (char *buf, size_t len)
365
+ {
366
+ DWORD written = GetModuleFileNameA (NULL , buf, len);
367
+ if (written == 0 || written == len)
368
+ return false ;
373
369
374
- char buf[BUFSIZ];
375
- memset (buf, 0 , BUFSIZ);
376
- // Get path to executable
377
- FATAL_ERROR_IF (readlink (" /proc/self/exe" , buf, BUFSIZ-1 ) == -1 , " Failed to get cwd" );
370
+ return true ;
371
+ }
378
372
379
- pathRemoveFile (buf, ' /' );
380
373
381
- path_share = std::string (buf) + " /.." ;
382
- path_user = std::string (buf) + " /.." ;
374
+ // // Linux
375
+ #elif defined(linux) || defined(__linux) || defined(__linux__)
376
+
377
+ bool getCurrentExecPath (char *buf, size_t len)
378
+ {
379
+ if (!getExecPathFromProcfs (buf, len))
380
+ return false ;
383
381
384
- /*
385
- OS X
386
- */
387
- #elif defined(__APPLE__)
382
+ return true ;
383
+ }
388
384
389
- CFBundleRef main_bundle = CFBundleGetMainBundle ();
390
- CFURLRef resources_url = CFBundleCopyResourcesDirectoryURL (main_bundle);
391
- char path[PATH_MAX];
392
- if (CFURLGetFileSystemRepresentation (resources_url, TRUE , (UInt8 *)path, PATH_MAX)) {
393
- path_share = std::string (path);
394
- path_user = std::string (path) + " /../User" ;
395
- } else {
396
- dstream << " WARNING: Could not determine bundle resource path" << std::endl;
397
- }
398
- CFRelease (resources_url);
399
385
400
- /*
401
- FreeBSD
402
- */
403
- #elif defined(__FreeBSD__)
386
+ // // Mac OS X, Darwin
387
+ #elif defined(__APPLE__)
388
+
389
+ bool getCurrentExecPath (char *buf, size_t len)
390
+ {
391
+ if (_NSGetExecutablePath (buf, &len) == -1 )
Has a conversation. Original line has a conversation.
392
+ return false ;
393
+
394
+ return true ;
395
+ }
396
+
397
+
398
+ // // FreeBSD, NetBSD, DragonFlyBSD
399
+ #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
400
+
401
+ bool getCurrentExecPath (char *buf, size_t len)
402
+ {
403
+ // Try getting path from procfs first, since valgrind
404
+ // doesn't work with the latter
405
+ if (getExecPathFromProcfs (buf, len))
406
+ return true ;
404
407
405
408
int mib[4 ];
406
- char buf[BUFSIZ];
407
- size_t len = sizeof (buf);
408
409
409
410
mib[0 ] = CTL_KERN;
410
411
mib[1 ] = KERN_PROC;
411
412
mib[2 ] = KERN_PROC_PATHNAME;
412
413
mib[3 ] = -1 ;
413
- FATAL_ERROR_IF (sysctl (mib, 4 , buf, &len, NULL , 0 ) == -1 , " " );
414
414
415
- pathRemoveFile (buf, ' /' );
415
+ if (sysctl (mib, 4 , buf, &len, NULL , 0 ) == -1 )
416
+ return false ;
416
417
417
- path_share = std::string (buf) + " /.. " ;
418
- path_user = std::string (buf) + " /.. " ;
418
+ return true ;
419
+ }
419
420
420
- #else
421
421
422
- // TODO: Get path of executable. This assumes working directory is bin/
423
- dstream<<" WARNING: Relative path not properly supported on this platform"
424
- <<std::endl;
422
+ // // Solaris
423
+ #elif defined(__sun) || defined(sun)
425
424
426
- /* scriptapi no longer allows paths that start with "..", so assuming that
427
- the current working directory is bin/, strip off the last component. */
428
- char *cwd = getcwd (NULL , 0 );
429
- pathRemoveFile (cwd, ' /' );
430
- path_share = std::string (cwd);
431
- path_user = std::string (cwd);
425
+ bool getCurrentExecPath (char *buf, size_t len)
426
+ {
427
+ const char *exec = getexecname ();
428
+ if (exec == NULL )
429
+ return false ;
432
430
433
- #endif
431
+ if (strlcpy (buf, exec, len) >= len)
432
+ return false ;
433
+
434
+ return true ;
435
+ }
434
436
435
- #else // RUN_IN_PLACE
436
437
437
- /*
438
- Use platform-specific paths otherwise
439
- */
438
+ // HP-UX
439
+ #elif defined(__hpux)
440
440
441
- infostream<<" Using system-wide paths (NOT RUN_IN_PLACE)" <<std::endl;
441
+ bool getCurrentExecPath (char *buf, size_t len)
442
+ {
443
+ struct pst_status psts;
444
+
445
+ if (pstat_getproc (&psts, sizeof (psts), 0 , getpid ()) == -1 )
446
+ return false ;
442
447
443
- /*
444
- Windows
445
- */
446
- #if defined(_WIN32)
448
+ if (pstat_getpathname (buf, len, &psts.pst_fid_text ) == -1 )
449
+ return false ;
450
+
451
+ return true ;
452
+ }
447
453
448
- const DWORD buflen = 1000 ; // FIXME: Surely there is a better way to do this
449
- char buf[buflen];
450
- DWORD len;
454
+
455
+ #else
456
+
457
+ bool getCurrentExecPath (char *buf, size_t len)
458
+ {
459
+ return false ;
460
+ }
461
+
462
+ #endif
463
+
464
+
465
+ // // Windows
466
+ #if defined(_WIN32)
467
+
468
+ bool setSystemPaths ()
469
+ {
470
+ char buf[BUFSIZ];
451
471
452
472
// Find path of executable and set path_share relative to it
453
- len = GetModuleFileName ( GetModuleHandle ( NULL ), buf, buflen);
454
- FATAL_ERROR_IF (len >= buflen, " Overlow " );
473
+ FATAL_ERROR_IF (! getCurrentExecPath ( buf, sizeof (buf)),
474
+ " Failed to get current executable path " );
455
475
pathRemoveFile (buf, ' \\ ' );
456
476
457
477
// Use ".\bin\.."
458
478
path_share = std::string (buf) + " \\ .." ;
459
479
460
480
// Use "C:\Documents and Settings\user\Application Data\<PROJECT_NAME>"
461
- len = GetEnvironmentVariable (" APPDATA" , buf, buflen);
462
- FATAL_ERROR_IF (len >= buflen, " Overlow" );
481
+ DWORD len = GetEnvironmentVariable (" APPDATA" , buf, sizeof (buf));
482
+ FATAL_ERROR_IF (len == 0 || len > sizeof (buf), " Failed to get APPDATA" );
483
+
463
484
path_user = std::string (buf) + DIR_DELIM + lowercase (PROJECT_NAME);
485
+ return true ;
486
+ }
464
487
465
- /*
466
- Linux
467
- */
468
- #elif defined(linux) || defined(__linux)
469
488
470
- // Get path to executable
471
- std::string bindir = " " ;
472
- {
473
- char buf[BUFSIZ];
474
- memset (buf, 0 , BUFSIZ);
475
- if (readlink (" /proc/self/exe" , buf, BUFSIZ-1 ) == -1 ) {
476
- errorstream << " Unable to read bindir " << std::endl;
477
- #ifndef __ANDROID__
478
- FATAL_ERROR (" Unable to read bindir" );
489
+ // // Linux
490
+ #elif defined(linux) || defined(__linux)
491
+
492
+ bool setSystemPaths ()
493
+ {
494
+ char buf[BUFSIZ];
495
+
496
+ if (!getCurrentExecPath (buf, sizeof (buf))) {
497
+ #ifdef __ANDROID__
498
+ errorstream << " Unable to read bindir " << std::endl;
499
+ #else
500
+ FATAL_ERROR (" Unable to read bindir" );
479
501
#endif
480
- } else {
481
- pathRemoveFile (buf, ' /' );
482
- bindir = buf;
483
- }
502
+ return false ;
484
503
}
485
504
505
+ pathRemoveFile (buf, ' /' );
506
+ std::string bindir (buf);
507
+
486
508
// Find share directory from these.
487
509
// It is identified by containing the subdirectory "builtin".
488
510
std::list<std::string> trylist;
489
511
std::string static_sharedir = STATIC_SHAREDIR;
490
- if (static_sharedir != " " && static_sharedir != " ." )
512
+ if (static_sharedir != " " && static_sharedir != " ." )
491
513
trylist.push_back (static_sharedir);
492
- trylist.push_back (
493
- bindir + DIR_DELIM + " .." + DIR_DELIM + " share" + DIR_DELIM + lowercase (PROJECT_NAME));
494
- trylist.push_back (bindir + DIR_DELIM + " .." );
514
+
515
+ trylist.push_back (bindir + DIR_DELIM " .." DIR_DELIM " share"
516
+ DIR_DELIM + lowercase (PROJECT_NAME));
517
+ trylist.push_back (bindir + DIR_DELIM " .." );
518
+
495
519
#ifdef __ANDROID__
496
520
trylist.push_back (path_user);
497
521
#endif
498
522
499
- for (std::list<std::string>::const_iterator i = trylist.begin ();
500
- i != trylist.end (); i++)
501
- {
523
+ for (std::list<std::string>::const_iterator
524
+ i = trylist.begin (); i != trylist.end (); i++) {
502
525
const std::string &trypath = *i;
503
- if (!fs::PathExists (trypath) || !fs::PathExists (trypath + DIR_DELIM + " builtin" )){
504
- dstream<<" WARNING: system-wide share not found at \" "
505
- <<trypath<<" \" " <<std::endl;
526
+ if (!fs::PathExists (trypath) ||
527
+ !fs::PathExists (trypath + DIR_DELIM + " builtin" )) {
528
+ dstream << " WARNING: system-wide share not found at \" "
529
+ << trypath << " \" " << std::endl;
506
530
continue ;
507
531
}
532
+
508
533
// Warn if was not the first alternative
509
- if (i != trylist.begin ()){
510
- dstream<< " WARNING: system-wide share found at \" "
511
- <<trypath<< " \" " << std::endl;
534
+ if (i != trylist.begin ()) {
535
+ dstream << " WARNING: system-wide share found at \" "
536
+ << trypath << " \" " << std::endl;
512
537
}
538
+
513
539
path_share = trypath;
514
540
break ;
515
541
}
542
+
516
543
#ifndef __ANDROID__
517
- path_user = std::string (getenv (" HOME" )) + DIR_DELIM + " ." + lowercase (PROJECT_NAME);
544
+ path_user = std::string (getenv (" HOME" )) + DIR_DELIM " ."
545
+ + lowercase (PROJECT_NAME);
518
546
#endif
519
547
520
- /*
521
- OS X
522
- */
523
- #elif defined(__APPLE__)
548
+ return true ;
549
+ }
550
+
551
+
552
+ // // Mac OS X
553
+ #elif defined(__APPLE__)
524
554
555
+ bool setSystemPaths ()
556
+ {
525
557
CFBundleRef main_bundle = CFBundleGetMainBundle ();
526
558
CFURLRef resources_url = CFBundleCopyResourcesDirectoryURL (main_bundle);
527
559
char path[PATH_MAX];
528
- if (CFURLGetFileSystemRepresentation (resources_url, TRUE , (UInt8 *)path, PATH_MAX)) {
560
+ if (CFURLGetFileSystemRepresentation (resources_url,
561
+ TRUE , (UInt8 *)path, PATH_MAX)) {
529
562
path_share = std::string (path);
530
563
} else {
531
564
dstream << " WARNING: Could not determine bundle resource path" << std::endl;
532
565
}
533
566
CFRelease (resources_url);
534
567
535
- path_user = std::string (getenv (" HOME" )) + " /Library/Application Support/" + lowercase (PROJECT_NAME);
568
+ path_user = std::string (getenv (" HOME" ))
569
+ + " /Library/Application Support/"
570
+ + lowercase (PROJECT_NAME);
571
+ return true ;
572
+ }
573
+
536
574
537
- #else // FreeBSD, and probably many other POSIX-like systems.
575
+ #else
538
576
577
+ bool setSystemPaths ()
578
+ {
539
579
path_share = STATIC_SHAREDIR;
540
- path_user = std::string (getenv (" HOME" )) + DIR_DELIM + " ." + lowercase (PROJECT_NAME);
580
+ path_user = std::string (getenv (" HOME" )) + DIR_DELIM " ."
581
+ + lowercase (PROJECT_NAME);
582
+ return true ;
583
+ }
541
584
542
- #endif
543
585
544
- #endif // RUN_IN_PLACE
545
- }
586
+ #endif
546
587
547
- static irr::IrrlichtDevice *device;
548
588
549
- void initIrrlicht (irr::IrrlichtDevice *device_ )
589
+ void initializePaths ( )
550
590
{
551
- device = device_;
591
+ #if RUN_IN_PLACE
592
+ char buf[BUFSIZ];
593
+
594
+ infostream << " Using relative paths (RUN_IN_PLACE)" << std::endl;
595
+
596
+ bool success =
597
+ getCurrentExecPath (buf, sizeof (buf)) ||
598
+ getExecPathFromProcfs (buf, sizeof (buf));
599
+
600
+ if (success) {
601
+ pathRemoveFile (buf, ' /' );
602
+ std::string execpath (buf);
603
+
604
+ path_share = execpath + DIR_DELIM " .." ;
605
+ path_user = execpath + DIR_DELIM " .." ;
606
+
607
+ if (detectMSVCBuildDir (execpath)) {
608
+ path_share += DIR_DELIM " .." ;
609
+ path_user += DIR_DELIM " .." ;
610
+ }
611
+ } else {
612
+ errorstream << " Failed to get paths by executable location, "
613
+ " trying cwd" << std::endl;
614
+
615
+ if (!getCurrentWorkingDir (buf, sizeof (buf)))
616
+ FATAL_ERROR (" Ran out of methods to get paths" );
617
+
618
+ size_t cwdlen = strlen (buf);
619
+ if (cwdlen >= 1 && buf[cwdlen - 1 ] == DIR_DELIM_CHAR) {
620
+ cwdlen--;
621
+ buf[cwdlen] = ' \0 ' ;
622
+ }
623
+
624
+ if (cwdlen >= 4 && !strcmp (buf + cwdlen - 4 , DIR_DELIM " bin" ))
625
+ pathRemoveFile (buf, DIR_DELIM_CHAR);
626
+
627
+ std::string execpath (buf);
628
+
629
+ path_share = execpath;
630
+ path_user = execpath;
631
+ }
632
+
633
+ #else
634
+ infostream << " Using system-wide paths (NOT RUN_IN_PLACE)" << std::endl;
635
+
636
+ if (!setSystemPaths ())
637
+ errorstream << " Failed to get one or more system-wide path" << std::endl;
638
+
639
+ #endif
640
+
641
+ infostream << " Detected share path: " << path_share << std::endl;
642
+ infostream << " Detected user path: " << path_user << std::endl;
552
643
}
553
644
645
+
646
+
554
647
void setXorgClassHint (const video::SExposedVideoData &video_data,
555
648
const std::string &name)
556
649
{
@@ -568,8 +661,20 @@ void setXorgClassHint(const video::SExposedVideoData &video_data,
568
661
#endif
569
662
}
570
663
664
+
665
+ // //
666
+ // // Video/Display Information (Client-only)
667
+ // //
668
+
571
669
#ifndef SERVER
572
670
671
+ static irr::IrrlichtDevice *device;
672
+
673
+ void initIrrlicht (irr::IrrlichtDevice *device_)
674
+ {
675
+ device = device_;
676
+ }
677
+
573
678
v2u32 getWindowSize ()
574
679
{
575
680
return device->getVideoDriver ()->getScreenSize ();
@@ -641,9 +746,8 @@ const char *getVideoDriverFriendlyName(irr::video::E_DRIVER_TYPE type)
641
746
return driver_names[type];
642
747
}
643
748
644
-
645
- #ifndef __ANDROID__
646
- #ifdef XORG_USED
749
+ # ifndef __ANDROID__
750
+ # ifdef XORG_USED
647
751
648
752
static float calcDisplayDensity ()
649
753
{
@@ -679,12 +783,12 @@ float getDisplayDensity()
679
783
}
680
784
681
785
682
- #else
786
+ # else // XORG_USED
683
787
float getDisplayDensity ()
684
788
{
685
789
return g_settings->getFloat (" screen_dpi" )/96.0 ;
686
790
}
687
- #endif
791
+ # endif // XORG_USED
688
792
689
793
v2u32 getDisplaySize ()
690
794
{
@@ -695,8 +799,8 @@ v2u32 getDisplaySize()
695
799
696
800
return deskres;
697
801
}
698
- #endif
699
- #endif
802
+ # endif // __ANDROID__
803
+ #endif // SERVER
700
804
701
805
} // namespace porting
702
806