File indexing completed on 2024-05-12 17:00:19
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 1999 Matthias Ettrich (ettrich@kde.org) 0004 SPDX-FileCopyrightText: 2007 Lubos Lunak (l.lunak@kde.org) 0005 SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org> 0006 0007 SPDX-License-Identifier: LGPL-2.0-or-later 0008 */ 0009 0010 #include "windowinfo.h" 0011 #include "kwindowsystem.h" 0012 #include "waylandintegration.h" 0013 0014 #include <config-kwindowsystem.h> 0015 0016 #include <QGuiApplication> 0017 #include <QRect> 0018 0019 #include <KWayland/Client/plasmashell.h> 0020 #include <KWayland/Client/surface.h> 0021 0022 WindowInfo::WindowInfo(WId window, NET::Properties properties, NET::Properties2 properties2) 0023 : KWindowInfoPrivate(window, properties, properties2) 0024 , m_valid(false) 0025 , m_properties(properties) 0026 , m_properties2(properties2) 0027 , m_surface(KWayland::Client::Surface::fromQtWinId(window)) 0028 , m_plasmaShellSurface(KWayland::Client::PlasmaShellSurface::get(m_surface)) 0029 { 0030 m_valid = m_surface != nullptr && m_surface->isValid(); 0031 } 0032 0033 WindowInfo::~WindowInfo() 0034 { 0035 } 0036 0037 bool WindowInfo::valid(bool withdrawn_is_valid) const 0038 { 0039 Q_UNUSED(withdrawn_is_valid) 0040 return m_valid; 0041 } 0042 0043 NET::States WindowInfo::state() const 0044 { 0045 return {}; 0046 } 0047 0048 bool WindowInfo::isMinimized() const 0049 { 0050 return false; 0051 } 0052 0053 NET::MappingState WindowInfo::mappingState() const 0054 { 0055 return NET::Visible; 0056 } 0057 0058 NETExtendedStrut WindowInfo::extendedStrut() const 0059 { 0060 return NETExtendedStrut(); 0061 } 0062 0063 NET::WindowType WindowInfo::windowType(NET::WindowTypes supported_types) const 0064 { 0065 if (!m_plasmaShellSurface || !m_plasmaShellSurface->isValid()) { 0066 return NET::Unknown; 0067 } 0068 0069 if (m_properties & NET::WMWindowType) { 0070 switch (m_plasmaShellSurface->role()) { 0071 case KWayland::Client::PlasmaShellSurface::Role::Normal: 0072 if (supported_types & NET::NormalMask) { 0073 return NET::Normal; 0074 } 0075 break; 0076 case KWayland::Client::PlasmaShellSurface::Role::Desktop: 0077 if (supported_types & NET::DesktopMask) { 0078 return NET::Desktop; 0079 } 0080 break; 0081 case KWayland::Client::PlasmaShellSurface::Role::Panel: 0082 if (supported_types & NET::DockMask) { 0083 return NET::Dock; 0084 } 0085 break; 0086 case KWayland::Client::PlasmaShellSurface::Role::OnScreenDisplay: 0087 if (supported_types & NET::OnScreenDisplayMask) { 0088 return NET::OnScreenDisplay; 0089 } 0090 break; 0091 case KWayland::Client::PlasmaShellSurface::Role::Notification: 0092 if (supported_types & NET::NotificationMask) { 0093 return NET::Notification; 0094 } 0095 break; 0096 case KWayland::Client::PlasmaShellSurface::Role::ToolTip: 0097 if (supported_types & NET::TooltipMask) { 0098 return NET::Tooltip; 0099 } 0100 break; 0101 case KWayland::Client::PlasmaShellSurface::Role::CriticalNotification: 0102 if (supported_types & NET::CriticalNotificationMask) { 0103 return NET::CriticalNotification; 0104 } 0105 break; 0106 default: 0107 break; 0108 } 0109 } 0110 0111 return NET::Unknown; 0112 } 0113 0114 QString WindowInfo::visibleName() const 0115 { 0116 return QString(); 0117 } 0118 0119 QString WindowInfo::visibleNameWithState() const 0120 { 0121 return QString(); 0122 } 0123 0124 QString WindowInfo::name() const 0125 { 0126 return QString(); 0127 } 0128 0129 QString WindowInfo::visibleIconName() const 0130 { 0131 return QString(); 0132 } 0133 0134 QString WindowInfo::visibleIconNameWithState() const 0135 { 0136 return QString(); 0137 } 0138 0139 QString WindowInfo::iconName() const 0140 { 0141 return QString(); 0142 } 0143 0144 bool WindowInfo::onAllDesktops() const 0145 { 0146 return false; 0147 } 0148 0149 bool WindowInfo::isOnDesktop(int desktop) const 0150 { 0151 Q_UNUSED(desktop) 0152 return false; 0153 } 0154 0155 int WindowInfo::desktop() const 0156 { 0157 return 0; 0158 } 0159 0160 QStringList WindowInfo::activities() const 0161 { 0162 return QStringList(); 0163 } 0164 0165 QRect WindowInfo::geometry() const 0166 { 0167 return QRect(); 0168 } 0169 0170 QRect WindowInfo::frameGeometry() const 0171 { 0172 return QRect(); 0173 } 0174 0175 WId WindowInfo::transientFor() const 0176 { 0177 return 0; 0178 } 0179 0180 WId WindowInfo::groupLeader() const 0181 { 0182 return 0; 0183 } 0184 0185 QByteArray WindowInfo::windowClassClass() const 0186 { 0187 return QByteArray(); 0188 } 0189 0190 QByteArray WindowInfo::windowClassName() const 0191 { 0192 return QByteArray(); 0193 } 0194 0195 QByteArray WindowInfo::windowRole() const 0196 { 0197 return QByteArray(); 0198 } 0199 0200 QByteArray WindowInfo::clientMachine() const 0201 { 0202 return QByteArray(); 0203 } 0204 0205 bool WindowInfo::actionSupported(NET::Action action) const 0206 { 0207 Q_UNUSED(action) 0208 return false; 0209 }