Skip to content

Fix horizontal scrolling on Windows by using MOUSEEVENTF_HWHEEL#948

Open
PekingSpades wants to merge 1 commit intoasweigart:masterfrom
PekingSpades:bugfix-windows-scroll
Open

Fix horizontal scrolling on Windows by using MOUSEEVENTF_HWHEEL#948
PekingSpades wants to merge 1 commit intoasweigart:masterfrom
PekingSpades:bugfix-windows-scroll

Conversation

@PekingSpades
Copy link
Copy Markdown

Summary

Fix hscroll() function on Windows by using MOUSEEVENTF_HWHEEL instead of MOUSEEVENTF_WHEEL.

The previous implementation of _hscroll() in _pyautogui_win.py simply called _scroll(), which uses MOUSEEVENTF_WHEEL (vertical scroll event). This caused horizontal scrolling to behave exactly like vertical scrolling.

Now _hscroll() properly uses MOUSEEVENTF_HWHEEL (0x01000) to send horizontal scroll events as documented in the Windows API.

Changes

  • Modified _hscroll() function in pyautogui/_pyautogui_win.py to use MOUSEEVENTF_HWHEEL flag
  • Added proper coordinate boundary checking (consistent with _scroll() implementation)

Related Issues

Related PRs

Test Plan

  • Test pyautogui.hscroll(3) scrolls right on Windows
  • Test pyautogui.hscroll(-3) scrolls left on Windows
  • Verify pyautogui.scroll() and pyautogui.vscroll() still work correctly

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.

1 participant