-
-
Notifications
You must be signed in to change notification settings - Fork 548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow fixing window position to any side #763
Conversation
e2f6fa0
to
0754fe6
Compare
0754fe6
to
74f8b4d
Compare
@r0x0r What do you think? |
Sorry for the late response. I have tested this with
and could not see any difference. How should it behave? |
Ty for taking a look. The effect should come into play when you dynamically resize the window (https://github.com/r0x0r/pywebview/blob/master/webview/window.py#L240). Default is that the top left corner of the window stays on the same position. There are however scenarios when other sides should stay fixed. An example would be a notification window with variable size which changes over time. If the window were positioned on the right side of the screen and grew then in the current setup it would potentially grow over the right side of the screen. With this PR it can be set to be fixed on the 'EAST' side so that the window grows towards the left side. |
Example - should give you a steadily growing window which you can move around (not tested):
|
Thanks for the explanation. I see what this is all about now. Another suggestion is it would be better to have this as an additional optional parameter for to the resize method, eg. window.resize(100, 200, FixPoint.SOUTH) |
Thanks @r0x0r for the input. Also implemented platform gtk. However i did not test it. As to winforms and cef I did not find proper documentation regarding |
The documentation for SetWindowPos can be found here |
Finally came around to an attempt to implement remaining platforms. I did not test it. Also cef implementation is not complete. @r0x0r could you please have a look at it? |
move_y = 0 | ||
|
||
rect = windll.?.RECT() | ||
rect = windll.user32.GetWindowRect(self.inner_hwnd, rect) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@r0x0r How would I do this correctly? Do you know?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CEF code is not needed at all. The only thing the CEF code does is resizing of the CEF component. Its position always stays the same relative to the parent window.
61e2103
to
f17f124
Compare
Implements ability to configure which edge fixes the windows position.
This is valuable when resizing the window dynamically so that the user can decide which position of the window is remains fixed.
Implemented platforms so far:
Missing implementation:
Further, it should be possible to dynamically adjust the gravity point / fix position of the window during runtime.
Hence, I believe there should be a method available on
webview.window.Window
to set it.Do you have any valuable insight and suggestions?