-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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
UI: Support drag and move projector when clicking inside the window #8138
base: master
Are you sure you want to change the base?
UI: Support drag and move projector when clicking inside the window #8138
Conversation
Not sure how to resolve
since I suppose I can't change QT event function signature. Is there anyway to add exceptions? |
In C++, you can simply omit the parameter name from the function signature if you're not going to use it, like so:
Otherwise, you would use |
IMO the cursor should default to the resize variant when the projector is set to be borderless to clearly communicate the functionality a user can expect. When the projector has a border, the functionality should be disabled, as the correct way to move a window is to use its title bar. |
@RytoEX thanks, I have updated PR and now drone builds are passed. @PatTheMav I see your point, but since this PR is based on master branch, there's no borderless support yet, so I can't add what you asked. These requirements might need to be in a separate PR, or we need to wait until borderless support is merged. |
Finally had some time to test this PR. Note I'm testing on Windows with Qt 6.4.2, with one display at a 125% DPI (though this happens on all 100% DPI screens). 2023-03-17_20-40-20.mp4 |
e59b592
to
04694d5
Compare
@WizardCM Hi, I wasn't able to reproduce the issue you experienced, but I changed the implementation anyway, could you test again? |
08.14.2023 UpdateRedco the PR with following changes:
|
I can already do this move by holding down the ALT key on MATE desktop, will there be conflict? |
@fsworld009 I have the same problems with movement as @WizardCM. Seems more likely to happen at higher movement speeds / high DPIs. I use 5200 so it's very easy for me to cause it Qt docs actually warn against this approach
The docs also suggestion using globalPosition() instead when moving a window via a widget
|
I've pushed a commit to this branch that uses globalPosition() instead which appears to fix the issue. If this works fine for others, it can be squashed. I also agree with @PatTheMav that I'd like to see this only apply to frameless mode, so I'll make further adjustments when #9430 is merged. |
Description
Support drag and move projector when clicking inside the window.
This is based on WizardCM@9ee79ac which is mentioned in #5818 (comment)
but I changed how the new location is computed when dragging:
It is now computed by comparing initial mouse absolute position and the current mouse absolute position, and the diff is always applied to the initial window position. This way, the window's top left corner doesn't snap to mouse cursor like the mentioned commit, the behavior is now the same as dragging by clicking the window title.08.14.2023 Update
Redco the PR with following changes:
this->window()->move()
to move window instead ofthis->move()
. This is much smoother and works well by only computing diff based on mouse event position. Ref: https://stackoverflow.com/a/39821779/3973896Note: I can't change target branch to be another PR branch, so currently I can't enable drag to move only for frameless window. Will need to wait until related PR is merged in.
Motivation and Context
I suppose this functionality is essential for frameless window support (#5818, #7892, or #9430), which I look forward to, so I made this PR.
How Has This Been Tested?
Built the code on my Windows 10 Machine and manually tested my changes.
Types of changes
Checklist: