-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
Try let the window manager move the window, fixes #429 #445
Conversation
Whoops, I see I'm uploading here CMakeLists.txt.user. Is it not in gitignore? |
It seems that file is generated by QtCreator (which I personally don't use), but it should be fine to add it to |
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.
Note that you'll want to do the same change to the UpdaterWindow
.
src/mainwindow.cpp
Outdated
int dy = event->globalY() - m_mousePressY; | ||
move(dx, dy); | ||
|
||
if (!window()->windowHandle()->startSystemMove()) { |
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.
I have no idea whether it is fine to continuously call this function on all platforms. Or does mouseMoveEvent
stop being called when this function succeeded? The documentation doesn't say anything about it, so I guess we could just test.
Alternatively, this function could be called in MainWindow::mousePressEvent
instead, where we maybe could do m_canMoveWindow = !window()->windowHandle()->startSystemMove()
instead of just assigning true
(untested)
My C++ and Qt skills are quite rusty. If someone wants to take that PR, I'd be glad 😅 Also, why is after adding
Good catch. I tried but with no success. I got |
You're maintaining this thing, I think I'll let you the opportunity to get a little bit less rusty. ;-)
Because you added it to
It means you need to add |
Haha fair. Thanks for the tip. Seems to work now. Let me know if it's fine. @zjeffer Thanks 😉 |
343212a
to
0caa228
Compare
I fixed the qt5.9 build, rebased and squashed the commits. @mominul can you test this on wayland by downloading the latest build from here: https://github.com/nuttyartist/notes/actions/runs/3976090004. At the bottom, you can download the AppImages for both Qt5 and Qt6. |
The AppImages currently don't include the Wayland platform plugin, so it will just fallback to XWayland. However, I think it's just a matter of installing the If that doesn't work, we'll have to find a way to include the Wayland plugin manually. I would add those changes myself, but I'm not home at the moment... @zjeffer Feel free to experiment, if you want. If that doesn't work, I can pick it up from where you left later. |
Feel free to merge this when it's ready. |
Okay, I think we aren't quite there yet regarding Wayland support in AppImages. And even people much smarter than me seem to agree: linuxdeploy/linuxdeploy-plugin-qt#25 First, because it's a struggle to bundle all the required Wayland libraries. Even though I succeeded (to the best of my knowledge, anyway). But I either experienced random, weird behavior, like this one: wayland.mp4... Or just straight up the crashing of the whole desktop (wtf, GNOME?):
Even if those are rare and I was just unlucky, I don't think it's something we want to ship to users, considering that the Xbc backend still works and offers a better experience overall. |
Regarding the changes itself, I'm experiencing some very weird behavior while testing the Qt 5 build on Linux (not running on Wayland)... After moving the window for a bit (and then releasing it), the mouse cursor will flicker like crazy sometimes: weird-behavior-after-moving-window.mp4Not only that, clicking on the text editor makes the window manager think we are grabbing the window again, lol. |
I realized I'm also getting some strange bugs: notes-2023-01-22_21.06.51.mp4Here's me with this PR's branch on bspwm, which uses X11. Resizing with bspwm's keyboard shortcuts works fine: I press super+left click on the window to move, super+right click near a corner to resize.
EDIT: Oops, looks like this behaviour has been present for a while. The aur's latest version and the dev version both have these bugs on bspwm. I'll create a separate issue. I never use this app in floating mode so I've never noticed this behaviour before. |
LOL, that's hilariously broken. We'll need to investigate some more... |
So is it not preferable to let the window manager handle the move operation if supported? |
It definitely is, IMO. It's just that it's probably broken thanks to our own window management code, so we should fix it first. |
So what's left here to fix? If this solution is still better than our previous one, I think we can merge this and open a new issue. |
This is the only issue that currently remains for completing version 2.1.0. |
This provides more direct feedback (mouse changes to move cursor on press already on GNOME), avoids repeated calls in case the system move is not supported and simplifies the code a little.
I've pushed a change that addresses my comment.
While ideally we'd also improve / fix the resize behavior in 2.1, I think this PR is ready to be merged. |
Right now this change only affects non-Windows builds, but I think we should also add this functionality on Windows, which appears to be done here instead: Lines 2806 to 2814 in 1471e87
|
Ah, the Windows code was added elsewhere, my bad. LGTM! |
Yeah, in general I think we could do better in unifying certain code paths, but for now i just adjusted both versions of the |
Tested and works. Merging... Thanks everybody! |
This should fix #429. Can you please review if the code is satisfactorily written?