android/GlueIOIOPort: fix spurious errors after IOIO baud rate change
[xcsoar.git] / test / src / DebugDisplay.cpp
blob6d3d2230f2a4e63b368b8778576ee7fa8e4793bf
1 /*
2 Copyright_License {
4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "Hardware/Display.hpp"
26 #ifdef WIN32
27 #include <windows.h>
28 #endif
30 #include <cstdio>
32 static void
33 PrintScreenSize()
35 #ifdef WIN32
36 unsigned width = GetSystemMetrics(SM_CXSCREEN);
37 unsigned height = GetSystemMetrics(SM_CYSCREEN);
38 printf("Width: %d px | Height: %d px\n", width, height);
39 #endif
42 static void
43 PrintDPI()
45 printf("DPI X: %d | DPI Y: %d\n", Display::GetXDPI(), Display::GetYDPI());
48 static void
49 PrintRotationInfo()
51 #if defined(DM_DISPLAYORIENTATION) && defined(_WIN32_WCE) && _WIN32_WCE >= 0x400
52 DEVMODE dm;
53 memset(&dm, 0, sizeof(dm));
54 dm.dmSize = sizeof(dm);
55 dm.dmFields = DM_DISPLAYQUERYORIENTATION;
57 if (ChangeDisplaySettingsEx(NULL, &dm, NULL, CDS_TEST, NULL)
58 != DISP_CHANGE_SUCCESSFUL) {
59 printf("Display Rotation not supported\n");
60 return;
63 printf("Display Rotation supported\n");
65 DWORD dwSupported = dm.dmDisplayOrientation;
67 printf("Supported Orientations: 0");
68 if (DMDO_90 & dwSupported)
69 printf(" 90");
70 if (DMDO_180 & dwSupported)
71 printf(" 180");
72 if (DMDO_270 & dwSupported)
73 printf(" 270");
74 printf(" deg\n");
76 dm.dmFields = DM_DISPLAYORIENTATION;
77 if (ChangeDisplaySettingsEx(NULL, &dm, NULL, CDS_TEST, NULL)
78 != DISP_CHANGE_SUCCESSFUL) {
79 printf("Current Display Rotation not available\n");
80 return;
83 printf("Current Display Rotation: ");
84 if (dm.dmDisplayOrientation == DMDO_0)
85 printf("0 deg");
86 else if (dm.dmDisplayOrientation == DMDO_90)
87 printf("90 deg");
88 else if (dm.dmDisplayOrientation == DMDO_180)
89 printf("180 deg");
90 else if (dm.dmDisplayOrientation == DMDO_270)
91 printf("270 deg");
92 else
93 printf("unknown");
94 printf("\n");
95 #endif
98 int
99 main(int argc, char **argv)
101 printf("Display Information\n\n");
103 PrintScreenSize();
104 PrintDPI();
105 PrintRotationInfo();
107 #ifdef _WIN32_WCE
108 // Console on WinCE is closing automatically
109 // We prevent this by requesting user input
110 getchar();
111 #endif
113 return 0;