Sculpt-dev: Print error message to console

when wintab initilization fails.
This commit is contained in:
Joseph Eagar 2022-01-25 14:12:04 -08:00
parent a34611b453
commit cc5c1e7837
2 changed files with 19 additions and 0 deletions

View File

@ -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

View File

@ -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;
}