Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-06-24 01:19:08 +0300
committerCampbell Barton <campbell@blender.org>2022-06-24 01:19:08 +0300
commit4919403c299682901702234a735e27c053bfe96d (patch)
treec49c69d5cf701133c6bdcc3c8384e19684eb92a9
parent41a0411d79382485f39470fa319e10ec2e1c53be (diff)
Fix outdated pressure/tilt for tablet motions events under GHOST/Wayland
Accumulate tablet data before generating an event using the 'frame' callback.
-rw-r--r--intern/ghost/intern/GHOST_SystemWayland.cpp28
1 files changed, 16 insertions, 12 deletions
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 = {