diff --git a/os/win/window.cpp b/os/win/window.cpp index 1648163c6..2adf24bfb 100644 --- a/os/win/window.cpp +++ b/os/win/window.cpp @@ -181,6 +181,7 @@ WindowWin::WindowWin(const WindowSpec& spec) , m_lastPointerDownButton(Event::NoneButton) , m_pointerDownCount(0) #endif + , m_allowWintab(spec.useTabletOptions()) , m_hpenctx(nullptr) , m_fullscreen(false) , m_titled(spec.titled()) @@ -2485,6 +2486,9 @@ void WindowWin::checkDarkModeChange() void WindowWin::openWintabCtx() { + if (!m_allowWintab) + return; + auto sys = system(); TabletOptions options = sys->tabletOptions(); if (options.api == TabletAPI::Wintab || diff --git a/os/win/window.h b/os/win/window.h index 39473fb31..f546cce22 100644 --- a/os/win/window.h +++ b/os/win/window.h @@ -246,6 +246,7 @@ namespace os { // packets queue are shared between all windows, because it's // information from the device that doesn't depend on the active // window. + bool m_allowWintab; HCTX m_hpenctx; static PointerType m_pointerType; static float m_pressure; diff --git a/os/window_spec.h b/os/window_spec.h index 1be9f0b89..1004aeb24 100644 --- a/os/window_spec.h +++ b/os/window_spec.h @@ -1,5 +1,5 @@ // LAF OS Library -// Copyright (C) 2019-2021 Igara Studio S.A. +// Copyright (C) 2019-2024 Igara Studio S.A. // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. @@ -58,6 +58,13 @@ namespace os { void transparent(const bool s) { m_transparent = s; } void parent(Window* p) { m_parent = p; } + // Option to ignore tablet options and avoid calling WTOpen() for + // each single window (e.g. tooltips don't need the tablet). +#if LAF_WINDOWS + bool useTabletOptions() const { return m_useTabletOptions; } + void useTabletOptions(const bool s) { m_useTabletOptions = s; } +#endif + const gfx::Rect& frame() const { return m_frame; } const gfx::Rect& contentRect() const { return m_contentRect; } int scale() const { return m_scale; } @@ -83,6 +90,9 @@ namespace os { int m_scale = 1; ScreenRef m_screen; Window* m_parent = nullptr; +#if LAF_WINDOWS + bool m_useTabletOptions = true; +#endif }; } // namespace os