[Bf-blender-cvs] [4919403c299] master: Fix outdated pressure/tilt for tablet motions events under GHOST/Wayland
Campbell Barton
noreply at git.blender.org
Fri Jun 24 00:22:10 CEST 2022
Commit: 4919403c299682901702234a735e27c053bfe96d
Author: Campbell Barton
Date: Fri Jun 24 08:19:08 2022 +1000
Branches: master
https://developer.blender.org/rB4919403c299682901702234a735e27c053bfe96d
Fix outdated pressure/tilt for tablet motions events under GHOST/Wayland
Accumulate tablet data before generating an event using the 'frame'
callback.
===================================================================
M intern/ghost/intern/GHOST_SystemWayland.cpp
===================================================================
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 2adbca7ee40..85860bccbe3 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -1447,21 +1447,11 @@ static void tablet_tool_handle_motion(void *data,
{
tablet_tool_input_t *tool_input = static_cast<tablet_tool_input_t *>(data);
input_t *input = tool_input->input;
- GHOST_WindowWayland *win = window_from_surface(input->focus_tablet);
- if (!win) {
- return;
- }
input->xy[0] = x;
input->xy[1] = y;
- const wl_fixed_t scale = win->scale();
- input->system->pushEvent(new GHOST_EventCursor(input->system->getMilliSeconds(),
- GHOST_kEventCursorMove,
- win,
- wl_fixed_to_int(scale * input->xy[0]),
- wl_fixed_to_int(scale * input->xy[1]),
- tool_input->data));
+ /* NOTE: #tablet_tool_handle_frame generates the event (with updated pressure, tilt... etc). */
}
static void tablet_tool_handle_pressure(void *data,
@@ -1575,10 +1565,24 @@ static void tablet_tool_handle_button(void *data,
input->system->pushEvent(new GHOST_EventButton(
input->system->getMilliSeconds(), etype, win, ebutton, tool_input->data));
}
-static void tablet_tool_handle_frame(void * /*data*/,
+static void tablet_tool_handle_frame(void *data,
struct zwp_tablet_tool_v2 * /*zwp_tablet_tool_v2*/,
uint32_t /*time*/)
{
+ tablet_tool_input_t *tool_input = static_cast<tablet_tool_input_t *>(data);
+ input_t *input = tool_input->input;
+ GHOST_WindowWayland *win = window_from_surface(input->focus_tablet);
+ if (!win) {
+ return;
+ }
+
+ const wl_fixed_t scale = win->scale();
+ input->system->pushEvent(new GHOST_EventCursor(input->system->getMilliSeconds(),
+ GHOST_kEventCursorMove,
+ win,
+ wl_fixed_to_int(scale * input->xy[0]),
+ wl_fixed_to_int(scale * input->xy[1]),
+ tool_input->data));
}
static const struct zwp_tablet_tool_v2_listener tablet_tool_listner = {
More information about the Bf-blender-cvs
mailing list