mirror of https://github.com/weisJ/darklaf.git
Browse Source
When running on Windows 11 don't need to extend the client frame anymore. This allows us to give back the titlebar space to the window manager. Hovering over the maximize button now yields in the snapping popup to appear.spotless
Jannis Weis
3 years ago
5 changed files with 207 additions and 20 deletions
@ -0,0 +1,52 @@ |
|||||||
|
/*
|
||||||
|
* MIT License |
||||||
|
* |
||||||
|
* Copyright (c) 2021 Jannis Weis |
||||||
|
* |
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
||||||
|
* of this software and associated documentation files (the "Software"), to deal |
||||||
|
* in the Software without restriction, including without limitation the rights |
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||||
|
* copies of the Software, and to permit persons to whom the Software is |
||||||
|
* furnished to do so, subject to the following conditions: |
||||||
|
* |
||||||
|
* The above copyright notice and this permission notice shall be included in all |
||||||
|
* copies or substantial portions of the Software. |
||||||
|
* |
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||||
|
* SOFTWARE. |
||||||
|
* |
||||||
|
*/ |
||||||
|
#include "Registry.h" |
||||||
|
|
||||||
|
DWORD RegGetDword(HKEY hKey, const LPCSTR subKey, const LPCSTR value) { |
||||||
|
DWORD data {}; |
||||||
|
DWORD dataSize = sizeof(data); |
||||||
|
DWORD flags = RRF_RT_REG_DWORD; |
||||||
|
ModifyFlags(flags); |
||||||
|
LONG retCode = ::RegGetValueA(hKey, subKey, value, flags, nullptr, &data, &dataSize); |
||||||
|
if (retCode != ERROR_SUCCESS) throw retCode; |
||||||
|
|
||||||
|
return data; |
||||||
|
} |
||||||
|
|
||||||
|
std::string RegGetString(HKEY hKey, const LPCSTR subKey, const LPCSTR value) { |
||||||
|
DWORD dataSize {}; |
||||||
|
DWORD flags = RRF_RT_REG_SZ; |
||||||
|
ModifyFlags(flags); |
||||||
|
LONG retCode = ::RegGetValueA(hKey, subKey, value, flags, nullptr, nullptr, &dataSize); |
||||||
|
if (retCode != ERROR_SUCCESS) throw retCode; |
||||||
|
|
||||||
|
std::string data; |
||||||
|
DWORD stringLengthInChars = dataSize / sizeof(char); |
||||||
|
data.resize(stringLengthInChars); |
||||||
|
retCode = ::RegGetValueA(hKey, subKey, value, flags, nullptr, &data[0], &dataSize); |
||||||
|
if (retCode != ERROR_SUCCESS) throw retCode; |
||||||
|
|
||||||
|
return data; |
||||||
|
} |
@ -0,0 +1,41 @@ |
|||||||
|
/*
|
||||||
|
* MIT License |
||||||
|
* |
||||||
|
* Copyright (c) 2021 Jannis Weis |
||||||
|
* |
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
||||||
|
* of this software and associated documentation files (the "Software"), to deal |
||||||
|
* in the Software without restriction, including without limitation the rights |
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||||
|
* copies of the Software, and to permit persons to whom the Software is |
||||||
|
* furnished to do so, subject to the following conditions: |
||||||
|
* |
||||||
|
* The above copyright notice and this permission notice shall be included in all |
||||||
|
* copies or substantial portions of the Software. |
||||||
|
* |
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||||
|
* SOFTWARE. |
||||||
|
* |
||||||
|
*/ |
||||||
|
#pragma once |
||||||
|
|
||||||
|
#include <string> |
||||||
|
#include <windows.h> |
||||||
|
#include <winreg.h> |
||||||
|
|
||||||
|
inline void ModifyFlags(DWORD &flags) { |
||||||
|
#ifdef _WIN64 |
||||||
|
flags |= RRF_SUBKEY_WOW6464KEY; |
||||||
|
#else |
||||||
|
flags |= RRF_SUBKEY_WOW6432KEY; |
||||||
|
#endif |
||||||
|
} |
||||||
|
|
||||||
|
DWORD RegGetDword(HKEY hKey, const LPCSTR subKey, const LPCSTR value); |
||||||
|
|
||||||
|
std::string RegGetString(HKEY hKey, const LPCSTR subKey, const LPCSTR value); |
Loading…
Reference in new issue