Implement WindowBuilder::resizable and WindowHandle::resizable for windows#712
Conversation
| style |= (WS_THICKFRAME | WS_MAXIMIZEBOX) as LONG_PTR; | ||
| } else { | ||
| style &= !(WS_THICKFRAME | WS_MAXIMIZEBOX) as LONG_PTR; |
There was a problem hiding this comment.
Need to use WindowLongPtr instead of LONG_PTR for 32-bit support.
There was a problem hiding this comment.
Is WindowLongPtr a type? I can't seem to find it in the winapi docs. From what I understand GetWindowLongPtrW and SetWindowLongPtrW returns and uses LONG_PTR which is 32 bit on 32 bit windows, and 64 bit on 64 bit windows.
There was a problem hiding this comment.
It's a bit confusing for sure.
WindowLongPtris a druid-shell type defined inwindow.rsaka this very same file. You can search for it to see its definition.GetWindowLongPtrWonly works on 64-bit but the Rustwinapicrate we're using correctly aliases that function toGetWindowLongWin 32-bit mode.
There was a problem hiding this comment.
Ah, thanks! I didn't think to look in druid for WindowLongPtr type.. ;) I'm a bit confused though as to why it is neccesary:
- According to MSDN
LONG_PTRis defined to be the size of a pointer, that is 4 bytes on 32 bit windows, and 8 bytes on 64 bit windows. LONG_PTR docs - In the winapi crate
LONG_PTRis defined to beisize, which also is 4 bytes on 32 bit windows, and 8 bytes on 64 bit windows: isize docs, winapi LONG_PTR docs
Am I missing something?
There was a problem hiding this comment.
Ah I found issue #437, I had expected this to be the same between using the windows API in C++ and rust.. Will change it :)
There was a problem hiding this comment.
Well the docs for GetWindowLongPtrW state that for 32-bit support you should use GetWindowLongPtr instead which is aliased to GetWindowLong on 32-bit.
The rust winapi crate aliases GetWindowLongPtrW to GetWindowLongW on 32-bit. The GetWindowLongW expects i32 while GetWindowLongPtrW expects isize.
There was a problem hiding this comment.
Alright, makes sense. Seems like it's something that might be getting changed in winapi 0.4. Thanks for explaining!
|
Thanks for the review @xStrom! I completely neglected error handling, giving it another pass soon :) |
|
Updated with error handling and |
|
This seems good, but we're having issues with the testing system here (#724 fixed it for the future, but doesn't apply here). Could you re-push so that it triggers the testing on a new commit? For example combine your two commits into one and force push to your branch. |
1b3971d to
17c1852
Compare
Implementation of #633 for windows.
When

WindowBuilder::resizableorWindowHandle::resizableis set tofalsethe window can no longer be resized by dragging on the borders, and the window can no longer be maximized.