2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Use new IsSupportedByWM XCB API from lib_base

This commit is contained in:
Ilya Fedin
2020-12-28 05:58:42 +04:00
committed by John Preston
parent d648d294ca
commit f66cfb5684
2 changed files with 5 additions and 45 deletions

View File

@@ -451,25 +451,6 @@ bool ShowXCBWindowMenu(QWindow *window) {
return true;
}
bool XCBFrameExtentsSupported() {
const auto connection = base::Platform::XCB::GetConnectionFromQt();
if (!connection) {
return false;
}
const auto frameExtentsAtom = base::Platform::XCB::GetAtom(
connection,
kXCBFrameExtentsAtomName.utf16());
if (!frameExtentsAtom.has_value()) {
return false;
}
return ranges::contains(
base::Platform::XCB::GetWMSupported(connection),
*frameExtentsAtom);
}
bool SetXCBFrameExtents(QWindow *window, const QMargins &extents) {
const auto connection = base::Platform::XCB::GetConnectionFromQt();
if (!connection) {
@@ -526,25 +507,6 @@ bool UnsetXCBFrameExtents(QWindow *window) {
return true;
}
bool XCBSkipTaskbarSupported() {
const auto connection = base::Platform::XCB::GetConnectionFromQt();
if (!connection) {
return false;
}
const auto skipTaskbarAtom = base::Platform::XCB::GetAtom(
connection,
"_NET_WM_STATE_SKIP_TASKBAR");
if (!skipTaskbarAtom.has_value()) {
return false;
}
return ranges::contains(
base::Platform::XCB::GetWMSupported(connection),
*skipTaskbarAtom);
}
Window::Control GtkKeywordToWindowControl(const QString &keyword) {
if (keyword == qstr("minimize")) {
return Window::Control::Minimize;
@@ -804,7 +766,8 @@ bool TrayIconSupported() {
}
bool SkipTaskbarSupported() {
return !IsWayland() && XCBSkipTaskbarSupported();
return !IsWayland()
&& base::Platform::XCB::IsSupportedByWM("_NET_WM_STATE_SKIP_TASKBAR");
}
bool StartSystemMove(QWindow *window) {
@@ -848,11 +811,8 @@ bool UnsetWindowExtents(QWindow *window) {
}
bool WindowsNeedShadow() {
if (!IsWayland() && XCBFrameExtentsSupported()) {
return true;
}
return false;
return !IsWayland()
&& base::Platform::XCB::IsSupportedByWM(kXCBFrameExtentsAtomName.utf16());
}
Window::ControlsLayout WindowControlsLayout() {