[Bf-blender-cvs] [955032ffb0c] master: Cleanup: use C style comments for GHOST/Win32 text

Campbell Barton noreply at git.blender.org
Sat Aug 27 03:25:33 CEST 2022


Commit: 955032ffb0c5ca671b24d04bd45cc0f6604d66c6
Author: Campbell Barton
Date:   Sat Aug 27 11:24:49 2022 +1000
Branches: master
https://developer.blender.org/rB955032ffb0c5ca671b24d04bd45cc0f6604d66c6

Cleanup: use C style comments for GHOST/Win32 text

===================================================================

M	intern/ghost/intern/GHOST_DisplayManagerWin32.cpp
M	intern/ghost/intern/GHOST_DropTargetWin32.cpp
M	intern/ghost/intern/GHOST_ImeWin32.cpp
M	intern/ghost/intern/GHOST_ImeWin32.h
M	intern/ghost/intern/GHOST_NDOFManagerWin32.cpp
M	intern/ghost/intern/GHOST_SystemWin32.cpp
M	intern/ghost/intern/GHOST_SystemWin32.h
M	intern/ghost/intern/GHOST_WindowWin32.cpp
M	intern/ghost/intern/GHOST_WindowWin32.h

===================================================================

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();
-#en

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list