这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@maxbla
Copy link
Contributor

@maxbla maxbla commented Mar 28, 2020

fixes #31
closes #35 also

@Narsil
Copy link
Owner

Narsil commented Mar 28, 2020

Can you rebase for the tests to pass ? (I added a timeout so they would at least crash. I had to crash them by hand here)

@maxbla
Copy link
Contributor Author

maxbla commented Mar 29, 2020

I rebased so this can be merged, but it isn't yet ready - I haven't looked at the windows code.

maxbla added 9 commits March 29, 2020 20:08
changes some instances of u32 to c_int when calling functions take c_int
as an argument. c_int is an alias for u32 on 32-bit and 64-bit linux,
so this has little practical effect, but it makes intent clear and may
improve portability to other, more exoctic systems.
change keycodes type to CGKeyCode in an attempt to improve portability
decl_keycodes makes keycodes.rs smaller by replacing the 3 repeditive
blocks of keycodes and conversion functions with a macro and one large
block of keycodes.
decl_keycodes declared consts that were not used elsewhere. This was
exactly how the non-macro version did it for readability, but the macro
improves readability enough that the consts aren't needed.
Changed all instances of i32 being passed to function taking c_int to
c_int, and not an i32, despite those being the same on 32 and 64-bit
linux. (similar steps for all integer types). All instances of
Result<T, ()> were replaced with Option<T>, and some error handling
code was made more brief.
X11's "BYTE" isn't guaranteed to be the same as Rust's u8. For example,
on some architectures, char is 16 bits (mostly DSPs)
Copy link
Owner

@Narsil Narsil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits here and there, but it feels like much better code.

headless: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- os: ubuntu-latest
dependencies: sudo apt install libxtst-dev
dependencies: sudo apt-get install libxtst-dev
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather we keep apt instead of apt-get.
(https://itsfoss.com/apt-vs-apt-get-difference/)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apt-get maintains backward compatibility, whereas apt does not - it is designed for humans source. Using apt-get in scripts is a best practice. It should actually be sudo apt-get install libxtst-dev --assume-yes

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough ! I learned something.

@Narsil Narsil merged commit 40d3bf1 into Narsil:master Mar 30, 2020
@maxbla
Copy link
Contributor Author

maxbla commented Mar 30, 2020

I wasn't done! I'm still working on windows!

@Narsil
Copy link
Owner

Narsil commented Mar 30, 2020

Oh sorry, can you push another PR ? I thought you wanted another PR for windows. (Maybe put WIP in PR name, I usually use this to know that it is not meant to be merged)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Why do we need to enable XSynchronization? Mixing Rust types with C types

2 participants