mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 15:32:38 +00:00
[win] Add Tablet section on Edit > Preferences and restore old wintab behavior
Now on Windows it's more clear the different APIs to use (Windows Pointer vs Wintab), the Wintab API works as before (generates mouse events on WM_MOUSE message instead for each packet), and there is a new Wintab mode to create events directly from packets (still a little buggy with some tablets, but might be useful in other tablets to get more precision for fast strokes).
This commit is contained in:
parent
b0d76d096f
commit
445e0abb0b
@ -184,6 +184,9 @@
|
||||
<option id="font" type="std::string" />
|
||||
<option id="mini_font" type="std::string" />
|
||||
</section>
|
||||
<section id="tablet" text="Tablet">
|
||||
<option id="api" type="std::string" />
|
||||
</section>
|
||||
<section id="experimental" text="Experimental">
|
||||
<option id="new_render_engine" type="bool" default="true" />
|
||||
<option id="new_blend" type="bool" default="true" />
|
||||
|
@ -1010,6 +1010,7 @@ skip = &Skip
|
||||
title = Preferences
|
||||
section_general = General
|
||||
section_files = Files
|
||||
section_tablet = Tablet
|
||||
section_alerts = Alerts
|
||||
section_color = Color
|
||||
section_editor = Editor
|
||||
@ -1089,6 +1090,9 @@ clear_recent_files = Clear
|
||||
clear_recent_files_tooltip = Clear the list of recent files and folders
|
||||
locate_file = Locate Configuration File
|
||||
locate_crash_folder = Locate Crash Folder
|
||||
tablet_api_windows_pointer = Windows 8/10 Pointer API (Windows Ink)
|
||||
tablet_api_wintab_system = Wintab
|
||||
tablet_api_wintab_direct = Wintab (direct packet processing)
|
||||
wheel_zoom = Zoom with scroll wheel
|
||||
slide_zoom = Zoom sliding two fingers up or down
|
||||
zoom_from_center_with_wheel = Zoom from center with scroll wheel
|
||||
@ -1256,12 +1260,9 @@ native_clipboard = Use native clipboard
|
||||
native_file_dialog = Use native file dialog
|
||||
one_finger_as_mouse_movement = Interpret one finger as mouse movement
|
||||
one_finger_as_mouse_movement_tooltip = <<<END
|
||||
Only for Windows 8/10 tablets: Interprets one finger as mouse movement
|
||||
Only for Windows 8/10 Pointer API: Interprets one finger as mouse movement
|
||||
and two fingers as pan/scroll. Uncheck this to use the old behavior:
|
||||
One finger pans/scrolls.
|
||||
--
|
||||
Note: This option is available just to get the old behavior but
|
||||
will be removed in future versions.
|
||||
END
|
||||
load_wintab_driver = Load wintab32 library
|
||||
load_wintab_driver_tooltip = <<<END
|
||||
|
@ -8,6 +8,7 @@
|
||||
<view maxsize="true">
|
||||
<listbox id="section_listbox">
|
||||
<listitem text="@.section_general" value="section_general" />
|
||||
<listitem text="@.section_tablet" value="section_tablet" />
|
||||
<listitem text="@.section_files" value="section_files" />
|
||||
<listitem text="@.section_color" value="section_color" />
|
||||
<listitem text="@.section_alerts" value="section_alerts" />
|
||||
@ -73,6 +74,25 @@
|
||||
<link id="locate_crash_folder" text="@.locate_crash_folder" />
|
||||
</vbox>
|
||||
|
||||
<!-- Tablet -->
|
||||
<vbox id="section_tablet">
|
||||
<separator text="@.section_tablet" horizontal="true" />
|
||||
<radio id="tablet_api_windows_pointer" text="@.tablet_api_windows_pointer" group="1" />
|
||||
<radio id="tablet_api_wintab_system" text="@.tablet_api_wintab_system" group="1" />
|
||||
<radio id="tablet_api_wintab_direct" text="@.tablet_api_wintab_direct" group="1" />
|
||||
<separator horizontal="true" />
|
||||
<check id="one_finger_as_mouse_movement"
|
||||
text="@.one_finger_as_mouse_movement"
|
||||
tooltip="@.one_finger_as_mouse_movement_tooltip"
|
||||
pref="experimental.one_finger_as_mouse_movement" />
|
||||
<hbox>
|
||||
<check id="load_wintab_driver"
|
||||
text="@.load_wintab_driver"
|
||||
tooltip="@.load_wintab_driver_tooltip" />
|
||||
<link text="@.wintab_more_info" url="https://www.aseprite.org/docs/wintab/" />
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
||||
<!-- Files -->
|
||||
<vbox id="section_files">
|
||||
<separator text="@.section_files" horizontal="true" />
|
||||
@ -473,15 +493,10 @@
|
||||
</hbox>
|
||||
<check id="native_clipboard" text="@.native_clipboard" />
|
||||
<check id="native_file_dialog" text="@.native_file_dialog" />
|
||||
<check id="one_finger_as_mouse_movement"
|
||||
text="@.one_finger_as_mouse_movement"
|
||||
tooltip="@.one_finger_as_mouse_movement_tooltip"
|
||||
pref="experimental.one_finger_as_mouse_movement" />
|
||||
<hbox id="load_wintab_driver_box">
|
||||
<check id="load_wintab_driver"
|
||||
<check id="load_wintab_driver2"
|
||||
text="@.load_wintab_driver"
|
||||
tooltip="@.load_wintab_driver_tooltip"
|
||||
pref="experimental.load_wintab_driver" />
|
||||
tooltip="@.load_wintab_driver_tooltip" />
|
||||
<link text="@.wintab_more_info" url="https://www.aseprite.org/docs/wintab/" />
|
||||
</hbox>
|
||||
<check id="flash_layer" text="@.flash_selected_layer" />
|
||||
|
2
laf
2
laf
@ -1 +1 @@
|
||||
Subproject commit 682695222963087539541acd636096b6aefd2c8e
|
||||
Subproject commit af0f8e7b53b9e3e689b5fa4e5ce1466c42c9e2aa
|
@ -229,9 +229,14 @@ int App::initialize(const AppOptions& options)
|
||||
|
||||
#ifdef _WIN32
|
||||
if (options.disableWintab() ||
|
||||
!preferences().experimental.loadWintabDriver()) {
|
||||
system->useWintabAPI(false);
|
||||
!preferences().experimental.loadWintabDriver() ||
|
||||
preferences().tablet.api() == "pointer") {
|
||||
system->setTabletAPI(os::TabletAPI::WindowsPointerInput);
|
||||
}
|
||||
else if (preferences().tablet.api() == "wintab_packets")
|
||||
system->setTabletAPI(os::TabletAPI::WintabPackets);
|
||||
else // preferences().tablet.api() == "wintab"
|
||||
system->setTabletAPI(os::TabletAPI::Wintab);
|
||||
#endif
|
||||
|
||||
system->setAppName(get_app_name());
|
||||
|
@ -50,6 +50,7 @@ namespace app {
|
||||
namespace {
|
||||
|
||||
const char* kSectionGeneralId = "section_general";
|
||||
const char* kSectionTabletId = "section_tablet";
|
||||
const char* kSectionBgId = "section_bg";
|
||||
const char* kSectionGridId = "section_grid";
|
||||
const char* kSectionThemeId = "section_theme";
|
||||
@ -351,9 +352,47 @@ public:
|
||||
if (m_pref.experimental.useNativeFileDialog())
|
||||
nativeFileDialog()->setSelected(true);
|
||||
|
||||
#ifndef _WIN32
|
||||
oneFingerAsMouseMovement()->setVisible(false);
|
||||
#ifdef _WIN32 // Show Tablet section on Windows
|
||||
{
|
||||
os::TabletAPI tabletAPI = os::instance()->tabletAPI();
|
||||
|
||||
if (tabletAPI == os::TabletAPI::Wintab) {
|
||||
tabletApiWintabSystem()->setSelected(true);
|
||||
loadWintabDriver()->setSelected(true);
|
||||
loadWintabDriver2()->setSelected(true);
|
||||
}
|
||||
else if (tabletAPI == os::TabletAPI::WintabPackets) {
|
||||
tabletApiWintabDirect()->setSelected(true);
|
||||
loadWintabDriver()->setSelected(true);
|
||||
loadWintabDriver2()->setSelected(true);
|
||||
}
|
||||
else {
|
||||
tabletApiWindowsPointer()->setSelected(true);
|
||||
loadWintabDriver()->setSelected(false);
|
||||
loadWintabDriver2()->setSelected(false);
|
||||
}
|
||||
|
||||
tabletApiWindowsPointer()->Click.connect([this](Event&){ onTabletAPIChange(); });
|
||||
tabletApiWintabSystem()->Click.connect([this](Event&){ onTabletAPIChange(); });
|
||||
tabletApiWintabDirect()->Click.connect([this](Event&){ onTabletAPIChange(); });
|
||||
loadWintabDriver()->Click.connect(
|
||||
[this](Event&){ onLoadWintabChange(loadWintabDriver()->isSelected()); });
|
||||
loadWintabDriver2()->Click.connect(
|
||||
[this](Event&){ onLoadWintabChange(loadWintabDriver2()->isSelected()); });
|
||||
}
|
||||
#else // For macOS and Linux
|
||||
{
|
||||
// Hide the "section_tablet" item (which is only for Windows at the moment)
|
||||
for (auto item : sectionListbox()->children()) {
|
||||
if (static_cast<ListItem*>(item)->getValue() == kSectionTabletId) {
|
||||
item->setVisible(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
sectionTablet()->setVisible(false);
|
||||
loadWintabDriverBox()->setVisible(false);
|
||||
loadWintabDriverBox()->setVisible(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m_pref.experimental.flashLayer())
|
||||
@ -658,9 +697,35 @@ public:
|
||||
m_pref.experimental.nonactiveLayersOpacity(nonactiveLayersOpacity()->getValue());
|
||||
|
||||
#ifdef _WIN32
|
||||
{
|
||||
os::TabletAPI tabletAPI = os::TabletAPI::Default;
|
||||
std::string tabletStr;
|
||||
bool wintabState = false;
|
||||
|
||||
if (tabletApiWindowsPointer()->isSelected()) {
|
||||
tabletAPI = os::TabletAPI::WindowsPointerInput;
|
||||
tabletStr = "pointer";
|
||||
}
|
||||
else if (tabletApiWintabSystem()->isSelected()) {
|
||||
tabletAPI = os::TabletAPI::Wintab;
|
||||
tabletStr = "wintab";
|
||||
wintabState = true;
|
||||
}
|
||||
else if (tabletApiWintabDirect()->isSelected()) {
|
||||
tabletAPI = os::TabletAPI::WintabPackets;
|
||||
tabletStr = "wintab_packets";
|
||||
wintabState = true;
|
||||
}
|
||||
|
||||
m_pref.tablet.api(tabletStr);
|
||||
m_pref.experimental.loadWintabDriver(wintabState);
|
||||
|
||||
manager()->getDisplay()
|
||||
->setInterpretOneFingerGestureAsMouseMovement(
|
||||
oneFingerAsMouseMovement()->isSelected());
|
||||
|
||||
os::instance()->setTabletAPI(tabletAPI);
|
||||
}
|
||||
#endif
|
||||
|
||||
ui::set_use_native_cursors(m_pref.cursor.useNativeCursor());
|
||||
@ -1505,6 +1570,29 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void onTabletAPIChange() {
|
||||
if (tabletApiWindowsPointer()->isSelected()) {
|
||||
loadWintabDriver()->setSelected(false);
|
||||
loadWintabDriver2()->setSelected(false);
|
||||
}
|
||||
else if (tabletApiWintabSystem()->isSelected() ||
|
||||
tabletApiWintabDirect()->isSelected()) {
|
||||
loadWintabDriver()->setSelected(true);
|
||||
loadWintabDriver2()->setSelected(true);
|
||||
}
|
||||
}
|
||||
void onLoadWintabChange(bool state) {
|
||||
loadWintabDriver()->setSelected(state);
|
||||
loadWintabDriver2()->setSelected(state);
|
||||
if (state)
|
||||
tabletApiWintabSystem()->setSelected(true);
|
||||
else
|
||||
tabletApiWindowsPointer()->setSelected(true);
|
||||
}
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
Context* m_context;
|
||||
Preferences& m_pref;
|
||||
DocumentPreferences& m_globPref;
|
||||
|
Loading…
x
Reference in New Issue
Block a user