-
Notifications
You must be signed in to change notification settings - Fork 816
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
Misc fixes for Windows 7 #2589
Misc fixes for Windows 7 #2589
Conversation
src/gui/systray.cpp
Outdated
@@ -374,26 +380,23 @@ QPoint Systray::computeWindowPosition(int width, int height) const | |||
const auto windowRect = [=]() { | |||
const auto rect = QRect(topLeft, bottomRight); | |||
auto offset = QPoint(); | |||
|
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.
nitpick: please don't remove those empty lines, this has nothing to do with the rest of your patch and reduced readability IMHO.
src/gui/systray.cpp
Outdated
@@ -241,6 +241,12 @@ Systray::TaskBarPosition Systray::taskbarOrientation() const | |||
auto taskbarPosition = Utility::registryGetKeyValue(HKEY_CURRENT_USER, | |||
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StuckRects3", | |||
"Settings"); | |||
if (taskbarPosition.isNull()) { |
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 think it'd be better to do a check on the key before hand using the registryKeyExists function you introduced to determine if we're going with StuckRects3 or StuckRects2. And then making a single registryGetKeyValue call with that key.
A bit like this:
QString taskbarPositionSubkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StuckRects3";
if (!Utility::registryKeyExists(HKEY_CURRENT_USER, taskbarPositionSubkey)) {
taskbarPositionSubkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StuckRects3";
}
auto taskbarPosition = Utility::registryGetKeyValue(HKEY_CURRENT_USER, taskbarPositionSubkey, "Settings");
I think it'd show the intent better.
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.
OK, updated it
Ah also: please make sure all your changes are in a single commit and also please ensure you please the DCO bot. Thanks in advance. |
I'm wondering what the issue was? Because the check of the return value of RegOpenKeyEx is already done in the Utility::registryGetKeyValue (just like you do in the new registryKeyExists now), thus it's duplicated that way. If no key is found, it returns an empty QVariant: Don't mind the change though, extracting this into a separate check function that return a bool (which is easier to understand/harder to misuse) may be a good idea. |
@DominiqueFuchs the issue was that registryWalkSubKeys has an assert that fails if the key is not found:
Instead of adding |
registryKeyExists is needed anyway for the other part of the patch. So definitely a keeper.
I like your patch as is, but I like this idea quite a bit as well. Your call. Just let me know what you want to do. |
OK, let's keep it as is |
/rebase |
Signed-off-by: Sergey Zolotarev <[email protected]>
13ac775
to
18c1bc0
Compare
AppImage file: Nextcloud-PR-2589-18c1bc0bd66be5f70965a45ba106a855b1013e5a-x86_64.AppImage |
This fixes the following issues with the desktop app on Windows 7:
Registry key
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace
does not existTask bar position is not calculated properly because
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3
does not exist, butStuckRects2
can be used instead