Change updateWintab interface to include whether window is visible so that
window intitialization can specify whether it will be visible regardless of whether it is yet visible. Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
This commit is contained in:
parent
b98ea1b268
commit
14cddad034
|
@ -1338,7 +1338,8 @@ void GHOST_SystemWin32::setTabletAPI(GHOST_TTabletAPI api)
|
|||
|
||||
for (GHOST_IWindow *win : wm->getWindows()) {
|
||||
GHOST_WindowWin32 *windowsWindow = (GHOST_WindowWin32 *)win;
|
||||
windowsWindow->updateWintab(windowsWindow == activeWindow);
|
||||
windowsWindow->updateWintab(windowsWindow == activeWindow,
|
||||
!::IsIconic(windowsWindow->getHWND()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1729,7 +1730,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
|||
if (LOWORD(wParam) == WA_INACTIVE)
|
||||
window->lostMouseCapture();
|
||||
|
||||
window->updateWintab(LOWORD(wParam) != WA_INACTIVE);
|
||||
window->updateWintab(LOWORD(wParam) != WA_INACTIVE, !::IsIconic(window->getHWND()));
|
||||
|
||||
lResult = ::DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
break;
|
||||
|
@ -1789,8 +1790,11 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
|||
event = processWindowEvent(GHOST_kEventWindowSize, window);
|
||||
}
|
||||
|
||||
// Window might be minimized while inactive. When a window is inactive but not minimized,
|
||||
// Wintab is left enabled (to catch the case where a pen is used to activate a window).
|
||||
// When an inactive window is minimized, we need to disable Wintab.
|
||||
if (msg == WM_SIZE && wParam == SIZE_MINIMIZED) {
|
||||
window->updateWintab(false);
|
||||
window->updateWintab(false, false);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -310,7 +310,8 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
|
|||
(m_wintab.overlap = (GHOST_WIN32_WTOverlap)::GetProcAddress(m_wintab.handle, "WTOverlap"))) {
|
||||
initializeWintab();
|
||||
// Determine which tablet API to use and enable it.
|
||||
updateWintab(true);
|
||||
bool enableWintab = state != GHOST_kWindowStateMinimized;
|
||||
updateWintab(enableWintab, enableWintab);
|
||||
}
|
||||
|
||||
CoCreateInstance(
|
||||
|
@ -326,6 +327,7 @@ GHOST_WindowWin32::~GHOST_WindowWin32()
|
|||
}
|
||||
|
||||
if (m_wintab.handle) {
|
||||
updateWintab(false, false);
|
||||
if (m_wintab.close && m_wintab.context) {
|
||||
m_wintab.close(m_wintab.context);
|
||||
}
|
||||
|
@ -999,19 +1001,19 @@ GHOST_TSuccess GHOST_WindowWin32::hasCursorShape(GHOST_TStandardCursor cursorSha
|
|||
return (getStandardCursor(cursorShape)) ? GHOST_kSuccess : GHOST_kFailure;
|
||||
}
|
||||
|
||||
void GHOST_WindowWin32::updateWintab(bool active)
|
||||
void GHOST_WindowWin32::updateWintab(bool active, bool visible)
|
||||
{
|
||||
if (m_wintab.enable && m_wintab.overlap && m_wintab.context) {
|
||||
bool useWintab = useTabletAPI(GHOST_kTabletWintab);
|
||||
bool enable = active && useWintab;
|
||||
bool enable = useTabletAPI(GHOST_kTabletWintab) && visible;
|
||||
bool overlap = enable && active;
|
||||
|
||||
// Disabling context while the Window is not minimized can cause issues on receiving Wintab
|
||||
// input while changing a window for some drivers, so only disable if either Wintab had been
|
||||
// disabled or the window is minimized.
|
||||
m_wintab.enable(m_wintab.context, useWintab && !::IsIconic(m_hWnd));
|
||||
m_wintab.overlap(m_wintab.context, enable);
|
||||
m_wintab.enable(m_wintab.context, enable);
|
||||
m_wintab.overlap(m_wintab.context, overlap);
|
||||
|
||||
if (!enable) {
|
||||
if (!overlap) {
|
||||
// WT_PROXIMITY event doesn't occur unless tablet's cursor leaves the proximity while the
|
||||
// window is active.
|
||||
m_tabletInRange = false;
|
||||
|
@ -1245,7 +1247,8 @@ void GHOST_WindowWin32::processWintabInfoChangeEvent(LPARAM lParam)
|
|||
// Update number of connected Wintab digitizers
|
||||
if (LOWORD(lParam) == WTI_INTERFACE && HIWORD(lParam) == IFC_NDEVICES) {
|
||||
m_wintab.info(WTI_INTERFACE, IFC_NDEVICES, &m_wintab.numDevices);
|
||||
updateWintab((GHOST_WindowWin32 *)system->getWindowManager()->getActiveWindow() == this);
|
||||
updateWintab((GHOST_WindowWin32 *)system->getWindowManager()->getActiveWindow() == this,
|
||||
!::IsIconic(m_hWnd));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -439,8 +439,9 @@ class GHOST_WindowWin32 : public GHOST_Window {
|
|||
/**
|
||||
* Handle setup and switch between Wintab and Pointer APIs
|
||||
* \param active Whether the window is or will be in an active state
|
||||
* \param visible Whether the window is currently (or will be) visible)
|
||||
*/
|
||||
void updateWintab(bool active);
|
||||
void updateWintab(bool active, bool visible);
|
||||
|
||||
/**
|
||||
* Query whether given tablet API should be used.
|
||||
|
|
Loading…
Reference in New Issue