[Webkit-unassigned] [Bug 276422] New: [GTK] MouseEvent movementX/Y have rounding errors

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 10 04:28:20 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=276422

            Bug ID: 276422
           Summary: [GTK] MouseEvent movementX/Y have rounding errors
           Product: WebKit
           Version: WebKit Local Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKitGTK
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: rpsalmi at gmail.com
                CC: bugs-noreply at webkitgtk.org

Created attachment 471861

  --> https://bugs.webkit.org/attachment.cgi?id=471861&action=review

Example HTML demonstrating the issue

Ubuntu 22.04.4
WebKitGTK 2.44.2-0ubuntu0.22.04.1 OR local build on main

This HTML demonstrates a box moving according to the sum of movementX/Y values. You can reset the location of the box by clicking.

<div id="box" style="background:red; width:50px; height:50px; position:fixed;"></div>
<script>
        let x = window.innerWidth / 2;
        let y = window.innerHeight / 2;
        function update() {
                document.getElementById("box").style.left = x;
                document.getElementById("box").style.top = y;
        }
        update();
        document.addEventListener("mousemove", (e) => {
                x += e.movementX;
                y += e.movementY;
                update();
        });
        document.addEventListener("click", (e) => {
                x = window.innerWidth / 2;
                y = window.innerHeight / 2;
                update();
        });
</script>

On both GTK3 and GTK4, the box does not accurately track the cursor.
If the cursor is moved slowly, the box doesn't move as much as it should. If moved very slowly, the box doesn't move at all.
Likely a rounding issue.

The effect is more pronounced when display DPI scaling is set to e.g. 200%, as the pointer must move a greater distance to cover one logical pixel.

Follow-up from https://bugs.webkit.org/show_bug.cgi?id=275148

Related, but likely different cause: https://bugs.webkit.org/show_bug.cgi?id=235116

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240710/88f7f586/attachment.htm>


More information about the webkit-unassigned mailing list