mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-10 12:44:53 +00:00
[win] Use WinTab/tablet pressure only for certain windows (#3358)
Windows that need tablet information are the MainWindow, DynamicsPopup, and scripts Dialog.
This commit is contained in:
parent
dbccf71622
commit
84f3101681
2
laf
2
laf
@ -1 +1 @@
|
|||||||
Subproject commit 631bc339fa7a4b5adb9c4caee5b07dac18f2219a
|
Subproject commit 7af127f4785ac0fb0e50fa32e68e572719477f2a
|
@ -66,6 +66,8 @@ public:
|
|||||||
: WindowWithHand(type, text)
|
: WindowWithHand(type, text)
|
||||||
, m_handTool(false)
|
, m_handTool(false)
|
||||||
{
|
{
|
||||||
|
// As scripts can receive the "pressure" information.
|
||||||
|
setNeedsTabletPressure(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enables the Hand tool in the active editor.
|
// Enables the Hand tool in the active editor.
|
||||||
|
@ -222,6 +222,8 @@ DynamicsPopup::DynamicsPopup(Delegate* delegate)
|
|||||||
, m_ditheringSel(new DitheringSelector(DitheringSelector::SelectMatrix))
|
, m_ditheringSel(new DitheringSelector(DitheringSelector::SelectMatrix))
|
||||||
, m_fromTo(tools::ColorFromTo::BgToFg)
|
, m_fromTo(tools::ColorFromTo::BgToFg)
|
||||||
{
|
{
|
||||||
|
setNeedsTabletPressure(true);
|
||||||
|
|
||||||
m_dynamics->stabilizer()->Click.connect(
|
m_dynamics->stabilizer()->Click.connect(
|
||||||
[this](){
|
[this](){
|
||||||
if (m_dynamics->stabilizer()->isSelected()) {
|
if (m_dynamics->stabilizer()->isSelected()) {
|
||||||
|
@ -95,6 +95,7 @@ MainWindow::MainWindow()
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
enableFlags(ALLOW_DROP);
|
enableFlags(ALLOW_DROP);
|
||||||
|
setNeedsTabletPressure(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This 'initialize' function is a way to split the creation of the
|
// This 'initialize' function is a way to split the creation of the
|
||||||
|
@ -1394,6 +1394,11 @@ void Manager::_openWindow(Window* window, bool center)
|
|||||||
spec.parent(parentDisplay->nativeWindow());
|
spec.parent(parentDisplay->nativeWindow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LAF_WINDOWS
|
||||||
|
// Just in case we'll try to avoid using WinTab at all costs.
|
||||||
|
spec.useTabletOptions(window->needsTabletPressure());
|
||||||
|
#endif
|
||||||
|
|
||||||
os::WindowRef newNativeWindow = os::System::instance()->makeWindow(spec);
|
os::WindowRef newNativeWindow = os::System::instance()->makeWindow(spec);
|
||||||
ui::Display* newDisplay = new ui::Display(parentDisplay, newNativeWindow, window);
|
ui::Display* newDisplay = new ui::Display(parentDisplay, newNativeWindow, window);
|
||||||
|
|
||||||
|
@ -122,6 +122,8 @@ Window::Window(Type type, const std::string& text)
|
|||||||
, m_isWantFocus(true)
|
, m_isWantFocus(true)
|
||||||
, m_isForeground(false)
|
, m_isForeground(false)
|
||||||
, m_isAutoRemap(true)
|
, m_isAutoRemap(true)
|
||||||
|
, m_isResizing(false)
|
||||||
|
, m_needsTabletPressure(false)
|
||||||
{
|
{
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
setAlign(LEFT | MIDDLE);
|
setAlign(LEFT | MIDDLE);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite UI Library
|
// Aseprite UI Library
|
||||||
// Copyright (C) 2019-2023 Igara Studio S.A.
|
// Copyright (C) 2019-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2017 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
@ -66,6 +66,13 @@ namespace ui {
|
|||||||
bool isSizeable() const { return m_isSizeable; }
|
bool isSizeable() const { return m_isSizeable; }
|
||||||
bool isMoveable() const { return m_isMoveable; }
|
bool isMoveable() const { return m_isMoveable; }
|
||||||
|
|
||||||
|
// Use to inhibit buggy WinTab implementations that might crash
|
||||||
|
// the whole program just calling WTOpen(). This must be called
|
||||||
|
// before creating the native window (before
|
||||||
|
// Manager::_openWindow()).
|
||||||
|
void setNeedsTabletPressure(const bool s) { m_needsTabletPressure = s; }
|
||||||
|
bool needsTabletPressure() const { return m_needsTabletPressure; }
|
||||||
|
|
||||||
// Returns true only inside onWindowResize() when the window size
|
// Returns true only inside onWindowResize() when the window size
|
||||||
// changed.
|
// changed.
|
||||||
bool isResizing() const { return m_isResizing; }
|
bool isResizing() const { return m_isResizing; }
|
||||||
@ -136,6 +143,7 @@ namespace ui {
|
|||||||
bool m_isForeground : 1;
|
bool m_isForeground : 1;
|
||||||
bool m_isAutoRemap : 1;
|
bool m_isAutoRemap : 1;
|
||||||
bool m_isResizing : 1;
|
bool m_isResizing : 1;
|
||||||
|
bool m_needsTabletPressure : 1;
|
||||||
int m_hitTest;
|
int m_hitTest;
|
||||||
gfx::Rect m_lastFrame;
|
gfx::Rect m_lastFrame;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user