From 4928517e27bf261d667eaa4417cecef0a04b3609 Mon Sep 17 00:00:00 2001 From: Patrick Storz Date: Sat, 16 Nov 2019 22:43:27 +0100 Subject: Selectively disable motion event compression for specific tools It was globally disabled in ab71599ea1af1ea5042e35502e9aa722cc4ab51e However most of the time we do not care for intermediate motion events, and forcing to process them only causes unnecessary performance overhead. --- src/ui/tools/tool-base.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/ui/tools/tool-base.cpp') diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index eb2f2119a..0047e32ef 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -1057,6 +1057,23 @@ bool ToolBase::deleteSelectedDrag(bool just_one) { return FALSE; } +/** Enable (or disable) high precision for motion events + * + * This is intended to be used by drawing tools, that need to process motion events with high accuracy + * and high update rate (for example free hand tools) + * + * With standard accuracy some intermediate motion events might be discarded + * + * Call this function when an operation that requires high accuracy is started (e.g. mouse button is pressed + * to draw a line). Make sure to call it again and restore standard precision afterwards. **/ +void ToolBase::set_high_motion_precision(bool high_precision) { + Glib::RefPtr window = desktop->getToplevel()->get_window(); + + if (window) { + window->set_event_compression(!high_precision); + } +} + /** * Calls virtual set() function of ToolBase. */ -- cgit v1.2.3