AltF02 / AltF02/x11-rs

xtst: XTestFakeRelativeMotionEvent has wrong signature

オープン
#182 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
205
フォーク
69
PR マージ指標
30日以内にマージされた PR はありません

説明

According to
https://refspecs.linuxfoundation.org/LSB_4.0.0/LSB-Desktop-generic/LSB-Desktop-generic.html
signature is
```c
extern int XTestFakeRelativeMotionEvent(Display *, int, int,
unsigned long int);
```
same in https://gitlab.freedesktop.org/xorg/lib/libxtst/-/blob/master/include/X11/extensions/XTest.h?ref_type=heads
```c
extern int XTestFakeRelativeMotionEvent(
Display* /* dpy */,
int /* x */,
int /* y */,
unsigned long /* delay */
);
```
and in implementation https://cgit.freedesktop.org/xorg/lib/libXtst/tree/src/XTest.c

But some manpages like https://man.freebsd.org/cgi/man.cgi?query=XTestFakeRelativeMotionEvent&sektion=3&manpath=freebsd-ports have it wrong
```c
int XTestFakeRelativeMotionEvent(display, screen_number, x, y, delay);

Display *display;
int screen_number;
int x, y;
unsigned long delay;
```
as well as this doc https://www.x.org/releases/X11R7.7/doc/libXtst/xtestlib.html
and same in this crate https://github.com/AltF02/x11-rs/blob/master/src/xtest.rs#L25

It seems like manpages were always wrong
https://cgit.freedesktop.org/xorg/lib/libXtst/commit/?id=d9514f97f54b47630b645ef44a5d40262a10d33a - adds manpages
and it doesn't match actual signature from same tree https://cgit.freedesktop.org/xorg/lib/libXtst/tree/src/XTest.c?id=d9514f97f54b47630b645ef44a5d40262a10d33a

So, signature without `screen_number` should be used.

I have also tested that correct signature behaves without weird randomness or crashes I saw in current signature.
Tested via manual linking of correct signature under different name
```rust
extern "C" {
#[link_name = "XTestFakeRelativeMotionEvent"]
pub fn XTestFakeRelativeMotionEvent_fixed (_5: *mut _XDisplay, _3: c_int, _2: c_int, _1: c_ulong) -> c_int;
}
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。