diff options
author | Campbell Barton <campbell@blender.org> | 2022-08-27 04:24:49 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-08-27 04:24:49 +0300 |
commit | 955032ffb0c5ca671b24d04bd45cc0f6604d66c6 (patch) | |
tree | ae525d0ec9294b06fdf036ffbd4476d9fcd9cd8c /intern/ghost | |
parent | 37d835f0bca28a7cbf577385d9828636e7811cc5 (diff) |
Cleanup: use C style comments for GHOST/Win32 text
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_DisplayManagerWin32.cpp | 52 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_DropTargetWin32.cpp | 46 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_ImeWin32.cpp | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_ImeWin32.h | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_NDOFManagerWin32.cpp | 6 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 241 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.h | 16 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWin32.cpp | 72 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWin32.h | 4 |
9 files changed, 219 insertions, 222 deletions
diff --git a/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp b/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp index 3d8920d7c52..ee79792bb7e 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp +++ b/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp @@ -11,8 +11,9 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> -// We do not support multiple monitors at the moment +/* We do not support multiple monitors at the moment. */ #define COMPILE_MULTIMON_STUBS + #include <multimon.h> GHOST_DisplayManagerWin32::GHOST_DisplayManagerWin32(void) @@ -31,16 +32,15 @@ static BOOL get_dd(DWORD d, DISPLAY_DEVICE *dd) return ::EnumDisplayDevices(NULL, d, dd, 0); } -/* - * When you call EnumDisplaySettings with iModeNum set to zero, the operating system - * initializes and caches information about the display device. When you call - * EnumDisplaySettings with iModeNum set to a non-zero value, the function returns - * the information that was cached the last time the function was called with iModeNum - * set to zero. - */ GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(uint8_t display, int32_t &numSettings) const { + /* When you call #EnumDisplaySettings with #iModeNum set to zero, the operating system + * initializes and caches information about the display device. + * When you call #EnumDisplaySettings with #iModeNum set to a non-zero value, + * the function returns the information that was cached the last time the + * function was called with #iModeNum set to zero. */ + DISPLAY_DEVICE display_device; if (!get_dd(display, &display_device)) return GHOST_kFailure; @@ -70,21 +70,20 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(uint8_t display, dm.dmPelsHeight, dm.dmBitsPerPel, dm.dmDisplayFrequency); -#endif // WITH_GHOST_DEBUG +#endif /* WITH_GHOST_DEBUG */ setting.xPixels = dm.dmPelsWidth; setting.yPixels = dm.dmPelsHeight; setting.bpp = dm.dmBitsPerPel; - /* When you call the EnumDisplaySettings function, the dmDisplayFrequency member + /* When you call the #EnumDisplaySettings function, the #dmDisplayFrequency member * may return with the value 0 or 1. These values represent the display hardware's * default refresh rate. This default rate is typically set by switches on a display * card or computer motherboard, or by a configuration program that does not use - * Win32 display functions such as ChangeDisplaySettings. - */ - /* First, we tried to explicitly set the frequency to 60 if EnumDisplaySettings + * Win32 display functions such as #ChangeDisplaySettings. */ + + /* First, we tried to explicitly set the frequency to 60 if #EnumDisplaySettings * returned 0 or 1 but this doesn't work since later on an exact match will * be searched. And this will never happen if we change it to 60. Now we rely - * on the default h/w setting. - */ + * on the default hardware setting. */ setting.frequency = dm.dmDisplayFrequency; success = GHOST_kSuccess; } @@ -117,22 +116,23 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting( break; } } - /* - * dm.dmBitsPerPel = match.bpp; - * dm.dmPelsWidth = match.xPixels; - * dm.dmPelsHeight = match.yPixels; - * dm.dmDisplayFrequency = match.frequency; - * dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY; - * dm.dmSize = sizeof(DEVMODE); - * dm.dmDriverExtra = 0; - */ +#if 0 + dm.dmBitsPerPel = match.bpp; + dm.dmPelsWidth = match.xPixels; + dm.dmPelsHeight = match.yPixels; + dm.dmDisplayFrequency = match.frequency; + dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY; + dm.dmSize = sizeof(DEVMODE); + dm.dmDriverExtra = 0; +#endif + #ifdef WITH_GHOST_DEBUG printf("display change: Requested settings:\n"); printf(" dmBitsPerPel=%d\n", dm.dmBitsPerPel); printf(" dmPelsWidth=%d\n", dm.dmPelsWidth); printf(" dmPelsHeight=%d\n", dm.dmPelsHeight); printf(" dmDisplayFrequency=%d\n", dm.dmDisplayFrequency); -#endif // WITH_GHOST_DEBUG +#endif /* WITH_GHOST_DEBUG */ LONG status = ::ChangeDisplaySettings(&dm, CDS_FULLSCREEN); #ifdef WITH_GHOST_DEBUG @@ -166,6 +166,6 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting( printf("display change: Return value invalid\n"); break; } -#endif // WITH_GHOST_DEBUG +#endif /* WITH_GHOST_DEBUG */ return status == DISP_CHANGE_SUCCESSFUL ? GHOST_kSuccess : GHOST_kFailure; } diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.cpp b/intern/ghost/intern/GHOST_DropTargetWin32.cpp index a82a31e7386..6f39947ae6d 100644 --- a/intern/ghost/intern/GHOST_DropTargetWin32.cpp +++ b/intern/ghost/intern/GHOST_DropTargetWin32.cpp @@ -13,9 +13,9 @@ #include "utfconv.h" #ifdef WITH_GHOST_DEBUG -// utility +/* utility */ void printLastError(void); -#endif // WITH_GHOST_DEBUG +#endif /* WITH_GHOST_DEBUG */ GHOST_DropTargetWin32::GHOST_DropTargetWin32(GHOST_WindowWin32 *window, GHOST_SystemWin32 *system) : m_window(window), m_system(system) @@ -83,7 +83,7 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragEnter(IDataObject *pDataObject, POINTL pt, DWORD *pdwEffect) { - // we accept all drop by default + /* We accept all drop by default. */ m_window->setAcceptDragOperation(true); *pdwEffect = DROPEFFECT_NONE; @@ -103,7 +103,7 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragOver(DWORD grfKeyState, POINTL pt, } else { *pdwEffect = DROPEFFECT_NONE; - // XXX Uncomment to test drop. Drop will not be called if pdwEffect == DROPEFFECT_NONE. + /* XXX Uncomment to test drop. Drop will not be called if `pdwEffect == DROPEFFECT_NONE`. */ // *pdwEffect = DROPEFFECT_COPY; } m_system->pushDragDropEvent( @@ -170,7 +170,7 @@ GHOST_TDragnDropTypes GHOST_DropTargetWin32::getGhostType(IDataObject *pDataObje return GHOST_kDragnDropTypeString; } - // Filesnames + /* Files-names. */ fmtetc.cfFormat = CF_HDROP; if (pDataObject->QueryGetData(&fmtetc) == S_OK) { return GHOST_kDragnDropTypeFilenames; @@ -195,7 +195,7 @@ void *GHOST_DropTargetWin32::getGhostData(IDataObject *pDataObject) default: #ifdef WITH_GHOST_DEBUG ::printf("\nGHOST_kDragnDropTypeUnknown"); -#endif // WITH_GHOST_DEBUG +#endif /* WITH_GHOST_DEBUG */ return NULL; break; } @@ -212,8 +212,8 @@ void *GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject *pDataObject) STGMEDIUM stgmed; HDROP hdrop; - // Check if dataobject supplies the format we want. - // Double checking here, first in getGhostType. + /* Check if dataobject supplies the format we want. + * Double checking here, first in getGhostType. */ if (pDataObject->QueryGetData(&fmtetc) == S_OK) { if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK) { hdrop = (HDROP)::GlobalLock(stgmed.hGlobal); @@ -233,14 +233,14 @@ void *GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject *pDataObject) if (!(temp_path = alloc_utf_8_from_16(fpath, 0))) { continue; } - // Just ignore paths that could not be converted verbatim. + /* Just ignore paths that could not be converted verbatim. */ strArray->strings[nvalid] = (uint8_t *)temp_path; strArray->count = nvalid + 1; nvalid++; } } - // Free up memory. + /* Free up memory. */ ::GlobalUnlock(stgmed.hGlobal); ::ReleaseStgMedium(&stgmed); @@ -256,8 +256,8 @@ void *GHOST_DropTargetWin32::getDropDataAsString(IDataObject *pDataObject) FORMATETC fmtetc = {CF_UNICODETEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; STGMEDIUM stgmed; - // Try unicode first. - // Check if dataobject supplies the format we want. + /* Try unicode first. + * Check if dataobject supplies the format we want. */ if (pDataObject->QueryGetData(&fmtetc) == S_OK) { if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK) { LPCWSTR wstr = (LPCWSTR)::GlobalLock(stgmed.hGlobal); @@ -265,13 +265,13 @@ void *GHOST_DropTargetWin32::getDropDataAsString(IDataObject *pDataObject) ::GlobalUnlock(stgmed.hGlobal); return NULL; } - // Free memory + /* Free memory. */ ::GlobalUnlock(stgmed.hGlobal); ::ReleaseStgMedium(&stgmed); #ifdef WITH_GHOST_DEBUG ::printf("\n<converted droped unicode string>\n%s\n</droped converted unicode string>\n", tmp_string); -#endif // WITH_GHOST_DEBUG +#endif /* WITH_GHOST_DEBUG */ return tmp_string; } } @@ -293,7 +293,7 @@ void *GHOST_DropTargetWin32::getDropDataAsString(IDataObject *pDataObject) ::GlobalUnlock(stgmed.hGlobal); return NULL; } - // Free memory + /* Free memory. */ ::GlobalUnlock(stgmed.hGlobal); ::ReleaseStgMedium(&stgmed); @@ -307,13 +307,13 @@ void *GHOST_DropTargetWin32::getDropDataAsString(IDataObject *pDataObject) int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char *&out) { int size; - out = NULL; // caller should free if != NULL + out = NULL; /* caller should free if != NULL */ - // Get the required size. - size = ::WideCharToMultiByte(CP_ACP, // System Default Codepage - 0x00000400, // WC_NO_BEST_FIT_CHARS + /* Get the required size. */ + size = ::WideCharToMultiByte(CP_ACP, /* System Default Codepage */ + 0x00000400, /* WC_NO_BEST_FIT_CHARS */ in, - -1, //-1 null terminated, makes output null terminated too. + -1, /* -1 null terminated, makes output null terminated too. */ NULL, 0, NULL, @@ -322,7 +322,7 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char *&out) if (!size) { #ifdef WITH_GHOST_DEBUG ::printLastError(); -#endif // WITH_GHOST_DEBUG +#endif /* WITH_GHOST_DEBUG */ return 0; } @@ -337,7 +337,7 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char *&out) if (!size) { #ifdef WITH_GHOST_DEBUG ::printLastError(); -#endif // WITH_GHOST_DEBUG +#endif /* WITH_GHOST_DEBUG */ ::free(out); out = NULL; } @@ -362,4 +362,4 @@ void printLastError(void) LocalFree(s); } } -#endif // WITH_GHOST_DEBUG +#endif /* WITH_GHOST_DEBUG */ diff --git a/intern/ghost/intern/GHOST_ImeWin32.cpp b/intern/ghost/intern/GHOST_ImeWin32.cpp index c3fcd7214ca..0a62359cd77 100644 --- a/intern/ghost/intern/GHOST_ImeWin32.cpp +++ b/intern/ghost/intern/GHOST_ImeWin32.cpp @@ -512,4 +512,4 @@ void GHOST_ImeWin32::UpdateInfo(HWND window_handle) } } -#endif // WITH_INPUT_IME +#endif /* WITH_INPUT_IME */ diff --git a/intern/ghost/intern/GHOST_ImeWin32.h b/intern/ghost/intern/GHOST_ImeWin32.h index 0ae2bbc59e9..85c8ed7b4bd 100644 --- a/intern/ghost/intern/GHOST_ImeWin32.h +++ b/intern/ghost/intern/GHOST_ImeWin32.h @@ -351,4 +351,4 @@ class GHOST_ImeWin32 { bool is_first, is_enable; }; -#endif // WITH_INPUT_IME +#endif /* WITH_INPUT_IME */ diff --git a/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp b/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp index 36202278ea1..43f31cb2368 100644 --- a/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp +++ b/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp @@ -7,10 +7,10 @@ GHOST_NDOFManagerWin32::GHOST_NDOFManagerWin32(GHOST_System &sys) : GHOST_NDOFMa /* pass */ } -// whether multi-axis functionality is available (via the OS or driver) -// does not imply that a device is plugged in or being used +/* Whether multi-axis functionality is available (via the OS or driver) + * does not imply that a device is plugged in or being used. */ bool GHOST_NDOFManagerWin32::available() { - // always available since RawInput is built into Windows + /* Always available since RawInput is built into Windows. */ return true; } diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 3fd0e455fb6..2188aa11235 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -42,47 +42,48 @@ # include "GHOST_NDOFManagerWin32.h" #endif -// Key code values not found in winuser.h +/* Key code values not found in `winuser.h`. */ #ifndef VK_MINUS # define VK_MINUS 0xBD -#endif // VK_MINUS +#endif /* VK_MINUS */ #ifndef VK_SEMICOLON # define VK_SEMICOLON 0xBA -#endif // VK_SEMICOLON +#endif /* VK_SEMICOLON */ #ifndef VK_PERIOD # define VK_PERIOD 0xBE -#endif // VK_PERIOD +#endif /* VK_PERIOD */ #ifndef VK_COMMA # define VK_COMMA 0xBC -#endif // VK_COMMA +#endif /* VK_COMMA */ #ifndef VK_BACK_QUOTE # define VK_BACK_QUOTE 0xC0 -#endif // VK_BACK_QUOTE +#endif /* VK_BACK_QUOTE */ #ifndef VK_SLASH # define VK_SLASH 0xBF -#endif // VK_SLASH +#endif /* VK_SLASH */ #ifndef VK_BACK_SLASH # define VK_BACK_SLASH 0xDC -#endif // VK_BACK_SLASH +#endif /* VK_BACK_SLASH */ #ifndef VK_EQUALS # define VK_EQUALS 0xBB -#endif // VK_EQUALS +#endif /* VK_EQUALS */ #ifndef VK_OPEN_BRACKET # define VK_OPEN_BRACKET 0xDB -#endif // VK_OPEN_BRACKET +#endif /* VK_OPEN_BRACKET */ #ifndef VK_CLOSE_BRACKET # define VK_CLOSE_BRACKET 0xDD -#endif // VK_CLOSE_BRACKET +#endif /* VK_CLOSE_BRACKET */ #ifndef VK_GR_LESS # define VK_GR_LESS 0xE2 -#endif // VK_GR_LESS +#endif /* VK_GR_LESS */ -/* Workaround for some laptop touchpads, some of which seems to +/** + Workaround for some laptop touch-pads, some of which seems to * have driver issues which makes it so window function receives - * the message, but PeekMessage doesn't pick those messages for + * the message, but #PeekMessage doesn't pick those messages for * some reason. * - * We send a dummy WM_USER message to force PeekMessage to receive + * We send a dummy WM_USER message to force #PeekMessage to receive * something, making it so blender's window manager sees the new * messages coming in. */ @@ -101,19 +102,19 @@ static void initRawInput() RAWINPUTDEVICE devices[DEVICE_COUNT]; memset(devices, 0, DEVICE_COUNT * sizeof(RAWINPUTDEVICE)); - // Initiates WM_INPUT messages from keyboard - // That way GHOST can retrieve true keys + /* Initiates WM_INPUT messages from keyboard + * That way GHOST can retrieve true keys. */ devices[0].usUsagePage = 0x01; devices[0].usUsage = 0x06; /* http://msdn.microsoft.com/en-us/windows/hardware/gg487473.aspx */ #ifdef WITH_INPUT_NDOF - // multi-axis mouse (SpaceNavigator, etc.) + /* multi-axis mouse (SpaceNavigator, etc.). */ devices[1].usUsagePage = 0x01; devices[1].usUsage = 0x08; #endif if (RegisterRawInputDevices(devices, DEVICE_COUNT, sizeof(RAWINPUTDEVICE))) - ; // yay! + ; /* yay! */ else GHOST_PRINTF("could not register for RawInput: %d\n", (int)GetLastError()); @@ -131,15 +132,15 @@ GHOST_SystemWin32::GHOST_SystemWin32() m_consoleStatus = 1; - // Tell Windows we are per monitor DPI aware. This disables the default - // blurry scaling and enables WM_DPICHANGED to allow us to draw at proper DPI. + /* Tell Windows we are per monitor DPI aware. This disables the default + * blurry scaling and enables WM_DPICHANGED to allow us to draw at proper DPI. */ SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE); - // Check if current keyboard layout uses AltGr and save keylayout ID for - // specialized handling if keys like VK_OEM_*. I.e. french keylayout - // generates VK_OEM_8 for their exclamation key (key left of right shift) + /* Check if current keyboard layout uses AltGr and save keylayout ID for + * specialized handling if keys like VK_OEM_*. I.e. french keylayout + * generates #VK_OEM_8 for their exclamation key (key left of right shift). */ this->handleKeyboardChange(); - // Require COM for GHOST_DropTargetWin32 created in GHOST_WindowWin32. + /* Require COM for GHOST_DropTargetWin32 created in GHOST_WindowWin32. */ OleInitialize(0); #ifdef WITH_INPUT_NDOF @@ -149,7 +150,7 @@ GHOST_SystemWin32::GHOST_SystemWin32() GHOST_SystemWin32::~GHOST_SystemWin32() { - // Shutdown COM + /* Shutdown COM. */ OleUninitialize(); if (isStartedFromCommandPrompt()) { @@ -159,7 +160,7 @@ GHOST_SystemWin32::~GHOST_SystemWin32() uint64_t GHOST_SystemWin32::performanceCounterToMillis(__int64 perf_ticks) const { - // Calculate the time passed since system initialization. + /* Calculate the time passed since system initialization. */ __int64 delta = (perf_ticks - m_start) * 1000; uint64_t t = (uint64_t)(delta / m_freq); @@ -173,12 +174,12 @@ uint64_t GHOST_SystemWin32::tickCountToMillis(__int64 ticks) const uint64_t GHOST_SystemWin32::getMilliSeconds() const { - // Hardware does not support high resolution timers. We will use GetTickCount instead then. + /* Hardware does not support high resolution timers. We will use GetTickCount instead then. */ if (!m_hasPerformanceCounter) { return tickCountToMillis(::GetTickCount()); } - // Retrieve current count + /* Retrieve current count */ __int64 count = 0; ::QueryPerformanceCounter((LARGE_INTEGER *)&count); @@ -233,7 +234,7 @@ GHOST_IWindow *GHOST_SystemWin32::createWindow(const char *title, is_dialog); if (window->getValid()) { - // Store the pointer to the window + /* Store the pointer to the window */ m_windowManager->addWindow(window); m_windowManager->setActiveWindow(window); } @@ -395,10 +396,10 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent) driveTrackpad(); - // Process all the events waiting for us + /* Process all the events waiting for us. */ while (::PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE) != 0) { - // TranslateMessage doesn't alter the message, and doesn't change our raw keyboard data. - // Needed for MapVirtualKey or if we ever need to get chars from wm_ime_char or similar. + /* #TranslateMessage doesn't alter the message, and doesn't change our raw keyboard data. + * Needed for #MapVirtualKey or if we ever need to get chars from wm_ime_char or similar. */ ::TranslateMessage(&msg); ::DispatchMessageW(&msg); hasEventHandled = true; @@ -489,7 +490,7 @@ GHOST_TSuccess GHOST_SystemWin32::init() initRawInput(); m_lfstart = ::GetTickCount(); - // Determine whether this system has a high frequency performance counter. */ + /* Determine whether this system has a high frequency performance counter. */ m_hasPerformanceCounter = ::QueryPerformanceFrequency((LARGE_INTEGER *)&m_freq) == TRUE; if (m_hasPerformanceCounter) { GHOST_PRINT("GHOST_SystemWin32::init: High Frequency Performance Timer available\n"); @@ -520,7 +521,7 @@ GHOST_TSuccess GHOST_SystemWin32::init() wc.lpszMenuName = 0; wc.lpszClassName = L"GHOST_WindowClass"; - // Use RegisterClassEx for setting small icon + /* Use #RegisterClassEx for setting small icon. */ if (::RegisterClassW(&wc) == 0) { success = GHOST_kFailure; } @@ -538,8 +539,7 @@ GHOST_TKey GHOST_SystemWin32::hardKey(RAWINPUT const &raw, bool *r_keyDown) { GHOST_TKey key = GHOST_kKeyUnknown; - // RI_KEY_BREAK doesn't work for sticky keys release, so we also - // check for the up message + /* #RI_KEY_BREAK doesn't work for sticky keys release, so we also check for the up message. */ unsigned int msg = raw.data.keyboard.Message; *r_keyDown = !(raw.data.keyboard.Flags & RI_KEY_BREAK) && msg != WM_KEYUP && msg != WM_SYSKEYUP; @@ -600,11 +600,11 @@ GHOST_TKey GHOST_SystemWin32::convertKey(short vKey, short scanCode, short exten GHOST_TKey key; if ((vKey >= '0') && (vKey <= '9')) { - // VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) + /* VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39). */ key = (GHOST_TKey)(vKey - '0' + GHOST_kKey0); } else if ((vKey >= 'A') && (vKey <= 'Z')) { - // VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) + /* VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A). */ key = (GHOST_TKey)(vKey - 'A' + GHOST_kKeyA); } else if ((vKey >= VK_F1) && (vKey <= VK_F24)) { @@ -1109,7 +1109,7 @@ void GHOST_SystemWin32::processWheelEvent(GHOST_WindowWin32 *window, WPARAM wPar int delta = GET_WHEEL_DELTA_WPARAM(wParam); if (acc * delta < 0) { - // scroll direction reversed. + /* Scroll direction reversed. */ acc = 0; } acc += delta; @@ -1163,8 +1163,8 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA if (ctrl_pressed && !alt_pressed) { utf8_char[0] = '\0'; } - // Don't call ToUnicodeEx on dead keys as it clears the buffer and so won't allow diacritical - // composition. + /* Don't call #ToUnicodeEx on dead keys as it clears the buffer and so won't allow diacritical + * composition. */ else if (MapVirtualKeyW(vk, 2) != 0) { /* TODO: #ToUnicodeEx can respond with up to 4 utf16 chars (only 2 here). * Could be up to 24 utf8 bytes. */ @@ -1201,7 +1201,9 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA is_repeat, utf8_char); - // GHOST_PRINTF("%c\n", ascii); // we already get this info via EventPrinter +#if 0 /* we already get this info via EventPrinter. */ + GHOST_PRINTF("%c\n", ascii); +#endif } else { event = NULL; @@ -1305,7 +1307,7 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const &raw) uint64_t now = getMilliSeconds(); static bool firstEvent = true; - if (firstEvent) { // determine exactly which device is plugged in + if (firstEvent) { /* Determine exactly which device is plugged in. */ RID_DEVICE_INFO info; unsigned infoSize = sizeof(RID_DEVICE_INFO); info.cbSize = infoSize; @@ -1319,40 +1321,38 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const &raw) firstEvent = false; } - // The NDOF manager sends button changes immediately, and *pretends* to - // send motion. Mark as 'sent' so motion will always get dispatched. + /* The NDOF manager sends button changes immediately, and *pretends* to + * send motion. Mark as 'sent' so motion will always get dispatched. */ eventSent = true; BYTE const *data = raw.data.hid.bRawData; BYTE packetType = data[0]; switch (packetType) { - case 1: // translation - { + case 1: { /* Translation. */ const short *axis = (short *)(data + 1); - // massage into blender view coords (same goes for rotation) + /* Massage into blender view coords (same goes for rotation). */ const int t[3] = {axis[0], -axis[2], axis[1]}; m_ndofManager->updateTranslation(t, now); if (raw.data.hid.dwSizeHid == 13) { - // this report also includes rotation + /* This report also includes rotation. */ const int r[3] = {-axis[3], axis[5], -axis[4]}; m_ndofManager->updateRotation(r, now); - // I've never gotten one of these, has anyone else? + /* I've never gotten one of these, has anyone else? */ GHOST_PRINT("ndof: combined T + R\n"); } break; } - case 2: // rotation - { + case 2: { /* Rotation. */ + const short *axis = (short *)(data + 1); const int r[3] = {-axis[0], axis[2], -axis[1]}; m_ndofManager->updateRotation(r, now); break; } - case 3: // buttons - { + case 3: { /* Buttons. */ int button_bits; memcpy(&button_bits, data + 1, sizeof(button_bits)); m_ndofManager->updateButtons(button_bits, now); @@ -1361,7 +1361,7 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const &raw) } return eventSent; } -#endif // WITH_INPUT_NDOF +#endif /* WITH_INPUT_NDOF */ void GHOST_SystemWin32::driveTrackpad() { @@ -1424,8 +1424,8 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, if (hwnd) { if (msg == WM_NCCREATE) { - // Tell Windows to automatically handle scaling of non-client areas - // such as the caption bar. EnableNonClientDpiScaling was introduced in Windows 10 + /* Tell Windows to automatically handle scaling of non-client areas + * such as the caption bar. #EnableNonClientDpiScaling was introduced in Windows 10. */ HMODULE m_user32 = ::LoadLibrary("User32.dll"); if (m_user32) { GHOST_WIN32_EnableNonClientDpiScaling fpEnableNonClientDpiScaling = @@ -1440,7 +1440,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, GHOST_WindowWin32 *window = (GHOST_WindowWin32 *)::GetWindowLongPtr(hwnd, GWLP_USERDATA); if (window) { switch (msg) { - // we need to check if new key layout has AltGr + /* We need to check if new key layout has AltGr. */ case WM_INPUTLANGCHANGE: { system->handleKeyboardChange(); #ifdef WITH_INPUT_IME @@ -1449,9 +1449,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, #endif break; } - //////////////////////////////////////////////////////////////////////// - // Keyboard events, processed - //////////////////////////////////////////////////////////////////////// + /* ========================== + * Keyboard events, processed + * ========================== */ case WM_INPUT: { RAWINPUT raw; RAWINPUT *raw_ptr = &raw; @@ -1479,9 +1479,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, break; } #ifdef WITH_INPUT_IME - //////////////////////////////////////////////////////////////////////// - // IME events, processed, read more in GHOST_IME.h - //////////////////////////////////////////////////////////////////////// + /* ================================================= + * IME events, processed, read more in `GHOST_IME.h` + * ================================================= */ case WM_IME_NOTIFY: { /* Update conversion status when IME is changed or input mode is changed. */ if (wParam == IMN_SETOPENSTATUS || wParam == IMN_SETCONVERSIONMODE) { @@ -1529,52 +1529,47 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, break; } #endif /* WITH_INPUT_IME */ - //////////////////////////////////////////////////////////////////////// - // Keyboard events, ignored - //////////////////////////////////////////////////////////////////////// + /* ======================== + * Keyboard events, ignored + * ======================== */ case WM_KEYDOWN: case WM_SYSKEYDOWN: case WM_KEYUP: case WM_SYSKEYUP: /* These functions were replaced by #WM_INPUT. */ case WM_CHAR: - /* The WM_CHAR message is posted to the window with the keyboard focus when - * a WM_KEYDOWN message is translated by the TranslateMessage function. WM_CHAR - * contains the character code of the key that was pressed. - */ + /* The #WM_CHAR message is posted to the window with the keyboard focus when + * a WM_KEYDOWN message is translated by the #TranslateMessage function. + * WM_CHAR contains the character code of the key that was pressed. */ case WM_DEADCHAR: - /* The WM_DEADCHAR message is posted to the window with the keyboard focus when a - * WM_KEYUP message is translated by the TranslateMessage function. WM_DEADCHAR + /* The #WM_DEADCHAR message is posted to the window with the keyboard focus when a + * WM_KEYUP message is translated by the #TranslateMessage function. WM_DEADCHAR * specifies a character code generated by a dead key. A dead key is a key that * generates a character, such as the umlaut (double-dot), that is combined with * another character to form a composite character. For example, the umlaut-O * character (Ö) is generated by typing the dead key for the umlaut character, and - * then typing the O key. - */ + * then typing the O key. */ break; case WM_SYSDEADCHAR: - /* The WM_SYSDEADCHAR message is sent to the window with the keyboard focus when - * a WM_SYSKEYDOWN message is translated by the TranslateMessage function. + /* The #WM_SYSDEADCHAR message is sent to the window with the keyboard focus when + * a WM_SYSKEYDOWN message is translated by the #TranslateMessage function. * WM_SYSDEADCHAR specifies the character code of a system dead key - that is, - * a dead key that is pressed while holding down the alt key. - */ + * a dead key that is pressed while holding down the alt key. */ case WM_SYSCHAR: - /* The WM_SYSCHAR message is sent to the window with the keyboard focus when - * a WM_SYSCHAR message is translated by the TranslateMessage function. + /* #The WM_SYSCHAR message is sent to the window with the keyboard focus when + * a WM_SYSCHAR message is translated by the #TranslateMessage function. * WM_SYSCHAR specifies the character code of a dead key - that is, * a dead key that is pressed while holding down the alt key. - * To prevent the sound, DefWindowProc must be avoided by return - */ + * To prevent the sound, #DefWindowProc must be avoided by return. */ break; case WM_SYSCOMMAND: - /* The WM_SYSCOMMAND message is sent to the window when system commands such as + /* The #WM_SYSCOMMAND message is sent to the window when system commands such as * maximize, minimize or close the window are triggered. Also it is sent when ALT - * button is press for menu. To prevent this we must return preventing DefWindowProc. + * button is press for menu. To prevent this we must return preventing #DefWindowProc. * * Note that the four low-order bits of the wParam parameter are used internally by the * OS. To obtain the correct result when testing the value of wParam, an application must - * combine the value 0xFFF0 with the wParam value by using the bit-wise AND operator. - */ + * combine the value 0xFFF0 with the wParam value by using the bit-wise AND operator. */ switch (wParam & 0xFFF0) { case SC_KEYMENU: eventHandled = true; @@ -1609,9 +1604,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, } } break; - //////////////////////////////////////////////////////////////////////// - // Wintab events, processed - //////////////////////////////////////////////////////////////////////// + /* ======================== + * Wintab events, processed + * ======================== */ case WT_CSRCHANGE: { WINTAB_PRINTF("HWND %p HCTX %p WT_CSRCHANGE\n", window->getHWND(), (void *)lParam); GHOST_Wintab *wt = window->getWintab(); @@ -1667,9 +1662,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, processWintabEvent(window); eventHandled = true; break; - //////////////////////////////////////////////////////////////////////// - // Wintab events, debug - //////////////////////////////////////////////////////////////////////// + /* ==================== + * Wintab events, debug + * ==================== */ case WT_CTXOPEN: WINTAB_PRINTF("HWND %p HCTX %p WT_CTXOPEN\n", window->getHWND(), (void *)wParam); break; @@ -1693,9 +1688,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, break; } break; - //////////////////////////////////////////////////////////////////////// - // Pointer events, processed - //////////////////////////////////////////////////////////////////////// + /* ========================= + * Pointer events, processed + * ========================= */ case WM_POINTERUPDATE: case WM_POINTERDOWN: case WM_POINTERUP: @@ -1715,9 +1710,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, } break; } - //////////////////////////////////////////////////////////////////////// - // Mouse events, processed - //////////////////////////////////////////////////////////////////////// + /* ======================= + * Mouse events, processed + * ======================= */ case WM_LBUTTONDOWN: event = processButtonEvent(GHOST_kEventButtonDown, window, GHOST_kButtonMaskLeft); break; @@ -1792,13 +1787,13 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, * arrow if it is not in the client area. */ if (LOWORD(lParam) == HTCLIENT) { - // Load the current cursor + /* Load the current cursor. */ window->loadCursor(window->getCursorVisibility(), window->getCursorShape()); - // Bypass call to DefWindowProc + /* Bypass call to #DefWindowProc. */ return 0; } else { - // Outside of client area show standard cursor + /* Outside of client area show standard cursor. */ window->loadCursor(true, GHOST_kStandardCursorDefault); } break; @@ -1814,9 +1809,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, } break; } - //////////////////////////////////////////////////////////////////////// - // Mouse events, ignored - //////////////////////////////////////////////////////////////////////// + /* ===================== + * Mouse events, ignored + * ===================== */ case WM_NCMOUSEMOVE: /* The WM_NCMOUSEMOVE message is posted to a window when the cursor is moved * within the non-client area of the window. This message is posted to the window that @@ -1830,9 +1825,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, */ break; - //////////////////////////////////////////////////////////////////////// - // Window events, processed - //////////////////////////////////////////////////////////////////////// + /* ======================== + * Window events, processed + * ======================== */ case WM_CLOSE: /* The WM_CLOSE message is sent as a signal that a window * or an application should terminate. Restore if minimized. */ @@ -1942,15 +1937,15 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, * with a different DPI. */ { - // The suggested new size and position of the window. + /* The suggested new size and position of the window. */ RECT *const suggestedWindowRect = (RECT *)lParam; - // Push DPI change event first + /* Push DPI change event first. */ system->pushEvent(processWindowEvent(GHOST_kEventWindowDPIHintChanged, window)); system->dispatchEvents(); eventHandled = true; - // Then move and resize window + /* Then move and resize window. */ SetWindowPos(hwnd, NULL, suggestedWindowRect->left, @@ -1983,9 +1978,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, window->ThemeRefresh(); } break; - //////////////////////////////////////////////////////////////////////// - // Window events, ignored - //////////////////////////////////////////////////////////////////////// + /* ====================== + * Window events, ignored + * ====================== */ case WM_WINDOWPOSCHANGED: /* The WM_WINDOWPOSCHANGED message is sent to a window whose size, position, or place * in the Z order has changed as a result of a call to the SetWindowPos function or @@ -2030,9 +2025,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_SETFOCUS: /* The WM_SETFOCUS message is sent to a window after it has gained the keyboard focus. */ break; - //////////////////////////////////////////////////////////////////////// - // Other events - //////////////////////////////////////////////////////////////////////// + /* ============ + * Other events + * ============ */ case WM_GETTEXT: /* An application sends a WM_GETTEXT message to copy the text that * corresponds to a window into a buffer provided by the caller. @@ -2063,7 +2058,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, } } else { - // Event found for a window before the pointer to the class has been set. + /* Event found for a window before the pointer to the class has been set. */ GHOST_PRINT("GHOST_SystemWin32::wndProc: GHOST window event before creation\n"); /* These are events we typically miss at this point: * WM_GETMINMAXINFO 0x24 @@ -2075,7 +2070,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, } } else { - // Events without valid hwnd + /* Events without valid `hwnd`. */ GHOST_PRINT("GHOST_SystemWin32::wndProc: event without window\n"); } @@ -2151,12 +2146,12 @@ void GHOST_SystemWin32::putClipboard(const char *buffer, bool selection) const { if (selection || !buffer) { return; - } // for copying the selection, used on X11 + } /* For copying the selection, used on X11. */ if (OpenClipboard(NULL)) { EmptyClipboard(); - // Get length of buffer including the terminating null + /* Get length of buffer including the terminating null. */ size_t len = count_utf_16_from_8(buffer); HGLOBAL clipbuffer = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t) * len); @@ -2213,7 +2208,7 @@ GHOST_TSuccess GHOST_SystemWin32::showMessageBox(const char *title, case IDCONTINUE: break; default: - break; // should never happen + break; /* Should never happen. */ } free((void *)title_16); diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h index c9de3b22d54..1cd1266bdcb 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.h +++ b/intern/ghost/intern/GHOST_SystemWin32.h @@ -10,10 +10,10 @@ #ifndef WIN32 # error WIN32 only! -#endif // WIN32 +#endif /* WIN32 */ #define WIN32_LEAN_AND_MEAN -#include <ole2.h> // for drag-n-drop +#include <ole2.h> /* For drag-n-drop. */ #include <windows.h> #include "GHOST_System.h" @@ -387,7 +387,7 @@ class GHOST_SystemWin32 : public GHOST_System { static GHOST_Event *processImeEvent(GHOST_TEventType type, GHOST_WindowWin32 *window, GHOST_TEventImeData *data); -#endif // WITH_INPUT_IME +#endif /* WITH_INPUT_IME */ /** * Handles minimum window size. @@ -459,18 +459,18 @@ class GHOST_SystemWin32 : public GHOST_System { inline void GHOST_SystemWin32::handleKeyboardChange(void) { - m_keylayout = GetKeyboardLayout(0); // get keylayout for current thread + m_keylayout = GetKeyboardLayout(0); /* Get keylayout for current thread. */ int i; SHORT s; - // save the language identifier. + /* Save the language identifier. */ m_langId = LOWORD(m_keylayout); for (m_hasAltGr = false, i = 32; i < 256; ++i) { s = VkKeyScanEx((char)i, m_keylayout); - // s == -1 means no key that translates passed char code - // high byte contains shift state. bit 2 ctrl pressed, bit 4 alt pressed - // if both are pressed, we have AltGr keycombo on keylayout + /* `s == -1` means no key that translates passed char code + * high byte contains shift state. bit 2 ctrl pressed, bit 4 alt pressed + * if both are pressed, we have AltGr keycombo on keylayout. */ if (s != -1 && (s & 0x600) == 0x600) { m_hasAltGr = true; break; diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 20ab71ac95a..bdad6434b0c 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -26,7 +26,7 @@ #ifndef GET_POINTERID_WPARAM # define GET_POINTERID_WPARAM(wParam) (LOWORD(wParam)) -#endif // GET_POINTERID_WPARAM +#endif /* GET_POINTERID_WPARAM */ const wchar_t *GHOST_WindowWin32::s_windowClassName = L"GHOST_WindowClass"; const int GHOST_WindowWin32::s_maxTitleLength = 128; @@ -93,18 +93,18 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system, adjustWindowRectForClosestMonitor(&win_rect, style, extended_style); wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0); - m_hWnd = ::CreateWindowExW(extended_style, // window extended style - s_windowClassName, // pointer to registered class name - title_16, // pointer to window name - style, // window style - win_rect.left, // horizontal position of window - win_rect.top, // vertical position of window - win_rect.right - win_rect.left, // window width - win_rect.bottom - win_rect.top, // window height - m_parentWindowHwnd, // handle to parent or owner window - 0, // handle to menu or child-window identifier - ::GetModuleHandle(0), // handle to application instance - 0); // pointer to window-creation data + m_hWnd = ::CreateWindowExW(extended_style, /* window extended style */ + s_windowClassName, /* pointer to registered class name */ + title_16, /* pointer to window name */ + style, /* window style */ + win_rect.left, /* horizontal position of window */ + win_rect.top, /* vertical position of window */ + win_rect.right - win_rect.left, /* window width */ + win_rect.bottom - win_rect.top, /* window height */ + m_parentWindowHwnd, /* handle to parent or owner window */ + 0, /* handle to menu or child-window identifier */ + ::GetModuleHandle(0), /* handle to application instance */ + 0); /* pointer to window-creation data */ free(title_16); if (m_hWnd == NULL) { @@ -197,7 +197,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system, /* Force an initial paint of the window. */ ::UpdateWindow(m_hWnd); - /* Initialize Wintab. */ + /* Initialize WINTAB. */ if (system->getTabletAPI() != GHOST_kTabletWinPointer) { loadWintab(GHOST_kWindowStateMinimized != state); } @@ -221,7 +221,7 @@ void GHOST_WindowWin32::updateDirectManipulation() void GHOST_WindowWin32::onPointerHitTest(WPARAM wParam) { - /* Only DM_POINTERHITTEST can be the first message of input sequence of touchpad input. */ + /* Only #DM_POINTERHITTEST can be the first message of input sequence of touch-pad input. */ if (!m_directManipulationHelper) { return; @@ -280,9 +280,9 @@ GHOST_WindowWin32::~GHOST_WindowWin32() } if (m_dropTarget) { - // Disable DragDrop + /* Disable DragDrop. */ RevokeDragDrop(m_hWnd); - // Release our reference of the DropTarget and it will delete itself eventually. + /* Release our reference of the DropTarget and it will delete itself eventually. */ m_dropTarget->Release(); m_dropTarget = NULL; } @@ -531,7 +531,8 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state) break; } ::SetWindowLongPtr(m_hWnd, GWL_STYLE, style); - /* SetWindowLongPtr Docs: frame changes not visible until SetWindowPos with SWP_FRAMECHANGED. */ + /* #SetWindowLongPtr Docs: + * Frame changes not visible until #SetWindowPos with #SWP_FRAMECHANGED. */ ::SetWindowPos(m_hWnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); return ::SetWindowPlacement(m_hWnd, &wp) == TRUE ? GHOST_kSuccess : GHOST_kFailure; } @@ -680,7 +681,7 @@ void GHOST_WindowWin32::updateMouseCapture(GHOST_MouseCaptureEventWin32 event) HCURSOR GHOST_WindowWin32::getStandardCursor(GHOST_TStandardCursor shape) const { - // Convert GHOST cursor to Windows OEM cursor + /* Convert GHOST cursor to Windows OEM cursor. */ HANDLE cursor = NULL; HMODULE module = ::GetModuleHandle(0); uint32_t flags = LR_SHARED | LR_DEFAULTSIZE; @@ -738,36 +739,36 @@ HCURSOR GHOST_WindowWin32::getStandardCursor(GHOST_TStandardCursor shape) const break; case GHOST_kStandardCursorHelp: cursor = ::LoadImage(NULL, IDC_HELP, IMAGE_CURSOR, cx, cy, flags); - break; // Arrow and question mark + break; /* Arrow and question mark */ case GHOST_kStandardCursorWait: cursor = ::LoadImage(NULL, IDC_WAIT, IMAGE_CURSOR, cx, cy, flags); - break; // Hourglass + break; /* Hourglass */ case GHOST_kStandardCursorText: cursor = ::LoadImage(NULL, IDC_IBEAM, IMAGE_CURSOR, cx, cy, flags); - break; // I-beam + break; /* I-beam */ case GHOST_kStandardCursorCrosshair: cursor = ::LoadImage(module, "cross_cursor", IMAGE_CURSOR, cx, cy, flags); - break; // Standard Cross + break; /* Standard Cross */ case GHOST_kStandardCursorCrosshairA: cursor = ::LoadImage(module, "crossA_cursor", IMAGE_CURSOR, cx, cy, flags); - break; // Crosshair A + break; /* Crosshair A */ case GHOST_kStandardCursorCrosshairB: cursor = ::LoadImage(module, "crossB_cursor", IMAGE_CURSOR, cx, cy, flags); - break; // Diagonal Crosshair B + break; /* Diagonal Crosshair B */ case GHOST_kStandardCursorCrosshairC: cursor = ::LoadImage(module, "crossC_cursor", IMAGE_CURSOR, cx, cy, flags); - break; // Minimal Crosshair C + break; /* Minimal Crosshair C */ case GHOST_kStandardCursorBottomSide: case GHOST_kStandardCursorUpDown: cursor = ::LoadImage(module, "movens_cursor", IMAGE_CURSOR, cx, cy, flags); - break; // Double-pointed arrow pointing north and south + break; /* Double-pointed arrow pointing north and south */ case GHOST_kStandardCursorLeftSide: case GHOST_kStandardCursorLeftRight: cursor = ::LoadImage(module, "moveew_cursor", IMAGE_CURSOR, cx, cy, flags); - break; // Double-pointed arrow pointing west and east + break; /* Double-pointed arrow pointing west and east */ case GHOST_kStandardCursorTopSide: cursor = ::LoadImage(NULL, IDC_UPARROW, IMAGE_CURSOR, cx, cy, flags); - break; // Vertical arrow + break; /* Vertical arrow */ case GHOST_kStandardCursorTopLeftCorner: cursor = ::LoadImage(NULL, IDC_SIZENWSE, IMAGE_CURSOR, cx, cy, flags); break; @@ -789,7 +790,7 @@ HCURSOR GHOST_WindowWin32::getStandardCursor(GHOST_TStandardCursor shape) const case GHOST_kStandardCursorDestroy: case GHOST_kStandardCursorStop: cursor = ::LoadImage(module, "forbidden_cursor", IMAGE_CURSOR, cx, cy, flags); - break; // Slashed circle + break; /* Slashed circle */ case GHOST_kStandardCursorDefault: cursor = NULL; break; @@ -849,9 +850,9 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCursorGrab(GHOST_TGrabCursorMode mode setWindowCursorVisibility(true); } if (m_cursorGrab != GHOST_kGrabNormal) { - /* use to generate a mouse move event, otherwise the last event + /* Use to generate a mouse move event, otherwise the last event * blender gets can be outside the screen causing menus not to show - * properly unless the user moves the mouse */ + * properly unless the user moves the mouse. */ int32_t pos[2]; m_system->getCursorPosition(pos[0], pos[1]); m_system->setCursorPosition(pos[0], pos[1]); @@ -902,7 +903,7 @@ GHOST_TSuccess GHOST_WindowWin32::getPointerInfo( for (uint32_t i = 0; i < outCount; i++) { POINTER_INFO pointerApiInfo = pointerPenInfo[i].pointerInfo; - // Obtain the basic information from the event + /* Obtain the basic information from the event. */ outPointerInfo[i].pointerId = pointerId; outPointerInfo[i].isPrimary = isPrimary; @@ -1044,8 +1045,9 @@ void GHOST_WindowWin32::ThemeRefresh() &pcbData) == ERROR_SUCCESS) { BOOL DarkMode = !lightMode; - /* 20 == DWMWA_USE_IMMERSIVE_DARK_MODE in Windows 11 SDK. This value was undocumented for - * Windows 10 versions 2004 and later, supported for Windows 11 Build 22000 and later. */ + /* `20 == DWMWA_USE_IMMERSIVE_DARK_MODE` in Windows 11 SDK. + * This value was undocumented for Windows 10 versions 2004 and later, + * supported for Windows 11 Build 22000 and later. */ DwmSetWindowAttribute(this->m_hWnd, 20, &DarkMode, sizeof(DarkMode)); } } diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h index 88731597caa..44071f0915e 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.h +++ b/intern/ghost/intern/GHOST_WindowWin32.h @@ -10,7 +10,7 @@ #ifndef WIN32 # error WIN32 only! -#endif // WIN32 +#endif /* WIN32 */ #include "GHOST_TaskbarWin32.h" #include "GHOST_TrackpadWin32.h" @@ -25,7 +25,7 @@ class GHOST_SystemWin32; class GHOST_DropTargetWin32; -// typedefs for user32 functions to allow dynamic loading of Windows 10 DPI scaling functions +/* typedefs for user32 functions to allow dynamic loading of Windows 10 DPI scaling functions. */ typedef UINT(API *GHOST_WIN32_GetDpiForWindow)(HWND); typedef BOOL(API *GHOST_WIN32_AdjustWindowRectExForDpi)( |