Bug 482687 - On X11, pointer position offset after moving window outside the left edge of screen space
Summary: On X11, pointer position offset after moving window outside the left edge of ...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: compositing (show other bugs)
Version: 6.0.1
Platform: Arch Linux Linux
: HI normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
: 482577 482688 482743 482812 482820 482878 482920 482925 482956 482975 483185 483252 483341 483527 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-03-07 11:03 UTC by Mio Nekoya
Modified: 2024-03-14 17:48 UTC (History)
17 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0.2


Attachments
Offset in action (3.22 MB, video/quicktime)
2024-03-07 11:03 UTC, Mio Nekoya
Details
kwin x11 offset even with patch applied screencast (1008.94 KB, video/mp4)
2024-03-11 01:14 UTC, Norbert Preining
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mio Nekoya 2024-03-07 11:03:07 UTC
Created attachment 166569 [details]
Offset in action

SUMMARY

When moving a window partially outside the left edge of the visible screen space, there is an offset between the visible window and cursor hitbox, as if the window is only moved "visibly" but not "actually". Quite annoying as I always move some window out the edge to save some spaces.


STEPS TO REPRODUCE
1. Launch anything that has a window and some buttons (e.g. browsers, settings etc)
2. Move it to the very left edge of the screen
3. Move it further so that part of the window is outside
4. Observe the cursor not able to click on buttons 

OBSERVED RESULT
There's an offset to the mouse position relative to the window by the exact distance the window moved outside the screen

EXPECTED RESULT
No offset of any kind, able to click on where the buttons are visibly at

SOFTWARE/OS VERSIONS
Arch Linux
Linux/KDE Plasma: 6.0.1
KDE Plasma Version: 6.0.1
KDE Frameworks Version: 6.0.0 
Qt Version:  6.6.2

ADDITIONAL INFORMATION
Comment 1 fanzhuyifan 2024-03-07 18:23:20 UTC
*** Bug 482688 has been marked as a duplicate of this bug. ***
Comment 2 fanzhuyifan 2024-03-07 18:23:40 UTC
*** Bug 482577 has been marked as a duplicate of this bug. ***
Comment 3 fanzhuyifan 2024-03-07 18:27:23 UTC
*** Bug 482743 has been marked as a duplicate of this bug. ***
Comment 4 fanzhuyifan 2024-03-07 18:38:34 UTC
Can reproduce on X11, on both master and 6.0.1
Comment 5 fanzhuyifan 2024-03-07 19:42:07 UTC
First bad commit is 904c33556b5a39e10e36d742c53d534e3d206f1b:

https://invent.kde.org/plasma/kwin/-/commit/904c33556b5a39e10e36d742c53d534e3d206f1b
Comment 6 Bug Janitor Service 2024-03-07 20:47:03 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5382
Comment 7 fanzhuyifan 2024-03-08 19:33:27 UTC
Git commit ea4fa87bc61f14f159bda75bea2248731911a5ba by Yifan Zhu.
Committed on 08/03/2024 at 19:25.
Pushed by fanzhuyifan into branch 'master'.

utils/xcbutils: Don't call toXNative with unsigned integer

Instead use signed integers, to prevent the implicit cast from unsigned
integers to qreal.

M  +4    -4    src/utils/xcbutils.h
M  +2    -2    src/workspace.cpp

https://invent.kde.org/plasma/kwin/-/commit/ea4fa87bc61f14f159bda75bea2248731911a5ba
Comment 8 fanzhuyifan 2024-03-08 19:52:57 UTC
Git commit 369c3cbd7d843b6ce2901adf8b464158f84759a1 by Yifan Zhu.
Committed on 08/03/2024 at 19:34.
Pushed by fanzhuyifan into branch 'Plasma/6.0'.

utils/xcbutils: Don't call toXNative with unsigned integer

Instead use signed integers, to prevent the implicit cast from unsigned
integers to qreal.


(cherry picked from commit ea4fa87bc61f14f159bda75bea2248731911a5ba)

M  +4    -4    src/utils/xcbutils.h
M  +2    -2    src/workspace.cpp

https://invent.kde.org/plasma/kwin/-/commit/369c3cbd7d843b6ce2901adf8b464158f84759a1
Comment 9 fanzhuyifan 2024-03-08 20:36:51 UTC
*** Bug 482820 has been marked as a duplicate of this bug. ***
Comment 10 fanzhuyifan 2024-03-09 03:08:04 UTC
*** Bug 482812 has been marked as a duplicate of this bug. ***
Comment 11 fanzhuyifan 2024-03-09 16:06:32 UTC
*** Bug 482975 has been marked as a duplicate of this bug. ***
Comment 12 fanzhuyifan 2024-03-09 16:08:08 UTC
*** Bug 482956 has been marked as a duplicate of this bug. ***
Comment 13 fanzhuyifan 2024-03-09 17:16:20 UTC
*** Bug 482878 has been marked as a duplicate of this bug. ***
Comment 14 Norbert Preining 2024-03-10 02:52:54 UTC
(In reply to fanzhuyifan from comment #8)
> Git commit 369c3cbd7d843b6ce2901adf8b464158f84759a1 by Yifan Zhu.
> Committed on 08/03/2024 at 19:34.
> Pushed by fanzhuyifan into branch 'Plasma/6.0'.
> 
> utils/xcbutils: Don't call toXNative with unsigned integer
> 
> Instead use signed integers, to prevent the implicit cast from unsigned
> integers to qreal.
[..]
> https://invent.kde.org/plasma/kwin/-/commit/
> 369c3cbd7d843b6ce2901adf8b464158f84759a1

I pulled this patch into a local build of kwin on Arch, but it did *NOT* fix the misbehaviour.
Comment 15 fanzhuyifan 2024-03-10 03:18:06 UTC
(In reply to Norbert Preining from comment #14)
> I pulled this patch into a local build of kwin on Arch, but it did *NOT* fix
> the misbehaviour.

Humm I tested on both master and Plasma/6.0, and it fixes the problem for me on top of both branches.

Could you share the steps with which you could still reproduce the problem? A screencast would be ideal.

Are you still seeing this for all windows on X11?

Thanks!
Comment 16 Nate Graham 2024-03-10 20:54:07 UTC
*** Bug 482920 has been marked as a duplicate of this bug. ***
Comment 17 Nate Graham 2024-03-10 20:54:22 UTC
*** Bug 482925 has been marked as a duplicate of this bug. ***
Comment 18 Norbert Preining 2024-03-11 01:13:33 UTC
(In reply to fanzhuyifan from comment #15)
> Could you share the steps with which you could still reproduce the problem?
> A screencast would be ideal.

I attach one

> Are you still seeing this for all windows on X11?

I tested konsole and system settings, both in screencast to be seen.

That is based on Arch Linux kwin 6.0.1-3 with 369c3cbd7d843b6ce2901adf8b464158f84759a1.patch applied.

Build log shows:

> ==> Making package: kwin 6.0.1-3.1 (Mon 11 Mar 2024 08:55:03 AM JST)
> ==> Checking runtime dependencies...
> ==> Checking buildtime dependencies...
> ==> Retrieving sources...
>  -> Found kwin-6.0.1.tar.xz
>   -> Found kwin-6.0.1.tar.xz.sig
>   -> Found 369c3cbd7d843b6ce2901adf8b464158f84759a1.patch
> ==> Validating source files with sha256sums...
>     kwin-6.0.1.tar.xz ... Passed
>     kwin-6.0.1.tar.xz.sig ... Skipped
>     369c3cbd7d843b6ce2901adf8b464158f84759a1.patch ... Passed
> ==> Verifying source file signatures with gpg...
>     kwin-6.0.1.tar.xz ... Passed
> ==> Extracting sources...
>   -> Extracting kwin-6.0.1.tar.xz with bsdtar
> ==> Starting build()...
> checking file src/utils/xcbutils.h
> checking file src/workspace.cpp
> Hunk #1 succeeded at 3020 (offset -1 lines).
> -- The C compiler identification is GNU 13.2.1
> ...
Comment 19 Norbert Preining 2024-03-11 01:14:15 UTC
Created attachment 166925 [details]
kwin x11 offset even with patch applied screencast
Comment 20 fanzhuyifan 2024-03-11 01:57:16 UTC
(In reply to Norbert Preining from comment #19)
> Created attachment 166925 [details]
> kwin x11 offset even with patch applied screencast

Yeah that definitely looks like this bug.

So I can't reproduce if I use kdesrc-build to build kwin tag 6.0.1 + 369c3cbd7d843b6ce2901adf8b464158f84759a1.
(I first verified that if I build kwin tag 6.0.1, I can reproduce)

I am on arch linux, using Qt 6.7 (with all the testing repos enabled including kde-unstable).
Comment 21 Norbert Preining 2024-03-11 02:08:39 UTC
(In reply to fanzhuyifan from comment #20)
> I am on arch linux, using Qt 6.7 (with all the testing repos enabled
> including kde-unstable).

Hmmm, looking at https://archlinux.org/packages/?sort=&repo=KDE-Unstable it seems only Qt is updated there at the moment. I am a bit nervous going to a beta version of Qt since this is my work computer.

Do you think this is purely depending on Qt updated to 6.7?
Comment 22 fanzhuyifan 2024-03-11 02:17:08 UTC
(In reply to Norbert Preining from comment #21)
> Hmmm, looking at https://archlinux.org/packages/?sort=&repo=KDE-Unstable it
> seems only Qt is updated there at the moment. I am a bit nervous going to a
> beta version of Qt since this is my work computer.
> 
> Do you think this is purely depending on Qt updated to 6.7?

I would be very surprised since the relevant code doesn't seem to be related to Qt at all. 
I'll try testing by rebuilding the arch package with the commit, and also test on neon unstable, which uses Qt 6.6.

Do you have any core-testing and extra-testing enabled, by the way?
Comment 23 Norbert Preining 2024-03-11 02:20:08 UTC
(In reply to fanzhuyifan from comment #22)
> Do you have any core-testing and extra-testing enabled, by the way?

No, only default repositories (core,extra,multilib)
Comment 24 fanzhuyifan 2024-03-11 03:00:11 UTC
(In reply to Norbert Preining from comment #23)
> (In reply to fanzhuyifan from comment #22)
> > Do you have any core-testing and extra-testing enabled, by the way?
> 
> No, only default repositories (core,extra,multilib)

This might be worth a shot -- can you reproduce if you revert https://invent.kde.org/plasma/kwin/-/commit/904c33556b5a39e10e36d742c53d534e3d206f1b? For me that was the first bad commit.

I can't reproduce on neon unstable, which uses Qt 6.6, so we could rule that out.
I also can't reproduce if I build the arch package with the patch. None of the packages I installed from extra-testing or core-testing seem remotely related.
Comment 25 fanzhuyifan 2024-03-11 04:13:24 UTC
*** Bug 483185 has been marked as a duplicate of this bug. ***
Comment 26 Norbert Preining 2024-03-11 04:48:45 UTC
Wait ... I blindly copied a test run to the PKGBUILD and it contained --dry-run ... let me rerun the test without the revert and see if it works

Sorry for the confusion, now when I tried to add the other patch for reverting I found the --dry-run
Comment 27 Norbert Preining 2024-03-11 04:54:06 UTC
Sorry again, with properly applied patch 369c3cbd7d843b6ce2901adf8b464158f84759a1 I cannot reproduce the failure :-(
Sorry for the noise!
Comment 28 fanzhuyifan 2024-03-11 05:03:33 UTC
(In reply to Norbert Preining from comment #27)
> Sorry again, with properly applied patch
> 369c3cbd7d843b6ce2901adf8b464158f84759a1 I cannot reproduce the failure :-(
> Sorry for the noise!

Glad to hear it's working! You're all good
Comment 29 Nate Graham 2024-03-11 19:24:37 UTC
*** Bug 483252 has been marked as a duplicate of this bug. ***
Comment 30 fanzhuyifan 2024-03-12 15:48:13 UTC
*** Bug 483341 has been marked as a duplicate of this bug. ***
Comment 31 Jon 2024-03-13 18:36:25 UTC
Yifan's fix is included in kwin 6.0.2, tested from arch kde-unstable repo and it fixes this issue for me.  Thanks Yifan!
Comment 32 fanzhuyifan 2024-03-14 17:48:45 UTC
*** Bug 483527 has been marked as a duplicate of this bug. ***