diff options
author | Joseph Herlant <herlantj@gmail.com> | 2018-05-01 23:39:33 -0700 |
---|---|---|
committer | Joseph Herlant <aerostitch@users.noreply.github.com> | 2018-05-01 23:56:56 -0700 |
commit | a9f61c26e31eca52b1bf1a444f6283bb26bc2391 (patch) | |
tree | 83071a810267c8d104dd155b770a87b0f8375e1e /navit/gui/win32 | |
parent | 24fc7cf03af08f140eec67001f279d68d8ff37a3 (diff) | |
download | navit-a9f61c26e31eca52b1bf1a444f6283bb26bc2391.tar.gz |
cleanup:general:Declaring war to control-M
Diffstat (limited to 'navit/gui/win32')
-rw-r--r-- | navit/gui/win32/ceglue.c | 154 | ||||
-rw-r--r-- | navit/gui/win32/ceglue.h | 32 |
2 files changed, 93 insertions, 93 deletions
diff --git a/navit/gui/win32/ceglue.c b/navit/gui/win32/ceglue.c index a0817f935..772eb782d 100644 --- a/navit/gui/win32/ceglue.c +++ b/navit/gui/win32/ceglue.c @@ -1,77 +1,77 @@ -#include <windows.h>
-#include "ceglue.h"
-
-BOOL FAR (*SHFullScreenPtr)(HWND hwnd, DWORD state) = NULL;
-
-void InitCeGlue (void)
-{
- HINSTANCE ayg = LoadLibraryW (TEXT ("aygshell.dll"));
- if (ayg != NULL) {
- SHFullScreenPtr = (BOOL (*)(HWND, DWORD))
- GetProcAddressW (ayg, TEXT ("SHFullScreen"));
- }
-}
-
-// code to turn of screen adopted from
-// http://msdn.microsoft.com/en-us/library/ms838354.aspx
-
-// GDI Escapes for ExtEscape()
-#define QUERYESCSUPPORT 8
-
-// The following are unique to CE
-#define GETVFRAMEPHYSICAL 6144
-#define GETVFRAMELEN 6145
-#define DBGDRIVERSTAT 6146
-#define SETPOWERMANAGEMENT 6147
-#define GETPOWERMANAGEMENT 6148
-
-
-typedef enum _VIDEO_POWER_STATE {
- VideoPowerOn = 1,
- VideoPowerStandBy,
- VideoPowerSuspend,
- VideoPowerOff
-} VIDEO_POWER_STATE, *PVIDEO_POWER_STATE;
-
-
-typedef struct _VIDEO_POWER_MANAGEMENT {
- ULONG Length;
- ULONG DPMSVersion;
- ULONG PowerState;
-} VIDEO_POWER_MANAGEMENT, *PVIDEO_POWER_MANAGEMENT;
-
-
-int CeEnableBacklight(int enable)
-{
- HDC gdc;
- int iESC=SETPOWERMANAGEMENT;
-
- gdc = GetDC(NULL);
- if (ExtEscape(gdc, QUERYESCSUPPORT, sizeof(int), (LPCSTR)&iESC,
- 0, NULL)==0)
- {
- MessageBox(NULL,
- L"Sorry, your Pocket PC does not support DisplayOff",
- L"Pocket PC Display Off Feature",
- MB_OK);
- ReleaseDC(NULL, gdc);
- return FALSE;
- }
- else
- {
- VIDEO_POWER_MANAGEMENT vpm;
- vpm.Length = sizeof(VIDEO_POWER_MANAGEMENT);
- vpm.DPMSVersion = 0x0001;
- if (enable) {
- vpm.PowerState = VideoPowerOn;
- } else {
- vpm.PowerState = VideoPowerOff;
- }
- // Power off the display
- ExtEscape(gdc, SETPOWERMANAGEMENT, vpm.Length, (LPCSTR) &vpm,
- 0, NULL);
- ReleaseDC(NULL, gdc);
- return TRUE;
- }
-}
-
+#include <windows.h> +#include "ceglue.h" + +BOOL FAR (*SHFullScreenPtr)(HWND hwnd, DWORD state) = NULL; + +void InitCeGlue (void) +{ + HINSTANCE ayg = LoadLibraryW (TEXT ("aygshell.dll")); + if (ayg != NULL) { + SHFullScreenPtr = (BOOL (*)(HWND, DWORD)) + GetProcAddressW (ayg, TEXT ("SHFullScreen")); + } +} + +// code to turn of screen adopted from +// http://msdn.microsoft.com/en-us/library/ms838354.aspx + +// GDI Escapes for ExtEscape() +#define QUERYESCSUPPORT 8 + +// The following are unique to CE +#define GETVFRAMEPHYSICAL 6144 +#define GETVFRAMELEN 6145 +#define DBGDRIVERSTAT 6146 +#define SETPOWERMANAGEMENT 6147 +#define GETPOWERMANAGEMENT 6148 + + +typedef enum _VIDEO_POWER_STATE { + VideoPowerOn = 1, + VideoPowerStandBy, + VideoPowerSuspend, + VideoPowerOff +} VIDEO_POWER_STATE, *PVIDEO_POWER_STATE; + + +typedef struct _VIDEO_POWER_MANAGEMENT { + ULONG Length; + ULONG DPMSVersion; + ULONG PowerState; +} VIDEO_POWER_MANAGEMENT, *PVIDEO_POWER_MANAGEMENT; + + +int CeEnableBacklight(int enable) +{ + HDC gdc; + int iESC=SETPOWERMANAGEMENT; + + gdc = GetDC(NULL); + if (ExtEscape(gdc, QUERYESCSUPPORT, sizeof(int), (LPCSTR)&iESC, + 0, NULL)==0) + { + MessageBox(NULL, + L"Sorry, your Pocket PC does not support DisplayOff", + L"Pocket PC Display Off Feature", + MB_OK); + ReleaseDC(NULL, gdc); + return FALSE; + } + else + { + VIDEO_POWER_MANAGEMENT vpm; + vpm.Length = sizeof(VIDEO_POWER_MANAGEMENT); + vpm.DPMSVersion = 0x0001; + if (enable) { + vpm.PowerState = VideoPowerOn; + } else { + vpm.PowerState = VideoPowerOff; + } + // Power off the display + ExtEscape(gdc, SETPOWERMANAGEMENT, vpm.Length, (LPCSTR) &vpm, + 0, NULL); + ReleaseDC(NULL, gdc); + return TRUE; + } +} + diff --git a/navit/gui/win32/ceglue.h b/navit/gui/win32/ceglue.h index b0dc79d42..bb185dbed 100644 --- a/navit/gui/win32/ceglue.h +++ b/navit/gui/win32/ceglue.h @@ -1,16 +1,16 @@ -#ifndef CEGLUE_H
-#define CEGLUE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern BOOL (*SHFullScreenPtr)(HWND hwnd, DWORD state);
-void InitCeGlue (void);
-
-int CeEnableBacklight(int enable);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+#ifndef CEGLUE_H +#define CEGLUE_H +#ifdef __cplusplus +extern "C" { +#endif + +extern BOOL (*SHFullScreenPtr)(HWND hwnd, DWORD state); +void InitCeGlue (void); + +int CeEnableBacklight(int enable); + +#ifdef __cplusplus +} +#endif + +#endif |