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-10-28 05:08:41 +0300
committerCampbell Barton <campbell@blender.org>2022-10-28 05:08:41 +0300
commitaf761021a3437574fe43ce8e5136eabf9a4fd38e (patch)
treef05e5ca1ab08eb9a45bc03ba847b1a07a8ef0761
parent48d8aa74847231700db8154320d058e82fe7df4a (diff)
GHOST/Wayland: code-comments
Note issues with track-pad event handling, add some other notes too.
-rw-r--r--intern/ghost/intern/GHOST_SystemWayland.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 86b7a0f25f6..c15307da0b8 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -2429,10 +2429,11 @@ static void pointer_handle_frame(void *data, struct wl_pointer * /*wl_pointer*/)
wl_fixed_to_int(scale * seat->pointer.xy[0]),
wl_fixed_to_int(scale * seat->pointer.xy[1]),
/* NOTE: scaling the delta doesn't seem necessary.
- * NOTE: inverting delta gives correct results, see: QTBUG-85767. */
+ * NOTE: inverting delta gives correct results, see: QTBUG-85767.
+ * NOTE: the preference to invert scrolling (in GNOME at least)
+ * has already been applied so there is no need to read this preference. */
-wl_fixed_to_int(seat->pointer_scroll.smooth_xy[0]),
-wl_fixed_to_int(seat->pointer_scroll.smooth_xy[1]),
- /* TODO: investigate a way to request this configuration from the system. */
false));
}
@@ -2552,6 +2553,18 @@ static void gesture_pinch_handle_begin(void *data,
if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
win = ghost_wl_surface_user_data(wl_surface_focus);
}
+ /* NOTE(@campbellbarton): Blender's use of track-pad coordinates is inconsistent and needs work.
+ * This isn't specific to WAYLAND, in practice they tend to work well enough in most cases.
+ * Some operators scale by the UI scale, some don't.
+ * Even this window scale is not correct because it doesn't account for:
+ * 1) Fractional window scale.
+ * 2) Blender's UI scale preference (which GHOST doesn't know about).
+ *
+ * If support for this were all that was needed it could be handled in GHOST,
+ * however as the operators are not even using coordinates compatible with each other,
+ * it would be better to resolve this by passing rotation & zoom levels directly,
+ * instead of attempting to handle them as cursor coordinates.
+ */
const wl_fixed_t win_scale = win ? win->scale() : 1;
/* NOTE(@campbellbarton): Scale factors match Blender's operators & default preferences.
@@ -4304,6 +4317,8 @@ static void gwl_registry_wl_output_remove(GWL_Display *display,
void *user_data,
const bool /*on_exit*/)
{
+ /* While windows & cursors hold references to outputs, there is no need to manually remove
+ * these references as the compositor will remove references via #wl_surface_listener.leave. */
GWL_Output *output = static_cast<GWL_Output *>(user_data);
wl_output_destroy(output->wl_output);
std::vector<GWL_Output *>::iterator iter = std::find(
@@ -4841,9 +4856,9 @@ GHOST_SystemWayland::GHOST_SystemWayland(bool background)
struct wl_registry *registry = wl_display_get_registry(display_->wl_display);
display_->wl_registry = registry;
wl_registry_add_listener(registry, &registry_listener, display_);
- /* Call callback for registry listener. */
+ /* First round-trip to receive all registry objects. */
wl_display_roundtrip(display_->wl_display);
- /* Call callbacks for registered listeners. */
+ /* Second round-trip to receive all output events. */
wl_display_roundtrip(display_->wl_display);
/* Account for dependencies between interfaces. */