diff options
author | Mattias Andrée <maandree@kth.se> | 2021-03-02 18:11:58 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-03-02 18:11:58 +0100 |
commit | d615f10762649507aebee9419147246bb1dc2a93 (patch) | |
tree | 4b3196b0bb70b6be4dd720c4be533517634b7f7e /src/lib/fake-w32-gdi.h | |
parent | X RAndR: Fix connection failure detection (diff) | |
download | libgamma-d615f10762649507aebee9419147246bb1dc2a93.tar.gz libgamma-d615f10762649507aebee9419147246bb1dc2a93.tar.bz2 libgamma-d615f10762649507aebee9419147246bb1dc2a93.tar.xz |
Change license + change style + misc
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | src/lib/fake-w32-gdi.h | 189 |
1 files changed, 85 insertions, 104 deletions
diff --git a/src/lib/fake-w32-gdi.h b/src/lib/fake-w32-gdi.h index 9462afe..bcc2fa9 100644 --- a/src/lib/fake-w32-gdi.h +++ b/src/lib/fake-w32-gdi.h @@ -1,20 +1,4 @@ -/** - * libgamma -- Display server abstraction layer for gamma ramp adjustments - * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org) - * - * This library is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this library. If not, see <http://www.gnu.org/licenses/>. - */ +/* See LICENSE file for copyright and license details. */ #ifndef LIBGAMMA_FAKE_W32_GDI_H #define LIBGAMMA_FAKE_W32_GDI_H @@ -23,7 +7,7 @@ #endif -#ifndef __GCC__ +#ifndef __GNUC__ # define __attribute__(x) #endif @@ -31,64 +15,64 @@ /** - * One of the Windows `typedef`:s for unsigned 16-bit integer. - * This is the one used in these functions. + * One of the Windows `typedef`:s for unsigned 16-bit integer + * This is the one used in these functions * * @see http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx#WORD */ typedef uint16_t WORD; /** - * One of the Windows `typedef`:s for unsigned 32-bit integer. - * This is the one used in these functions. + * One of the Windows `typedef`:s for unsigned 32-bit integer + * This is the one used in these functions * * @see http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx#DWORD */ -typedef uint32_t DWORD ; -/* XXX Documented to be 32-bit but defined as `typedef unsigned long DWORD`, which is it? */ +typedef uint32_t DWORD; /** - * One of the Windows `typedef` for booleanic values, the `int` variant. + * One of the Windows `typedef` for booleanic values, the `int` variant * * @see http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx#BOOL */ typedef int BOOL; /** - * Windows `typedef` for a device context (the 'h' stands for 'handle'.) + * Windows `typedef` for a device context (the 'h' stands for 'handle') * * @see http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx#HDC */ -typedef void* HDC; +typedef void *HDC; /** - * Windows `typedef` for a window (the 'h' stands for 'handle'.) + * Windows `typedef` for a window (the 'h' stands for 'handle') * * @see http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx#HWND */ -typedef void* HWND; +typedef void *HWND; /** - * One of the Windows `typedef`:s for `void*`, a generic pointer. + * One of the Windows `typedef`:s for `void *`, a generic pointer * * @see http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx#LPVOID */ -typedef void* LPVOID; +typedef void *LPVOID; /** - * A silly Windows `typedef` for a `const char*`, a constant string. + * A silly Windows `typedef` for a `const char *`, a constant string + * * It is also defined as NUL-terminated, but so are all C-strings * and it makes no difference. However if `UNICODE` were to be defined - * it would be `const wchar_t*`. + * it would be `const wchar_t *`. * * @see http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx#LPCTSTR */ -typedef const char* LPCTSTR; +typedef const char *LPCTSTR; /** * Even more silly. A Windows `typedef` for either `wchar_t` or - * `char`, depending on whether `UNICODE` is defined. We will - * assume `UNICODE` is not definied because that is just silly. + * `char`, depending on whether `UNICODE` is defined (we will + * assume `UNICODE` is not definied because that is just silly) * * @see http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx#TCHAR */ @@ -100,7 +84,7 @@ typedef char TCHAR; * * @see http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx#BOOL */ -#define TRUE 1 +#define TRUE 1 /** * Apperently we need `FALSE` to be defined to understand code, @@ -113,35 +97,35 @@ typedef char TCHAR; /** - * Get the device context for a window or the entire screen. + * Get the device context for a window or the entire screen * - * @param hWnd The window, `NULL` for the entire screen. - * @return The device context. + * @param hWnd The window, `NULL` for the entire screen + * @return The device context * @see http://msdn.microsoft.com/en-us/library/windows/desktop/dd144871(v=vs.85).aspx */ -HDC GetDC(HWND hWnd); +HDC GetDC(HWND); /** - * Free a device context. + * Free a device context * - * @param hWnd The window whose device context is `hDC`, `NULL` for the entire screen. - * @param hDC The device context to free. - * @return Whether the call was successful. + * @param hWnd The window whose device context is `hDC`, `NULL` for the entire screen + * @param hDC The device context to free + * @return Whether the call was successful * @see http://msdn.microsoft.com/en-us/library/windows/desktop/dd162920(v=vs.85).aspx */ -int ReleaseDC(HWND hWnd, HDC hDC); +int ReleaseDC(HWND, HDC); /** - * Get information (capabilities) for a device context. + * Get information (capabilities) for a device context * - * @param hDC The device context. - * @param nIndex The information to retrieve, may be `COLORMGMTCAPS`. + * @param hDC The device context + * @param nIndex The information to retrieve, may be `COLORMGMTCAPS` * @return The details of the queried information, can return `CM_GAMMA_RAMP` - * if `nIndex` is `COLORMGMTCAPS`. + * if `nIndex` is `COLORMGMTCAPS` * @see http://msdn.microsoft.com/en-us/library/windows/desktop/dd144877(v=vs.85).aspx */ -int GetDeviceCaps(HDC hDC, int nIndex) __attribute__((const)); +int GetDeviceCaps(HDC, int) __attribute__((const)); /** * Colour management capabilities @@ -159,45 +143,45 @@ int GetDeviceCaps(HDC hDC, int nIndex) __attribute__((const)); /** - * Set the gamma ramps for a device. + * Set the gamma ramps for a device * - * @param hDC The device context. - * @param lpRamp The gamma ramps joined in the order: red, green, blue. - * This is a `WORD*` casted to `void*`. - * @return Whether the call was successful. + * @param hDC The device context + * @param lpRamp The gamma ramps joined in the order: red, green, blue; + * this is a `WORD *` casted to `void *` + * @return Whether the call was successful * @see http://msdn.microsoft.com/en-us/library/windows/desktop/dd372194(v=vs.85).aspx */ -BOOL SetDeviceGammaRamp(HDC hDC, LPVOID restrict lpRamp); +BOOL SetDeviceGammaRamp(HDC, LPVOID restrict); /** - * Get the current gamma ramps for a device. + * Get the current gamma ramps for a device * - * @param hDC The device context. - * @param lpRamp The output for the gamma ramps joined in the order: red, green, blue. - * This is a `WORD*` casted to `void*`. - * @return Whether the call was successful. + * @param hDC The device context + * @param lpRamp The output for the gamma ramps joined in the order: red, green, blue + * This is a `WORD *` casted to `void *` + * @return Whether the call was successful * @see http://msdn.microsoft.com/en-us/library/windows/desktop/dd316946(v=vs.85).aspx */ -BOOL GetDeviceGammaRamp(HDC hDC, LPVOID restrict lpRamp); +BOOL GetDeviceGammaRamp(HDC, LPVOID restrict); /** * Get the context for a device * - * @param lpszDriver The driver or a display device, use "DISPLAY" if you want a display. + * @param lpszDriver The driver or a display device, use "DISPLAY" if you want a display * @param lpszDevice The name of the device. If you want a display use can use the member * name `DeviceName` in the third parameter, an output parameter, of * `EnumDisplayDevices`. - * @param lpszOutput We will always use `NULL` here. - * @param lpInitData We will always use `NULL` here. This should actually by a `const DEVMODE*`. - * @return The context for the device. + * @param lpszOutput We will always use `NULL` here + * @param lpInitData We will always use `NULL` here; this should actually by a `const DEVMODE *` + * @return The context for the device * @see http://msdn.microsoft.com/en-us/library/windows/desktop/dd183490(v=vs.85).aspx */ -HDC CreateDC(LPCTSTR restrict lpszDriver, LPCTSTR restrict lpszDevice, - LPCTSTR restrict lpszOutput, const void* restrict lpInitData); +HDC CreateDC(LPCTSTR restrict, LPCTSTR restrict, LPCTSTR restrict, const void *restrict); /** - * This macro does not seem to have an official documentation that is correct. + * This macro does not seem to have an official documentation that is correct + * * @see http://msdn.microsoft.com/en-us/library/windows/desktop/dd183490(v=vs.85).aspx * @see http://msdn.microsoft.com/en-us/library/windows/desktop/dd374074(v=vs.85).aspx */ @@ -205,63 +189,60 @@ HDC CreateDC(LPCTSTR restrict lpszDriver, LPCTSTR restrict lpszDevice, /** - * Information about a display device. + * Information about a display device * * @see http://msdn.microsoft.com/en-us/library/windows/desktop/dd183569(v=vs.85).aspx */ -typedef struct -{ - /** - * Set this to `sizeof(DISPLAY_DEVICE)`. - */ - DWORD cb; - - /** - * The name of the device. - */ - TCHAR DeviceName[32]; - - /** - * The status of the device, can include `DISPLAY_DEVICE_ACTIVE`. - */ - DWORD StateFlags; - +typedef struct { + /** + * Set this to `sizeof(DISPLAY_DEVICE)` + */ + DWORD cb; + + /** + * The name of the device + */ + TCHAR DeviceName[32]; + + /** + * The status of the device, can include `DISPLAY_DEVICE_ACTIVE` + */ + DWORD StateFlags; + } DISPLAY_DEVICE; /** * Appearently we are incapable of putting asterisks at the - * end of types names, so istead we preprend them with 'P'. + * end of types names, so istead we preprend them with 'P' * - * @see http://msdn.microsoft.com/en-us/library/windows/desktop/dd183569(v=vs.85).aspx + * @see http://msdn.microsoft.com/en-us/library/windows/desktop/dd183569(v=vs.85).aspx */ -typedef DISPLAY_DEVICE* PDISPLAY_DEVICE; +typedef DISPLAY_DEVICE *PDISPLAY_DEVICE; /** - * The monitor is "on". + * The monitor is "on" * - * @see http://msdn.microsoft.com/en-us/library/windows/desktop/dd183569(v=vs.85).aspx + * @see http://msdn.microsoft.com/en-us/library/windows/desktop/dd183569(v=vs.85).aspx */ #define DISPLAY_DEVICE_ACTIVE 1 /** - * Get a display device by its name or index. + * Get a display device by its name or index * - * @param lpDevice The name of the device, use `NULL` to base the call on `iDevNum` instead. - * @param iDevNum The index of the device. - * @param lpDisplayDevice Output for the found device. - * @param dwFlags Flags, we will always use zero. - * @return Whether the call was successful. Zero is also returned if `iDevNum` - * is greater than the largest device index on the system. + * @param lpDevice The name of the device, use `NULL` to base the call on `iDevNum` instead + * @param iDevNum The index of the device + * @param lpDisplayDevice Output for the found device + * @param dwFlags Flags, we will always use zero + * @return Whether the call was successful; zero is also returned if `iDevNum` + * is greater than the largest device index on the system * @see http://msdn.microsoft.com/en-us/library/windows/desktop/dd162609(v=vs.85).aspx */ -BOOL EnumDisplayDevices(LPCTSTR restrict lpDevice, DWORD iDevNum, - PDISPLAY_DEVICE restrict lpDisplayDevice, DWORD dwFlags); +BOOL EnumDisplayDevices(LPCTSTR restrict, DWORD, PDISPLAY_DEVICE restrict, DWORD) -#ifndef __GCC__ +#ifndef __GNUC__ # undef __attribute__ #endif #endif - |