[fix] restore remote window dragging on X11

This commit is contained in:
dijunkun
2026-09-30 00:54:01 +08:00
parent 380a2a225c
commit ff7bda6988
3 changed files with 68 additions and 7 deletions
@@ -35,8 +35,6 @@ int PlatformMouseController::Init(std::vector<DisplayInfo> display_info_list) {
return -1;
}
root_ = DefaultRootWindow(display_);
int event_base, error_base, major_version, minor_version;
if (!XTestQueryExtension(display_, &event_base, &error_base, &major_version,
&minor_version)) {
@@ -166,7 +164,10 @@ void PlatformMouseController::SetMousePosition(int x, int y) {
if (!display_) {
return;
}
XWarpPointer(display_, None, root_, 0, 0, 0, 0, x, y);
// Inject motion through XTest so XInput2 raw-motion listeners (including
// SDL's global pointer cache) see the movement.
// XWarpPointer moves the cursor without producing those raw events.
XTestFakeMotionEvent(display_, DefaultScreen(display_), x, y, CurrentTime);
XFlush(display_);
}
@@ -54,7 +54,6 @@ class PlatformMouseController final : public MouseController {
enum class WaylandAbsoluteMode { kUnknown, kPixels, kNormalized, kDisabled };
_XDisplay* display_ = nullptr;
unsigned long root_ = 0;
std::vector<DisplayInfo> display_info_list_;
int screen_width_ = 0;
int screen_height_ = 0;