/usr/include/KF5/KWindowSystem/kwindowinfo.h is in libkf5windowsystem-dev 5.18.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | /* This file is part of the KDE libraries
Copyright (C) 1999 Matthias Ettrich (ettrich@kde.org)
Copyright (C) 2007 Lubos Lunak (l.lunak@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/*
* kwindowinfo.h. Part of the KDE project.
*/
#ifndef KWINDOWINFO_H
#define KWINDOWINFO_H
#include <kwindowsystem_export.h>
#include <QWidgetList> //For WId
#include <QExplicitlySharedDataPointer>
#include <QStringList>
#include <netwm_def.h>
class KWindowInfoPrivate;
/**
* This class provides information about a given window in the platform specific
* windowing system. It provides the information for the current state when a
* KWindowInfo instance gets created. The instance does not get updated when the
* window changes. To get update about window changes connect to the
* @link KWindowSystem::windowChanged windowChanged@endlink signal of KWindowSystem
* and create a new KWindowInfo instance to reflect the current state.
*
* KWindowInfo does not encapsulate all information about the window. One needs to
* request which information is required by passing the appropriate NET::Property and
* NET::Property2 flags to the constructor. Please refer to the documentation of the
* methods to see which flags are required. This is done to limit the interaction with
* the underlying windowing system as fetching the information can cause several context
* switches and roundtrips to a server instance (e.g. when using the X11 platform).
*
* Please note that KWindowInfo is an abstraction of the underlying windowing system
* inspired by the X11 platform. Thus not all concepts apply to all platforms and some
* methods might return a default value for some platforms.
*
* Example usage of this class illustrated by monitoring a QWidget for change of the
* demands attention window state:
*
* @code
* QWidget *widget = new QWidget(Q_NULLPTR);
* widget->show(); // ensures native window gets created
* connect(KWindowSystem::self(), static_cast<void (KWindowSystem::*)(WId, unsigned int)>(&KWindowSystem::windowChanged),
* [window](WId winId, unsigned int properties) {
* if (widget->winId() != winId) {
* return; // not our window
* }
* if (properties & NET::WMState) {
* // let's check whether our window is demanding attention
* KWindowInfo info(widget->winId(), NET::WMState);
* qDebug() << "Has demands attention: " << info.hasState(NET::DemandsAttention);
* }
* });
* @endcode
*/
class KWINDOWSYSTEM_EXPORT KWindowInfo
{
public:
/**
* Reads all the info about the given window.
*
* Only the information requested through the @p properties and @p properties2
* parameters are fetched. Refer to the methods you are interested in to see
* which flags to pass.
*
* @param window The platform specific window identifier
* @param properties Bitmask of NET::Property
* @param properties2 Bitmask of NET::Property2
*/
KWindowInfo(WId window, NET::Properties properties, NET::Properties2 properties2 = 0);
~KWindowInfo();
/**
* Returns false if this window info is not valid.
*
* In case the window does not exist @c false is returned. Also if there is no
* appropriate implementation for KWindowInfo on the current windowing
* system platform this method returns @c false. In that case all methods return a
* default value and thus it is recommended to check whether valid returns @c true.
*
* @param withdrawn_is_valid if true, windows in the withdrawn state
* (i.e. not managed) are also considered. This is usually not the case.
*/
bool valid(bool withdrawn_is_valid = false) const;
/**
* Returns the window identifier.
*/
WId win() const;
/**
* Returns the window's state flags.
*
* Requires NET::WMState passed as properties parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMState);
* if (info.valid())
* info.state();
* @endcode
*
* @see NET::State
*/
NET::States state() const;
/**
* Returns true if the window has the given state flag set.
*
* Requires NET::WMState passed as properties parameter to the constructor.
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMState);
* if (info.valid())
* info.hasState(NET::DemandsAttention);
* @endcode
*
* @see NET::State
*/
bool hasState(NET::States s) const;
/**
* Returns true if the window is minimized.
*
* Note that it is true only if the window is truly minimized,
* not shaded or on another virtual desktops,
* which makes it different from mappingState() == NET::Iconic
* or QWidget::isMinimized().
* Requires NET::WMState and NET::XAWMState passed as properties parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMState | NET::XAWMState);
* if (info.valid())
* info.isMinimized();
* @endcode
*/
bool isMinimized() const;
/**
* Returns the mapping state of the window.
*
* Note that it's very likely that you don't want to use this function,
* and use isOnDesktop(), isMinimized() etc. instead.
* Requires NET::XAWMState passed as properties parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::XAWMState);
* if (info.valid())
* info.mappingState();
* @endcode
*
* @see NET::MappingState
* @see isOnDesktop()
* @see isMinimzed()
*/
NET::MappingState mappingState() const;
/**
* Returns the window extended (partial) strut.
*
* Requires NET::WM2ExtendedStrut passed as properties2 parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), 0, NET::WM2ExtendedStrut);
* if (info.valid())
* info.extendedStrut();
* @endcode
*/
NETExtendedStrut extendedStrut() const;
/**
* Returns the window type of this window.
*
* The argument should be all window types your application supports.
* Requires NET::WMWindowType passed as properties parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMWindowType);
* if (info.valid())
* info.windowType(NET::NormalMask | NET::DialogMask);
* @endcode
*
* @see NET::WindowType
* @see NET::WindowTypeMask
*/
NET::WindowType windowType(NET::WindowTypes supported_types) const;
/**
* Returns the visible name of the window.
*
* The visible name differs from the name by including possible <2> appended
* when there are two or more windows with the same name.
* Requires NET::WMVisibleName passed as properties parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMVisibleName);
* if (info.valid())
* info.visibleName();
* @endcode
*
* @see name()
*/
QString visibleName() const;
/**
* Returns a visible name with state.
*
* This is a simple convenience function that returns the
* visible name but with parentheses around minimized windows.
* Requires NET::WMVisibleName, NET::WMState and NET::XAWMState passed
* as properties parameter to the constructor.
* @return the window name with state
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMVisibleName | NET::WMState | NET::XAWMState);
* if (info.valid())
* info.visibleNameWithState();
* @endcode
*
* @see visibleName()
*/
QString visibleNameWithState() const;
/**
* Returns the name of the window, as specified by the application.
*
* The difference to visibleName() is that this is the name provided by
* the application without any modifications by the window manager.
* You should often use visibleName() instead.
* Requires NET::WMName passed as properties parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMName);
* if (info.valid())
* info.name();
* @endcode
*
* @see visibleName()
*/
QString name() const;
/**
* Returns the visible name of the window that should be shown in a taskbar.
*
* Note that this has nothing to do with normal icons but with an "iconic"
* representation of the window.
* Requires NET::WMVisibleIconName passed as properties parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMVisibleIconName);
* if (info.valid())
* info.visibleIconName();
* @endcode
*/
QString visibleIconName() const;
/**
* Returns a visible icon name with state.
*
* This is a simple convenience function that returns the
* visible iconic name but with parentheses around minimized windows.
* Note that this has nothing to do with normal icons.
* Requires NET::WMVisibleIconName, NET::WMState and NET::XAWMState passed
* as properties parameter to the constructor.
* @return the window iconic name with state
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMVisibleIconName | NET::WMState | NET::XAWMState);
* if (info.valid())
* info.visibleIconNameWithState();
* @endcode
*
* @see visibleIconName()
*/
QString visibleIconNameWithState() const;
/**
* Returns the name of the window that should be shown in taskbar.
*
* Note that this has nothing to do with normal icons but with an "iconic"
* representation of the window.
* Requires NET::WMIconName passed as properties parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMIconName);
* if (info.valid())
* info.iconName();
* @endcode
*/
QString iconName() const;
/**
* Returns true if the window is on the currently active virtual desktop.
*
* Requires NET::WMDesktop passed as properties parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMDesktop);
* if (info.valid())
* info.isOnCurrentDesktop();
* @endcode
*/
bool isOnCurrentDesktop() const;
/**
* Returns true if the window is on the given virtual desktop.
*
* Requires NET::WMDesktop passed as properties parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMDesktop);
* if (info.valid())
* info.isOnDesktop(KWindowSystem::currentDesktop());
* @endcode
*/
bool isOnDesktop(int desktop) const;
/**
* Returns true if the window is on all desktops.
*
* A window is on all desktops if desktop() returns NET::OnAllDesktops.
* Requires NET::WMDesktop passed as properties parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMDesktop);
* if (info.valid())
* info.onAllDesktops();
* @endcode
*
* @see desktop()
*/
bool onAllDesktops() const;
/**
* Returns the virtual desktop this window is on.
*
* If the window is on all desktops NET::OnAllDesktops is returned.
* You should prefer using isOnDesktop().
* Requires NET::WMDesktop passed as properties parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMDesktop);
* if (info.valid())
* info.desktop();
* @endcode
*
* @see isOnDesktop()
*/
int desktop() const;
/**
* Returns the list of activity UUIDs this window belongs to.
*
* The Plasma workspace allows the user to separate her work into
* different activities, by assigning windows, documents etc. to
* the specific ones. An activity is an abstract concept whose meaning
* can differ from one user to another. Typical examples of activities
* are "developing a KDE project", "studying the 19th century art",
* "composing music", "lazing on a Sunday afternoon" etc.
*
* If the list is empty, or contains a null UUID, the window is on
* all activities.
*
* Requires NET::WM2Activities passed as properties parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), 0, NET::WM2Activities);
* if (info.valid())
* info.desktop();
* @endcode
*
* @note Activities are only supported on Plasma Workspace on X11
*
* @since 5.0
*/
QStringList activities() const;
/**
* Returns the position and size of the window contents.
*
* Requires NET::WMGeometry passed as properties parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMGeometry);
* if (info.valid())
* info.geometry();
* @endcode
*/
QRect geometry() const;
/**
* Returns the frame geometry of the window, i.e. including the window decoration.
*
* Requires NET::WMFrameExtents passed as properties parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), NET::WMFrameExtents);
* if (info.valid())
* info.frameGeometry();
* @endcode
*/
QRect frameGeometry() const;
/**
* Returns the window identifier of the main window this window belongs to.
*
* On platform X11 this is the value of the WM_TRANSIENT_FOR property.
*
* Requires NET::WM2TransientFor passed as properties2 parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), 0, NET::WM2TransientFor);
* if (info.valid())
* info.transientFor();
* @endcode
*/
WId transientFor() const;
/**
* Returns the leader window for the group the window is in, if any.
*
* Requires NET::WM2GroupLeader passed as properties2 parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), 0, NET::WM2GroupLeader);
* if (info.valid())
* info.groupLeader();
* @endcode
*/
WId groupLeader() const;
/**
* Returns the class component of the window class for the window.
*
* On platform X11 this is part of the WM_CLASS property.
* Requires NET::WM2WindowClass passed as properties2 parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), 0, NET::WM2WindowClass);
* if (info.valid())
* info.windowClassClass();
* @endcode
*/
QByteArray windowClassClass() const;
/**
* Returns the name component of the window class for the window.
*
* On platform X11 this is part of the WM_CLASS property.
* Requires NET::WM2WindowClass passed as properties2 parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), 0, NET::WM2WindowClass);
* if (info.valid())
* info.windowClassName();
* @endcode
*/
QByteArray windowClassName() const;
/**
* Returns the window role for the window.
*
* On platform X11 this is the value of the WM_WINDOW_ROLE property.
* Requires NET::WM2WindowRole passed as properties2 parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), 0, NET::WM2WindowRole);
* if (info.valid())
* info.windowRole();
* @endcode
*/
QByteArray windowRole() const;
/**
* Returns the client machine for the window.
*
* On platform X11 this is the value of the WM_CLIENT_MACHINE property.
* Requires NET::WM2ClientMachine passed as properties2 parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), 0, NET::WM2ClientMachine);
* if (info.valid())
* info.clientMachine();
* @endcode
*/
QByteArray clientMachine() const;
/**
* Returns true if the given action is currently supported for the window.
*
* On platform X11 the supported actions are set by the window manager and
* can differ depending on the window manager.
* Requires NET::WM2AllowedActions passed as properties2 parameter to the constructor.
*
* @code
* QWidget *window = new QWidget(Q_NULLPTR);
* window->show();
* KWindowInfo info(window->winId(), 0, NET::WM2AllowedActions);
* if (info.valid())
* info.actionSupported(NET::ActionClose);
* @endcode
*/
bool actionSupported(NET::Action action) const;
/**
* Copy constructor.
*/
KWindowInfo(const KWindowInfo &);
/**
* Assignment operator.
*/
KWindowInfo &operator=(const KWindowInfo &);
private:
QExplicitlySharedDataPointer<KWindowInfoPrivate> d;
};
#endif // multiple inclusion guard
|