Repository navigation
win32: fix cursor coordinates when starting window dragging - #4765
Closed
smittie2000 wants to merge 1 commit into
Closed
smittie2000 wants to merge 1 commit into
smittie2000 wants to merge 1 commit into
Conversation
Contributor
|
Looks sensible. |
Contributor
Author
|
I did not think of that. Let me know if i change it. Something in the lines of let position = unsafe { mem::transmute::<POINTS, u32>(points) } as LPARAM; |
smittie2000
force-pushed
the
codex/fix-win32-drag-coordinates
branch
from
October 22, 2026 10:29
3d330f0 to
1449a93
Compare
smittie2000
force-pushed
the
codex/fix-win32-drag-coordinates
branch
from
November 8, 2026 06:59
9d43d18 to
3e577b0
Compare
Contributor
Author
|
@ogoffart I'd prefer to keep the explicit packing since it avoids |
smittie2000
force-pushed
the
codex/fix-win32-drag-coordinates
branch
from
November 8, 2026 07:54
3e577b0 to
6727faa
Compare
smittie2000
force-pushed
the
codex/fix-win32-drag-coordinates
branch
from
November 8, 2026 08:05
6727faa to
82d656a
Compare
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
handle_os_draggingpostedWM_NCLBUTTONDOWNwith&points as *const _ as LPARAM,which passes the address of the
POINTSstruct rather than the coordinates.Windows reads the coordinates from the bits of
lParamitself (low word x, highword y, each a signed 16-bit value, as decoded by
GET_X_LPARAM/GET_Y_LPARAM).This packs the cursor position into
lParamdirectly. Each coordinate istruncated to
u16first, so negative positions on multi-monitor setups survivethe round trip. This affects both
Window::drag_windowandWindow::drag_resize_window.Tested on Windows 10 x64: inspecting the posted message for a move and a
south-east resize shows the wrong coordinates before this change and the correct
ones after.
See WM_NCLBUTTONDOWN.
v0.30.xstill posts the address ofPOINTShere. I'm happy to open a backport if that's wanted.