Bug 433224 - The mouse event has a region that does not work for a scaled xwayland window
Summary: The mouse event has a region that does not work for a scaled xwayland window
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.21.0
Platform: Other Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-19 07:07 UTC by Weng Xuetian
Modified: 2021-03-19 19:21 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.22


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Weng Xuetian 2021-02-19 07:07:05 UTC
SUMMARY


STEPS TO REPRODUCE
1. set scale to 125%
2. open xev, enlarge the window to be the same size as the screen.
3. try to select some text from xterm

OBSERVED RESULT
If you move the mouse to the right edge, you will notice that from a certain point, the mouse X coordinate doesn't go further right and stop there, while the mouse cursor can still be more "right" to the event. For example, on my screen (1920x1080), the maximum X of the mouse event reported by xev is 1279, no matter how much you move mouse beyond that point, the x is still 1279. On the scaled screen, it should be able to reach as much as 1536 (1920 / 1.25).

EXPECTED RESULT
The mouse event can correctly move with in the window.


SOFTWARE/OS VERSIONS

Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.21
KDE Frameworks Version: 5.79
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Comment 1 Weng Xuetian 2021-02-19 07:16:58 UTC
This seems only happen when change the scale back and forth. It works after a clean login.

I changed to 150% first, then back to 125% and noticed this issue.

Looks like there's some inconsistency state with in the kwin.
Comment 2 Vlad Zahorodnii 2021-02-19 08:41:36 UTC
Please report this issue to Xwayland developers.

If I set a scale factor of 1.5 on my 1920x1080 monitor, kwin sends out a logical_size event with correct size

[1159322.527] zxdg_output_v1@14.logical_size(1280, 720)
[1159322.536] zxdg_output_v1@14.done()

If I set a scale factor of 1.25 on my 1920x1080 monitor, kwin sends out a logical_size event with correct size as well

[1219097.163] zxdg_output_v1@14.logical_size(1536, 864)
[1219097.191] zxdg_output_v1@14.done()

When the pointer is close to the bottom right corner of xev, the motion events carry expected position, but xev still reports that the pointer is at 1279, 719

[1265188.945] wl_pointer@25.motion(148413, 1529.000000, 853.000000)
[1265189.050] wl_pointer@25.frame()
[1265189.088] zwp_relative_pointer_v1@26.relative_motion(0, 148413009, 1.773438, 0.000000, 2.000000, 0.000000)
[1265189.197] wl_pointer@25.frame()
[1265198.946] wl_pointer@25.motion(148423, 1531.000000, 854.000000)
[1265199.050] wl_pointer@25.frame()
[1265199.088] zwp_relative_pointer_v1@26.relative_motion(0, 148423010, 2.000000, 1.000000, 2.000000, 1.000000)
[1265199.197] wl_pointer@25.frame()
[1265206.944] wl_pointer@25.motion(148431, 1533.000000, 855.000000)
[1265207.050] wl_pointer@25.frame()
[1265207.087] zwp_relative_pointer_v1@26.relative_motion(0, 148431011, 2.000000, 1.000000, 2.000000, 1.000000)
[1265207.181] wl_pointer@25.frame()

This looks like an Xwayland issue.
Comment 3 Vlad Zahorodnii 2021-02-19 08:42:51 UTC
(^ to get the wayland debug log output, I ran kwin with KWIN_XWAYLAND_DEBUG=1)
Comment 4 Weng Xuetian 2021-03-05 16:49:41 UTC
So here's my observation:
Xwayland always received the "old size request", instead of the latest one.

when set 150% -> xrandr output is still the last value.

This is done by check kwin log and the xrandr output under wayland.

Also I didn't notice that gnome-shell has the same problem. So I wonder if kwin is missing some kind "flush" operation in the implemenation.
Comment 5 Vlad Zahorodnii 2021-03-09 11:57:14 UTC
(In reply to Weng Xuetian from comment #4)
> So here's my observation:
> Xwayland always received the "old size request", instead of the latest one.

The last time I checked it, kwin was sending out the latest output information. If there is something wrong with Xrandr outputs, it's most likely an issue in Xwayland.

> when set 150% -> xrandr output is still the last value.
> 
> This is done by check kwin log and the xrandr output under wayland.
> 
> Also I didn't notice that gnome-shell has the same problem. So I wonder if
> kwin is missing some kind "flush" operation in the implemenation.
Comment 6 Bug Janitor Service 2021-03-11 22:29:30 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/773
Comment 7 Weng Xuetian 2021-03-19 19:05:43 UTC
Git commit e004156aba52fc025f491b11ac26b0e9f873803e by Weng Xuetian.
Committed on 19/03/2021 at 17:39.
Pushed by xuetianweng into branch 'master'.

Add explicit done to OutputInterface and deprecate zxdg_output_v1.done if version 3 is used.

In zxdg_output_v1 version 3, done is deprecated and should be replaced
with wl_output.done. This makes automatically send done upon change not
suitable for the usage. OutputInterface user should now use done()
explicitly to send the update.

M  +7    -0    autotests/client/test_wayland_output.cpp
M  +1    -0    autotests/client/test_xdg_output.cpp
M  +7    -4    src/server/output_interface.cpp
M  +6    -0    src/server/output_interface.h
M  +19   -6    src/server/xdgoutput_v1_interface.cpp
M  +1    -1    src/server/xdgoutput_v1_interface.h

https://invent.kde.org/plasma/kwayland-server/commit/e004156aba52fc025f491b11ac26b0e9f873803e
Comment 8 Weng Xuetian 2021-03-19 19:07:23 UTC
Git commit d612d76e09ec5d8d26121d3e2dee17ef4867f5f7 by Weng Xuetian.
Committed on 19/03/2021 at 16:53.
Pushed by xuetianweng into branch 'master'.

Replace xdg output done with explicit wl_output done

M  +6    -1    src/abstract_wayland_output.cpp

https://invent.kde.org/plasma/kwin/commit/d612d76e09ec5d8d26121d3e2dee17ef4867f5f7