[Bf-blender-cvs] [cc5c1e7837f] sculpt-dev: Sculpt-dev: Print error message to console when wintab initilization fails.

Joseph Eagar noreply at git.blender.org
Tue Jan 25 23:13:01 CET 2022


Commit: cc5c1e7837fa5600f5c0010c80b2ea2552e74f79
Author: Joseph Eagar
Date:   Tue Jan 25 14:12:04 2022 -0800
Branches: sculpt-dev
https://developer.blender.org/rBcc5c1e7837fa5600f5c0010c80b2ea2552e74f79

Sculpt-dev: Print error message to console
            when wintab initilization fails.

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

M	intern/ghost/GHOST_Types.h
M	intern/ghost/intern/GHOST_Wintab.cpp

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

diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 7fe9300ec3f..6a989eed355 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -25,6 +25,18 @@
 
 #include <stdint.h>
 
+#ifndef ATTR_NO_OPT
+#ifdef __clang__
+#  define ATTR_NO_OPT __attribute__((optnone))
+#elif defined(_MSC_VER)
+#  define ATTR_NO_OPT __pragma(optimize("", off))
+#elif defined(__GNUC__)
+#  define ATTR_NO_OPT __attribute__((optimize("O0")))
+#else
+#  define ATTR_NO_OPT
+#endif
+#endif
+
 #ifdef WITH_CXX_GUARDEDALLOC
 #  include "MEM_guardedalloc.h"
 #endif
diff --git a/intern/ghost/intern/GHOST_Wintab.cpp b/intern/ghost/intern/GHOST_Wintab.cpp
index 953fcb171e5..f5a5989f3e3 100644
--- a/intern/ghost/intern/GHOST_Wintab.cpp
+++ b/intern/ghost/intern/GHOST_Wintab.cpp
@@ -21,6 +21,7 @@
 #define _USE_MATH_DEFINES
 
 #include "GHOST_Wintab.h"
+#include <cstdio>
 
 GHOST_Wintab *GHOST_Wintab::loadWintab(HWND hwnd)
 {
@@ -87,6 +88,9 @@ GHOST_Wintab *GHOST_Wintab::loadWintab(HWND hwnd)
 
   LOGCONTEXT lc = {0};
   if (!info(WTI_DEFSYSCTX, 0, &lc)) {
+    fprintf(stderr, "Failed to load Wintab driver\n");
+    fflush(stderr);
+
     return nullptr;
   }
 
@@ -97,6 +101,9 @@ GHOST_Wintab *GHOST_Wintab::loadWintab(HWND hwnd)
   /* The Wintab spec says we must open the context disabled if we are using cursor masks. */
   auto hctx = unique_hctx(open(hwnd, &lc, FALSE), close);
   if (!hctx) {
+    fprintf(stderr, "Failed to open Wintab driver\n");
+    fflush(stderr);
+
     return nullptr;
   }



More information about the Bf-blender-cvs mailing list