See #23778.
This has been only tested with Jay Wayland compositor as it's the only one I could find that implements this protocol already. Unfortunately this doesn't work quite right there:
I could work around (1) but (2) makes this rather unusable, so I hope that it's a bug in Jay (at least in the scenario in which I'm using it, as a nested compositor), and I wonder if (1) couldn't be a bug too, so it would be great if somebody could please test this with a more common compositor supporting this protocol.
https://github.com/wxWidgets/wxWidgets/pull/25721
(15 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@vadz pushed 5 commits.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
@vadz pushed 3 commits.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
@vadz pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
When the mouse moves after warp, it jumps back to the old position.
at least in the scenario in which I'm using it, as a nested compositor
The X11 backend that you are using here is essentially unmaintained. In this particular case, the issue is that it receives absolute cursor positioning events from the X server. You can warp the cursor, but the next time you move the mouse it the position will be overwritten by the position the X server sends us. I don't think that is necessarily a bug, if you used another absolute positioning input method, such as a touch screen or a tablet, you would see the same behavior and it would not be surprising.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@mahkoh commented on this pull request.
In include/wx/gtk/private/wayland.h:
> @@ -18,7 +18,13 @@ // GTK version to compile the code using it. #if defined(GDK_WINDOWING_WAYLAND) && GTK_CHECK_VERSION(3,20,0) #ifdef wxHAVE_WAYLAND_CLIENT - #define wxHAVE_WAYLAND_PROTOCOLS + #include <wayland-client-protocol.h> + + // Old headers don't define this flag used in + // pointer-warp-v1-client-protocol.h, so we can't compile it with them. + #ifdef WL_MARSHAL_FLAG_DESTROY + #define wxHAVE_WAYLAND_PROTOCOLS
You should generate these files at compile time with the wayland-scanner version installed on the system. This will ensure that the generated code is in sync with the installed libwayland.
What you should do is check the required protocol xml files into the wxwidgets repository.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
The position of the cursor seems to be off by the decorations size.
I have not looked at the code but I think what is happening here is that the gtk coordinates that you are working with are not surface-local coordinates but rather xdg_surface geometry coordinates or something similar.
Since the protocol requires surface-local coordinates, you have to find a way to transform your coordinates into surface-local coordinates, or you can't use the protocol.
It could be a bug in the compositor but when I tested the code with SDL and blender it worked fine.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
You can verify this by e.g. creating an example program that warps the cursor to 100x100 and then look at the WAYLAND_DEBUG output.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@vadz commented on this pull request.
In include/wx/gtk/private/wayland.h:
> @@ -18,7 +18,13 @@ // GTK version to compile the code using it. #if defined(GDK_WINDOWING_WAYLAND) && GTK_CHECK_VERSION(3,20,0) #ifdef wxHAVE_WAYLAND_CLIENT - #define wxHAVE_WAYLAND_PROTOCOLS + #include <wayland-client-protocol.h> + + // Old headers don't define this flag used in + // pointer-warp-v1-client-protocol.h, so we can't compile it with them. + #ifdef WL_MARSHAL_FLAG_DESTROY + #define wxHAVE_WAYLAND_PROTOCOLS
Sorry, I know we're supposed to do this, but I really don't want to even think about adding support for running wayland-scanner to bakefile-generated makefiles. At least for now, we'll live with these files in the repository.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Thanks for looking at this!
Are you able to test this with some other compositor with support for this protocol?
Since the protocol requires surface-local coordinates, you have to find a way to transform your coordinates into surface-local coordinates, or you can't use the protocol.
Is the difference between these coordinates just the decorations size or is there something more to it? I don't see anything coordinates-related in xdg_surface
...
You can verify this by e.g. creating an example program that warps the cursor to 100x100 and then look at the WAYLAND_DEBUG output.
Well, this is what the modified sample does, but I'm not sure what am I supposed to conclude from this.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
You can move the cursor over the point that you think is the 100x100 point and the events will tell you the surface-local coordinates.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
You can move the cursor over the point that you think is the 100x100 point and the events will tell you the surface-local coordinates.
If you mean the coordinates from pointer_handle_motion
(part of pointer listener), then I get back exactly the coordinates I pass to it, but I'm not sure if they are "surface local".
In the meanwhile, I've also tested with mutter by running it in another VT as I still have no idea how to run it as nested compositor (again). In my uninformed opinion it looks like its implementation of the protocol is totally broken, see my comment there.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@vadz pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
I've fixed the offset with Jay by using gdk_window_get_origin()
, see e8e1433 (Account for the window origin when warping pointer using Wayland, 2025-08-29).
I'd still be very grateful if somebody could please test this with KDE, I'd rather avoid having to install (or build?) it here myself just for this...
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
I'm probably going to merge this, even if it's not very useful for now (but if my mutter MR gets merged it will at least work in GNOME when a mouse button is pressed, which is better than never working), if there are no other comments.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
My mutter MR did get merged, so merging this too. It's not perfect, but better than nothing.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Merged #25721 into master.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@vadz commented on this pull request.
In include/wx/gtk/private/wayland.h:
> @@ -18,7 +18,13 @@ // GTK version to compile the code using it. #if defined(GDK_WINDOWING_WAYLAND) && GTK_CHECK_VERSION(3,20,0) #ifdef wxHAVE_WAYLAND_CLIENT - #define wxHAVE_WAYLAND_PROTOCOLS + #include <wayland-client-protocol.h> + + // Old headers don't define this flag used in + // pointer-warp-v1-client-protocol.h, so we can't compile it with them. + #ifdef WL_MARSHAL_FLAG_DESTROY + #define wxHAVE_WAYLAND_PROTOCOLS
@mahkoh Just FYI, I think I've finally found a relative painless way to run wayland-scanner
during the build without dealing with our build system, see #25769.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.