nkh / P5-App-Asciio

Plain ASCII diagram
https://nkh.github.io/P5-App-Asciio/
54 stars 4 forks source link

docs for wsl environment and mouse wheel event fix for linux #143

Closed qindapao closed 10 months ago

qindapao commented 10 months ago

@nkh I wrote a document for the installation in the WSL environment, and I put the link in our mdbook.

https://github.com/qindapao/P5-App-Asciio/tree/doc_for_wsl

In addition, remote desktop is still not that smooth to use, but it is basically usable.

qindapao commented 10 months ago

At the same time, I also fixed another problem, which is what you mentioned before. The mouse wheel event on your computer is GDK_SCROOL_SMOOTH.

In GTK3, the behavior of mouse wheel events may vary depending on the operating system. On Windows systems, wheel events are usually mapped to GDK_SCROLL_UP and GDK_SCROLL_DOWN. However, on Linux systems, many modern mouse devices and touchpads support pixel-level smooth scrolling, so wheel events may be mapped to GDK_SCROLL_SMOOTH.

The GDK_SCROLL_SMOOTH event provides a continuous amount of scrolling, which is useful for achieving smooth scrolling effects. However, if Our application needs to handle traditional scroll wheel events (such as GDK_SCROLL_UP and GDK_SCROLL_DOWN), we may need to do some extra work when handling GDK_SCROLL_SMOOTH events.

In general, this difference is mainly due to differences in how different operating systems handle mouse wheel events, as well as differences in mouse hardware and drivers

Handle the GDK_SCROLL_SMOOTH event to identify the scrolling direction of the mouse wheel. We can use the gdk_event_get_scroll_deltas() function to get the scroll delta. This function will return two values, delta_x and delta_y, which represent the scroll increment of the mouse wheel on the x-axis and y-axis respectively.

In most cases, we only care about the y-axis scroll increment, since the mouse wheel usually only scrolls in the vertical direction. A positive value of delta_y means the mouse wheel scrolls down, and a negative value means the mouse wheel scrolls up.

qindapao commented 10 months ago

smooth_scroll_zoom_in_out

Now on your computer you can use ctrl+mouse wheel to zoom in and out.

nkh commented 10 months ago

@qindapao good work, I added a comment on the code, if you change it today I'll merge it and try to make a cpan release today.

qindapao commented 10 months ago

@nkh I'm outside now, and I'll deal with it as soon as I get home.

qindapao commented 10 months ago

@nkh Hello, this is the repaired branch, I compressed it into one commit

https://github.com/qindapao/P5-App-Asciio/tree/fix_for_code_review

nkh commented 10 months ago

merged in 43103aa