-
-
Notifications
You must be signed in to change notification settings - Fork 23.5k
Add pointer warping on wayland #112287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add pointer warping on wayland #112287
Conversation
|
It seems the commit hash in I just copied the pointer warp xml file from the main branch, should i include the one from 1.45 if its different? |
Yea, as wayland-protocols is at that version. If the protocol is not available there feel free to make a PR updating it.
Nah, it's done in only two places now and it's something that we should generally not do, as pointed out by the big comment.
Not sure tbh. I'll be fair, in these cases I just keep them there, duplicated. You never know if the other half will be there by the time you'll need to read that comment again :P |
e95791a to
1d153b6
Compare
| return; | ||
| } | ||
|
|
||
| struct wl_surface *surface = window_get_wl_surface(p_ss->pointer_data.last_pointed_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats the difference between last_pointed_id and pointed_id? I just noticed back in pointer_warp it uses pointed_id to get the window...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm doesn't seem to make a difference. Ill just make it use pointed_id here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pointed_id is the current pointed window. It will be set to INVALID_WINDOW_ID, while last_pointed_id never gets cleared.
8850dc3 to
89faf8f
Compare
89faf8f to
9f8a4ef
Compare
|
I keep forgetting to add changed files before committing |
9f8a4ef to
1500375
Compare
|
This is not working at all on my end: Fedora Kinoite 42 / KDE Plasma 6.5.1 |
|
How did you test it? Heres a test project i made for this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. I had prefer_wayland enabled and forgot that it's an editor setting. It works now.
CC @bruvzg to check the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to try it on my machine but it looks like sway does not implement it yet. Code looks fine except for a small nitpick.
|
|
||
| if (name == registry->wp_pointer_warp_name) { | ||
| if (registry->wp_pointer_warp) { | ||
| wp_pointer_warp_v1_destroy(registry->wp_pointer_warp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to also destroy it WaylandThread::destroy().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what you mean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you have to destroy it there too? I'll add this tomorrow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea it's kinda annoying. I've considered making it automatic but I feel like it would make everything more complex for little gain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like there is some other ones also not being destroyed there? I think thats why i missed it
wp_text_input_manager , wp_tablet_manager
|
|
||
| - Upstream: https://gitlab.freedesktop.org/wayland/wayland-protocols | ||
| - Version: 1.45 (54346071a5f211f2c482889f2c8ee3b5ecda63ab, 2025) | ||
| - Version: 1.45 (0091197f5c1b1f2c131f1410e99f9c95d50646be, 2025) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the reference, old commit (or version) were wrong and correspond to 1.33.
| // See: https://oftc.irclog.whitequark.org/wayland/2023-08-23#1692756914-1692816818 | ||
| wl_pos_x = std::round(p_to.x / window_state_get_scale_factor(ws)); | ||
| wl_pos_y = std::round(p_to.y / window_state_get_scale_factor(ws)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should be:
if (!ws) {
return;
}
int wl_pos_x = std::round(p_to.x / window_....Warping to 0,0 is not expected behavior if there's no active window.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea great catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be also done for pointer_set_hint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's been a while since I wrote the original code but yea, I guess that makes more sense.
1500375 to
876d66e
Compare
fixes #64296
Note: I have no idea if how i did things is correct, this is my second time working with c++ and godot source.
I just tried to follow how things were done in the surrounding code.
Tested on latest kwin plasma 6.5.1