KWindowSystem

Search for usage in LXR

#include <kwindowsystem.h>

Inheritance diagram for KWindowSystem:

Public Types

enum  IconSource { NETWM = 1, WMHints = 2, ClassHint = 4, XApp = 8 }
 
enum  Platform { Platform::Unknown, Platform::X11, Platform::Wayland }
 
- Public Types inherited from NET
enum  { OnAllDesktops = -1 }
 
enum  Action {
  ActionMove = 1u << 0, ActionResize = 1u << 1, ActionMinimize = 1u << 2, ActionShade = 1u << 3,
  ActionStick = 1u << 4, ActionMaxVert = 1u << 5, ActionMaxHoriz = 1u << 6, ActionMax = ActionMaxVert | ActionMaxHoriz,
  ActionFullScreen = 1u << 7, ActionChangeDesktop = 1u << 8, ActionClose = 1u << 9
}
 
typedef QFlags< ActionActions
 
enum  DesktopLayoutCorner { DesktopLayoutCornerTopLeft = 0, DesktopLayoutCornerTopRight = 1, DesktopLayoutCornerBottomLeft = 2, DesktopLayoutCornerBottomRight = 3 }
 
enum  Direction {
  TopLeft = 0, Top = 1, TopRight = 2, Right = 3,
  BottomRight = 4, Bottom = 5, BottomLeft = 6, Left = 7,
  Move = 8, KeyboardSize = 9, KeyboardMove = 10, MoveResizeCancel = 11
}
 
enum  MappingState { Visible = 1, Withdrawn = 0, Iconic = 3 }
 
enum  Orientation { OrientationHorizontal = 0, OrientationVertical = 1 }
 
typedef QFlags< PropertyProperties
 
typedef QFlags< Property2Properties2
 
enum  Property {
  Supported = 1u << 0, ClientList = 1u << 1, ClientListStacking = 1u << 2, NumberOfDesktops = 1u << 3,
  DesktopGeometry = 1u << 4, DesktopViewport = 1u << 5, CurrentDesktop = 1u << 6, DesktopNames = 1u << 7,
  ActiveWindow = 1u << 8, WorkArea = 1u << 9, SupportingWMCheck = 1u << 10, VirtualRoots = 1u << 11,
  CloseWindow = 1u << 13, WMMoveResize = 1u << 14, WMName = 1u << 15, WMVisibleName = 1u << 16,
  WMDesktop = 1u << 17, WMWindowType = 1u << 18, WMState = 1u << 19, WMStrut = 1u << 20,
  WMIconGeometry = 1u << 21, WMIcon = 1u << 22, WMPid = 1u << 23, WMHandledIcons = 1u << 24,
  WMPing = 1u << 25, XAWMState = 1u << 27, WMFrameExtents = 1u << 28, WMIconName = 1u << 29,
  WMVisibleIconName = 1u << 30, WMGeometry = 1u << 31, WMAllProperties = ~0u
}
 
enum  Property2 {
  WM2UserTime = 1u << 0, WM2StartupId = 1u << 1, WM2TransientFor = 1u << 2, WM2GroupLeader = 1u << 3,
  WM2AllowedActions = 1u << 4, WM2RestackWindow = 1u << 5, WM2MoveResizeWindow = 1u << 6, WM2ExtendedStrut = 1u << 7,
  WM2KDETemporaryRules = 1u << 8, WM2WindowClass = 1u << 9, WM2WindowRole = 1u << 10, WM2ClientMachine = 1u << 11,
  WM2ShowingDesktop = 1u << 12, WM2Opacity = 1u << 13, WM2DesktopLayout = 1u << 14, WM2FullPlacement = 1u << 15,
  WM2FullscreenMonitors = 1u << 16, WM2FrameOverlap = 1u << 17, WM2Activities = 1u << 18, WM2BlockCompositing = 1u << 19,
  WM2KDEShadow = 1u << 20, WM2Urgency = 1u << 21, WM2Input = 1u << 22, WM2Protocols = 1u << 23,
  WM2InitialMappingState = 1u << 24, WM2IconPixmap = 1u << 25, WM2OpaqueRegion = 1u << 25, WM2DesktopFileName = 1u << 26,
  WM2GTKFrameExtents = 1u << 27, WM2AppMenuServiceName = 1u << 28, WM2AppMenuObjectPath = 1u << 29, WM2GTKApplicationId = 1u << 30,
  WM2GTKShowWindowMenu = 1u << 31, WM2AllProperties = ~0u
}
 
enum  Protocol {
  NoProtocol = 0, TakeFocusProtocol = 1 << 0, DeleteWindowProtocol = 1 << 1, PingProtocol = 1 << 2,
  SyncRequestProtocol = 1 << 3, ContextHelpProtocol = 1 << 4
}
 
typedef QFlags< ProtocolProtocols
 
enum  RequestSource { FromUnknown = 0, FromApplication = 1, FromTool = 2 }
 
enum  Role { Client, WindowManager }
 
enum  State {
  Modal = 1u << 0, Sticky = 1u << 1, MaxVert = 1u << 2, MaxHoriz = 1u << 3,
  Max = MaxVert | MaxHoriz, Shaded = 1u << 4, SkipTaskbar = 1u << 5, KeepAbove = 1u << 6,
  StaysOnTop = KeepAbove, SkipPager = 1u << 7, Hidden = 1u << 8, FullScreen = 1u << 9,
  KeepBelow = 1u << 10, DemandsAttention = 1u << 11, SkipSwitcher = 1u << 12, Focused = 1u << 13
}
 
typedef QFlags< StateStates
 
enum  WindowType {
  Unknown = -1, Normal = 0, Desktop = 1, Dock = 2,
  Toolbar = 3, Menu = 4, Dialog = 5, Override = 6,
  TopMenu = 7, Utility = 8, Splash = 9, DropdownMenu = 10,
  PopupMenu = 11, Tooltip = 12, Notification = 13, ComboBox = 14,
  DNDIcon = 15, OnScreenDisplay = 16, CriticalNotification = 17, AppletPopup = 18
}
 
enum  WindowTypeMask {
  NormalMask = 1u << 0, DesktopMask = 1u << 1, DockMask = 1u << 2, ToolbarMask = 1u << 3,
  MenuMask = 1u << 4, DialogMask = 1u << 5, OverrideMask = 1u << 6, TopMenuMask = 1u << 7,
  UtilityMask = 1u << 8, SplashMask = 1u << 9, DropdownMenuMask = 1u << 10, PopupMenuMask = 1u << 11,
  TooltipMask = 1u << 12, NotificationMask = 1u << 13, ComboBoxMask = 1u << 14, DNDIconMask = 1u << 15,
  OnScreenDisplayMask = 1u << 16, CriticalNotificationMask = 1u << 17, AppletPopupMask = 1u << 18, AllTypesMask = 0U - 1
}
 
typedef QFlags< WindowTypeMaskWindowTypes
 

Properties

bool isPlatformWayland
 
bool isPlatformX11
 
- Properties inherited from QObject
 objectName
 

Signals

void activeWindowChanged (WId id)
 
void compositingChanged (bool enabled)
 
void currentDesktopChanged (int desktop)
 
void desktopNamesChanged ()
 
void numberOfDesktopsChanged (int num)
 
void showingDesktopChanged (bool showing)
 
void stackingOrderChanged ()
 
void strutChanged ()
 
void windowAdded (WId id)
 
void windowChanged (WId id)
 
QT_MOC_COMPAT void windowChanged (WId id, const unsigned long *properties)
 
void windowChanged (WId id, NET::Properties properties, NET::Properties2 properties2)
 
QT_MOC_COMPAT void windowChanged (WId id, unsigned int properties)
 
void windowRemoved (WId id)
 
void workAreaChanged ()
 
void xdgActivationTokenArrived (int serial, const QString &token)
 

Static Public Member Functions

static Q_INVOKABLE void activateWindow (QWindow *window, long time=0)
 
static void activateWindow (WId win, long time=0)
 
static WId activeWindow ()
 
static bool allowedActionsSupported ()
 
static void allowExternalProcessWindowActivation (int pid=-1)
 
static void clearState (WId win, NET::States state)
 
static bool compositingActive ()
 
static QPoint constrainViewportRelativePosition (const QPoint &pos)
 
static int currentDesktop ()
 
static void demandAttention (WId win, bool set=true)
 
static QString desktopName (int desktop)
 
static QPoint desktopToViewport (int desktop, bool absolute)
 
static void forceActiveWindow (WId win, long time=0)
 
static WId groupLeader (WId window)
 
static bool hasWId (WId id)
 
static bool icccmCompliantMappingState ()
 
static QPixmap icon (WId win, int width, int height, bool scale, int flags)
 
static QPixmap icon (WId win, int width, int height, bool scale, int flags, NETWinInfo *info)
 
static QPixmap icon (WId win, int width=-1, int height=-1, bool scale=false)
 
static bool isPlatformWayland ()
 
static bool isPlatformX11 ()
 
static Q_INVOKABLE quint32 lastInputSerial (QWindow *window)
 
static void lowerWindow (WId win)
 
static bool mapViewport ()
 
static void minimizeWindow (WId win)
 
static void minimizeWindow (WId win, bool animation)
 
static int numberOfDesktops ()
 
static Platform platform ()
 
static void raiseWindow (WId win)
 
static QString readNameProperty (WId window, unsigned long atom)
 
static Q_INVOKABLE void requestXdgActivationToken (QWindow *win, uint32_t serial, const QString &app_id)
 
static KWindowSystemself ()
 
static void setBlockingCompositing (WId window, bool active)
 
static void setCurrentDesktop (int desktop)
 
static Q_INVOKABLE void setCurrentXdgActivationToken (const QString &token)
 
static void setDesktopName (int desktop, const QString &name)
 
static void setExtendedStrut (WId win, int left_width, int left_start, int left_end, int right_width, int right_start, int right_end, int top_width, int top_start, int top_end, int bottom_width, int bottom_start, int bottom_end)
 
static void setIcons (WId win, const QPixmap &icon, const QPixmap &miniIcon)
 
static void setMainWindow (QWidget *subwindow, WId mainwindow)
 
static void setMainWindow (QWindow *subwindow, WId mainwindow)
 
static void setOnActivities (WId win, const QStringList &activities)
 
static void setOnAllDesktops (WId win, bool b)
 
static void setOnDesktop (WId win, int desktop)
 
static void setShowingDesktop (bool showing)
 
static void setState (WId win, NET::States state)
 
static void setStrut (WId win, int left, int right, int top, int bottom)
 
static void setType (WId win, NET::WindowType windowType)
 
static void setUserTime (WId win, long time)
 
static bool showingDesktop ()
 
static QList< WId > stackingOrder ()
 
static WId transientFor (WId window)
 
static void unminimizeWindow (WId win)
 
static void unminimizeWindow (WId win, bool animation)
 
static void updateStartupId (QWindow *window)
 
static int viewportToDesktop (const QPoint &pos)
 
static int viewportWindowToDesktop (const QRect &r)
 
static KWindowInfo windowInfo (WId win, NET::Properties properties, NET::Properties2 properties2=NET::Properties2())
 
static QList< WId > windows ()
 
static QRect workArea (const QList< WId > &excludes, int desktop=-1)
 
static QRect workArea (int desktop=-1)
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Static Public Member Functions inherited from NET
static int timestampCompare (unsigned long time1, unsigned long time2)
 
static int timestampDiff (unsigned long time1, unsigned long time2)
 
static bool typeMatchesMask (WindowType type, WindowTypes mask)
 

Protected Member Functions

void connectNotify (const QMetaMethod &signal) override
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 
- Public Attributes inherited from QObject
typedef QObjectList
 

Detailed Description

Convenience access to certain properties and features of the window manager.

The class KWindowSystem provides information about the state of the window manager and allows asking the window manager to change them using a more high-level interface than the NETWinInfo/NETRootInfo lowlevel classes.

Because of limitations of the way Qt is implemented on Mac OSX, the WId's returned by methods in this class are not compatible with those expected by other Qt methods. So while it should be fine to pass WId's retrieved by for example calling the winId method on a QWidget to methods in this class the reverse is not true. You should never pass a WId obtained from this class to a Qt method accepting a WId parameter.

Class for interaction with the window manager.

Author
Matthias Ettrich (ettri.nosp@m.ch@k.nosp@m.de.or.nosp@m.g)

Definition at line 44 of file kwindowsystem.h.

Member Enumeration Documentation

◆ IconSource

Masks specifying from which sources to read an icon.

They are tried from the best until an icon is found.

  • NETWM from property from the window manager specification
  • WMHints from WMHints property
  • ClassHint load icon after getting name from the classhint
  • XApp load the standard X icon (last fallback)
Enumerator
NETWM 

read from property from the window manager specification

WMHints 

read from WMHints property

ClassHint 

load icon after getting name from the classhint

XApp 

load the standard X icon (last fallback)

Definition at line 389 of file kwindowsystem.h.

◆ Platform

Enum describing the windowing system platform used by the QGuiApplication.

See also
platform
Since
5.25
Enumerator
Unknown 

A platform unknown to the application is used.

X11 

The xcb/X11 windowing system platorm.

Wayland 

The Wayland windowing system platform.

Definition at line 811 of file kwindowsystem.h.

Member Function Documentation

◆ activateWindow() [1/2]

void KWindowSystem::activateWindow ( QWindow window,
long  time = 0 
)
static

Requests that window win is activated.

There are two ways how to activate a window, by calling activateWindow() and forceActiveWindow(). Generally, applications shouldn't make attempts to explicitly activate their windows, and instead let the user to activate them. In the special cases where this may be needed, applications should use activateWindow(). Window manager may consider whether this request wouldn't result in focus stealing, which would be obtrusive, and may refuse the request.

The usage of forceActiveWindow() is meant only for pagers and similar tools, which represent direct user actions related to window manipulation. Except for rare cases, this request will be always honored, and normal applications are forbidden to use it.

In case of problems, consult the KWin README in the kdebase package (kdebase/kwin/README), or ask on the kwin@.nosp@m.kde..nosp@m.org mailing list.

Parameters
windowthe window to make active
timeX server timestamp of the user activity that caused this request
Since
5.89

Definition at line 478 of file kwindowsystem.cpp.

◆ activateWindow() [2/2]

void KWindowSystem::activateWindow ( WId  win,
long  time = 0 
)
static

Requests that window win is activated.

There are two ways how to activate a window, by calling activateWindow() and forceActiveWindow(). Generally, applications shouldn't make attempts to explicitly activate their windows, and instead let the user to activate them. In the special cases where this may be needed, applications should use activateWindow(). Window manager may consider whether this request wouldn't result in focus stealing, which would be obtrusive, and may refuse the request.

The usage of forceActiveWindow() is meant only for pagers and similar tools, which represent direct user actions related to window manipulation. Except for rare cases, this request will be always honored, and normal applications are forbidden to use it.

In case of problems, consult the KWin README in the kdebase package (kdebase/kwin/README), or ask on the kwin@.nosp@m.kde..nosp@m.org mailing list.

Parameters
winthe id of the window to make active
timeX server timestamp of the user activity that caused this request
Deprecated:
since 5.101, use KX11Extras::activateWindow() or KWindowSystem::activateWindow(QWindow *) instead

Definition at line 471 of file kwindowsystem.cpp.

◆ activeWindow()

WId KWindowSystem::activeWindow ( )
static

Returns the currently active window, or 0 if no window is active.

Returns
the window id of the active window, or 0 if no window is active
Deprecated:
since 5.101, use KX11Extras::activeWindow()

Definition at line 463 of file kwindowsystem.cpp.

◆ activeWindowChanged

void KWindowSystem::activeWindowChanged ( WId  id)
signal

Hint that <Window> is active (= has focus) now.

Parameters
idthe id of the window that is active
Deprecated:
since 5.101, use KX11Extras::activeWindowChanged()

◆ allowedActionsSupported()

bool KWindowSystem::allowedActionsSupported ( )
static

Returns true if the WM announces which actions it allows for windows.

Definition at line 759 of file kwindowsystem.cpp.

◆ allowExternalProcessWindowActivation()

void KWindowSystem::allowExternalProcessWindowActivation ( int  pid = -1)
static

Allows a window from another process to raise and activate itself.

Depending on the window manager, the grant may only be temporary, or for a single activation, and it may require the current process to be the "foreground" one" (ie. the process with the input focus).

You should call this function before executing actions that may trigger the showing of a window or dialog in another process, e.g. a dbus signal or function call, or any other inter-process notification mechanism.

This is mostly used on Windows, where windows are not allowed to be raised and activated if their process is not the foreground one, but it may also apply to other window managers.

Parameters
pidif specified, the grant only applies to windows belonging to the specific process. By default, a value of -1 means all processes.
Deprecated:
since 5.104, not implemented.

Definition at line 774 of file kwindowsystem.cpp.

◆ clearState()

void KWindowSystem::clearState ( WId  win,
NET::States  state 
)
static

Clears the state of window win from state.

Possible values are or'ed combinations of NET::Modal, NET::Sticky, NET::MaxVert, NET::MaxHoriz, NET::Shaded, NET::SkipTaskbar, NET::SkipPager, NET::Hidden, NET::FullScreen, NET::KeepAbove, NET::KeepBelow, NET::SkipSwitcher

Parameters
winthe id of the window
statethe flags that will be cleared

Definition at line 597 of file kwindowsystem.cpp.

◆ compositingActive()

bool KWindowSystem::compositingActive ( )
static

Returns true if a compositing manager is running (i.e.

ARGB windows are supported, effects will be provided, etc.).

Deprecated:
since 5.101, use KX11Extras::compositingActive()

Definition at line 650 of file kwindowsystem.cpp.

◆ compositingChanged

void KWindowSystem::compositingChanged ( bool  enabled)
signal

Compositing was enabled or disabled.

Note that this signal may be emitted before any compositing plugins have been initialized in the window manager.

If you need to check if a specific compositing plugin such as the blur effect is enabled, you should track that separately rather than test for it in a slot connected to this signal.

Since
4.7.1
Deprecated:
since 5.101, use KX11Extras::compositingChanged()

◆ constrainViewportRelativePosition()

QPoint KWindowSystem::constrainViewportRelativePosition ( const QPoint pos)
static
Since
4.0.1 Checks the relative difference used to move a window will still be inside valid desktop area.

Definition at line 816 of file kwindowsystem.cpp.

◆ currentDesktop()

int KWindowSystem::currentDesktop ( )
static

Returns the current virtual desktop.

Returns
the current virtual desktop
Deprecated:
since 5.101, use KX11Extras::currentDesktop()

Definition at line 415 of file kwindowsystem.cpp.

◆ currentDesktopChanged

void KWindowSystem::currentDesktopChanged ( int  desktop)
signal

Switched to another virtual desktop.

Parameters
desktopthe number of the new desktop
Deprecated:
since 5.101, use KX11Extras::currentDesktopChanged()

◆ demandAttention()

void KWindowSystem::demandAttention ( WId  win,
bool  set = true 
)
static

When application finishes some operation and wants to notify the user about it, it can call demandAttention().

Instead of activating the window, which could be obtrusive, the window will be marked specially as demanding user's attention. See also explanation in description of activateWindow().

Note that it's usually better to use KNotifyClient.

Deprecated:
since 5.101, use QWindow::alert() instead().

Definition at line 493 of file kwindowsystem.cpp.

◆ desktopName()

QString KWindowSystem::desktopName ( int  desktop)
static

Returns the name of the specified desktop.

Parameters
desktopthe number of the desktop
Returns
the name of the desktop
Deprecated:
since 5.101, use KX11Extras::desktopName()

Definition at line 674 of file kwindowsystem.cpp.

◆ desktopNamesChanged

void KWindowSystem::desktopNamesChanged ( )
signal

Desktops have been renamed.

Deprecated:
since 5.101, use KX11Extras::desktopNamesChanged()

◆ desktopToViewport()

QPoint KWindowSystem::desktopToViewport ( int  desktop,
bool  absolute 
)
static

Returns topleft corner of the viewport area for the given mapped virtual desktop.

Definition at line 809 of file kwindowsystem.cpp.

◆ forceActiveWindow()

void KWindowSystem::forceActiveWindow ( WId  win,
long  time = 0 
)
static

Sets window win to be the active window.

Note that this should be called only in special cases, applications shouldn't force themselves or other windows to be the active window. Generally, this call should used only by pagers and similar tools. See the explanation in description of activateWindow().

Parameters
winthe id of the window to make active
timeX server timestamp of the user activity that caused this request
Deprecated:
since 5.101, use KX11Extras::forceActiveWindow()

Definition at line 485 of file kwindowsystem.cpp.

◆ groupLeader()

WId KWindowSystem::groupLeader ( WId  window)
static

Returns the leader window for the group the given window is in, if any.

Parameters
windowthe id of the window
Deprecated:
Since 5.0, use KWindowInfo::groupLeader

Definition at line 530 of file kwindowsystem.cpp.

◆ hasWId()

bool KWindowSystem::hasWId ( WId  id)
static

Test to see if id still managed at present.

Parameters
idthe window id to test
Returns
true if the window id is still managed
Deprecated:
since 5.101, use KX11Extras::hasWId()

Definition at line 400 of file kwindowsystem.cpp.

◆ icccmCompliantMappingState()

bool KWindowSystem::icccmCompliantMappingState ( )
static

Returns true if the WM uses IconicState also for windows on inactive virtual desktops.

Deprecated:
since 5.101, internal.

Definition at line 752 of file kwindowsystem.cpp.

◆ icon() [1/3]

QPixmap KWindowSystem::icon ( WId  win,
int  width,
int  height,
bool  scale,
int  flags 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Overloaded variant that allows specifying from which sources the icon should be read.

You should usually prefer the simpler variant which tries all possibilities to get an icon.

Parameters
winthe id of the window
widththe desired width, or -1
heightthe desired height, or -1
scaleif true the icon will be scaled to the desired size. Otherwise the icon will not be modified.
flagsOR-ed flags from the IconSource enum
Deprecated:
since 5.101, use KX11Extras::icon()

Definition at line 545 of file kwindowsystem.cpp.

◆ icon() [2/3]

QPixmap KWindowSystem::icon ( WId  win,
int  width,
int  height,
bool  scale,
int  flags,
NETWinInfo info 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Overloaded variant that allows passing in the NETWinInfo to use for reading the information.

This variant is only useful on the X11 platform, other platforms do not use NETWinInfo and delegate to the variant without NETWinInfo. Though if compiled with X11 support the X11 variant is used on other platforms if info is not nullptr. This can be used by applications using e.g. platform wayland but also connecting to an XServer.

The NETWinInfo must be constructed with property NET::WMIcon in order to use the IconSource flag NETWM. NET::WM2IconPixmap for IconSource flag WMHints and NET::WM2WindowClass for IconSource flag ClassHint.

Parameters
winthe id of the window
widththe desired width, or -1
heightthe desired height, or -1
scaleif true the icon will be scaled to the desired size. Otherwise the icon will not be modified.
flagsOR-ed flags from the IconSource enum
intothe NETWinInfo to use for reading properties.
Since
5.7
Deprecated:
since 5.101, use KX11Extras::icon()

Definition at line 553 of file kwindowsystem.cpp.

◆ icon() [3/3]

QPixmap KWindowSystem::icon ( WId  win,
int  width = -1,
int  height = -1,
bool  scale = false 
)
static

Returns an icon for window win.

If width and height are specified, the best icon for the requested size is returned.

If scale is true, the icon is smooth-scaled to have exactly the requested size.

Parameters
winthe id of the window
widththe desired width, or -1
heightthe desired height, or -1
scaleif true the icon will be scaled to the desired size. Otherwise the icon will not be modified.
Returns
the icon of the window
Deprecated:
since 5.101, use KX11Extras::icon()

Definition at line 538 of file kwindowsystem.cpp.

◆ isPlatformWayland()

static bool KWindowSystem::isPlatformWayland ( )
static

Convenience method to check whether the Platform is Wayland.

See also
platform
isPlatformX11
Since
5.25

◆ isPlatformX11()

static bool KWindowSystem::isPlatformX11 ( )
static

Convenience method to check whether the Platform is X11.

See also
platform
isPlatformWayland
Since
5.25

◆ lastInputSerial()

quint32 KWindowSystem::lastInputSerial ( QWindow window)
static

Offers the seat's current serial.

This will mostly be useful on wayland sessions.

Since
5.83

Definition at line 909 of file kwindowsystem.cpp.

◆ lowerWindow()

void KWindowSystem::lowerWindow ( WId  win)
static

Lowers the given window.

This call is only for pagers and similar tools that represent direct user actions. Applications should not use it, they should keep using QWidget::lower() or XLowerWindow() if necessary.

Deprecated:
since 5.101, no known users.

Definition at line 642 of file kwindowsystem.cpp.

◆ mapViewport()

bool KWindowSystem::mapViewport ( )
static

Returns true if viewports are mapped to virtual desktops.

Definition at line 790 of file kwindowsystem.cpp.

◆ minimizeWindow() [1/2]

void KWindowSystem::minimizeWindow ( WId  win)
static

Minimizes the window with id win.

On X11 this follows the protocol described in ICCCM section 4.1.4.

Parameters
winThe window to minimize
See also
unminimizeWindow()
Deprecated:
since 5.101, use KX11Extras::minimizeWindow() or QWindow::setState()

Definition at line 604 of file kwindowsystem.cpp.

◆ minimizeWindow() [2/2]

void KWindowSystem::minimizeWindow ( WId  win,
bool  animation 
)
static
Deprecated:
since 5.0 the animation is ignored.

Definition at line 620 of file kwindowsystem.cpp.

◆ numberOfDesktops()

int KWindowSystem::numberOfDesktops ( )
static

Returns the number of virtual desktops.

Returns
the number of virtual desktops
Deprecated:
since 5.101, use KX11Extras::numberOfDesktops()

Definition at line 423 of file kwindowsystem.cpp.

◆ numberOfDesktopsChanged

void KWindowSystem::numberOfDesktopsChanged ( int  num)
signal

The number of desktops changed.

Parameters
numthe new number of desktops
Deprecated:
since 5.101, use KX11Extras::numberOfDesktopsChanged()

◆ platform()

KWindowSystem::Platform KWindowSystem::platform ( )
static

Returns the Platform used by the QGuiApplication.

This method allows to check for the used windowing system in a cheap and reliable way. The Platform gets resolved the first time the method is invoked and cached for further usages.

Returns
The Platform used by the QGuiApplication.
Since
5.25

Definition at line 844 of file kwindowsystem.cpp.

◆ raiseWindow()

void KWindowSystem::raiseWindow ( WId  win)
static

Raises the given window.

This call is only for pagers and similar tools that represent direct user actions. Applications should not use it, they should keep using QWidget::raise() or XRaiseWindow() if necessary.

Definition at line 635 of file kwindowsystem.cpp.

◆ readNameProperty()

QString KWindowSystem::readNameProperty ( WId  window,
unsigned long  atom 
)
static

Function that reads and returns the contents of the given text property (WM_NAME, WM_ICON_NAME,...).

Definition at line 766 of file kwindowsystem.cpp.

◆ requestXdgActivationToken()

void KWindowSystem::requestXdgActivationToken ( QWindow win,
uint32_t  serial,
const QString app_id 
)
static

Requests an xdg_activation_v1 token for a specific window.

Parameters
winwindow in behalf this request is made
serialof the event that triggered the request
app_ididentifier of the application that we are launching
See also
lastInputSerial
Since
5.83

Definition at line 884 of file kwindowsystem.cpp.

◆ self()

KWindowSystem * KWindowSystem::self ( )
static

Access to the singleton instance.

Useful mainly for connecting to signals.

Definition at line 367 of file kwindowsystem.cpp.

◆ setBlockingCompositing()

void KWindowSystem::setBlockingCompositing ( WId  window,
bool  active 
)
static

Sets whether the client wishes to block compositing (for better performance)

Since
4.7
Deprecated:
since 5.101, no known users.

Definition at line 782 of file kwindowsystem.cpp.

◆ setCurrentDesktop()

void KWindowSystem::setCurrentDesktop ( int  desktop)
static

Convenience function to set the current desktop to desktop.

See NETRootInfo.

Parameters
desktopthe number of the new desktop
Deprecated:
since 5.101, use KX11Extras::setCurrentDesktop()

Definition at line 431 of file kwindowsystem.cpp.

◆ setCurrentXdgActivationToken()

void KWindowSystem::setCurrentXdgActivationToken ( const QString token)
static

Sets the token that will be used when activateWindow is called next.

Since
5.83

Definition at line 899 of file kwindowsystem.cpp.

◆ setDesktopName()

void KWindowSystem::setDesktopName ( int  desktop,
const QString name 
)
static

Sets the name of the specified desktop.

Parameters
desktopthe number of the desktop
namethe new name for the desktop
Deprecated:
since 5.101, use KX11Extras::setDesktopName()

Definition at line 682 of file kwindowsystem.cpp.

◆ setExtendedStrut()

void KWindowSystem::setExtendedStrut ( WId  win,
int  left_width,
int  left_start,
int  left_end,
int  right_width,
int  right_start,
int  right_end,
int  top_width,
int  top_start,
int  top_end,
int  bottom_width,
int  bottom_start,
int  bottom_end 
)
static

Sets the strut of window win to left_width ranging from left_start to left_end on the left edge, and simiarly for the other edges.

For not reserving a strut, pass 0 as the width. E.g. to reserve 10x10 square in the topleft corner, use e.g. setExtendedStrut( w, 10, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0 ).

Parameters
winthe id of the window
left_widthwidth of the strut at the left edge
left_startstarting y coordinate of the strut at the left edge
left_endending y coordinate of the strut at the left edge
right_widthwidth of the strut at the right edge
right_startstarting y coordinate of the strut at the right edge
right_endending y coordinate of the strut at the right edge
top_widthwidth of the strut at the top edge
top_startstarting x coordinate of the strut at the top edge
top_endending x coordinate of the strut at the top edge
bottom_widthwidth of the strut at the bottom edge
bottom_startstarting x coordinate of the strut at the bottom edge
bottom_endending x coordinate of the strut at the bottom edge

Definition at line 710 of file kwindowsystem.cpp.

◆ setIcons()

void KWindowSystem::setIcons ( WId  win,
const QPixmap icon,
const QPixmap miniIcon 
)
static

Sets an icon and a miniIcon on window win.

Parameters
winthe id of the window
iconthe new icon
miniIconthe new mini icon
Deprecated:
since 5.101, use QWindow::setIcon() or QGuiApplication::setWindowIcon()

Definition at line 578 of file kwindowsystem.cpp.

◆ setMainWindow() [1/2]

void KWindowSystem::setMainWindow ( QWidget subwindow,
WId  mainwindow 
)
static

Sets the parent window of subwindow to be mainwindow.

This overrides the parent set the usual way as the QWidget parent, but only for the window manager - e.g. stacking order and window grouping will be affected, but features like automatic deletion of children when the parent is deleted are unaffected and normally use the QWidget parent.

This function should be used before a dialog is shown for a window that belongs to another application.

Deprecated:
since 5.62, use setMainWindow(QWindow *). If all you have is a QWidget*, you might need to call setAttribute(Qt::WA_NativeWindow, true); before calling >window()->windowHandle().

Definition at line 507 of file kwindowsystem.cpp.

◆ setMainWindow() [2/2]

void KWindowSystem::setMainWindow ( QWindow subwindow,
WId  mainwindow 
)
static

Sets the parent window of subwindow to be mainwindow.

This overrides the parent set the usual way as the QWidget or QWindow parent, but only for the window manager - e.g. stacking order and window grouping will be affected, but features like automatic deletion of children when the parent is deleted are unaffected and normally use the QObject parent.

This function should be used before a dialog is shown for a window that belongs to another application.

Definition at line 518 of file kwindowsystem.cpp.

◆ setOnActivities()

void KWindowSystem::setOnActivities ( WId  win,
const QStringList activities 
)
static

Moves window win to activities activities.

Parameters
winthe id of the window
activitiesthe list of activity UUIDs
Since
5.1
See also
KWindowInfo::activities
Deprecated:
since 5.101, use KX11Extras::setOnActivities()

Definition at line 455 of file kwindowsystem.cpp.

◆ setOnAllDesktops()

void KWindowSystem::setOnAllDesktops ( WId  win,
bool  b 
)
static

Sets window win to be present on all virtual desktops if is true.

Otherwise the window lives only on one single desktop.

Parameters
winthe id of the window
btrue to show the window on all desktops, false otherwise
Deprecated:
since 5.101, use KX11Extras::setOnAllDesktops()

Definition at line 439 of file kwindowsystem.cpp.

◆ setOnDesktop()

void KWindowSystem::setOnDesktop ( WId  win,
int  desktop 
)
static

Moves window win to desktop desktop.

Parameters
winthe id of the window
desktopthe number of the new desktop
Deprecated:
since 5.101, use KX11Extras::setOnDesktop()

Definition at line 447 of file kwindowsystem.cpp.

◆ setShowingDesktop()

void KWindowSystem::setShowingDesktop ( bool  showing)
static

Sets the state of the "showing desktop" mode of the window manager.

If on, windows are hidden and desktop background is shown and focused.

Parameters
showingif true, the window manager is put in "showing desktop" mode. If false, the window manager is put out of that mode.
Since
5.7.0

Definition at line 695 of file kwindowsystem.cpp.

◆ setState()

void KWindowSystem::setState ( WId  win,
NET::States  state 
)
static

Sets the state of window win to state.

Possible values are or'ed combinations of NET::Modal, NET::Sticky, NET::MaxVert, NET::MaxHoriz, NET::Shaded, NET::SkipTaskbar, NET::SkipPager, NET::Hidden, NET::FullScreen, NET::KeepAbove, NET::KeepBelow, NET::SkipSwitcher

Parameters
winthe id of the window
statethe new flags that will be set

Definition at line 591 of file kwindowsystem.cpp.

◆ setStrut()

void KWindowSystem::setStrut ( WId  win,
int  left,
int  right,
int  top,
int  bottom 
)
static

Convenience function for setExtendedStrut() that automatically makes struts as wide/high as the screen width/height.

Sets the strut of window win to left, right, top, bottom.

Parameters
winthe id of the window
leftthe left strut
rightthe right strut
topthe top strut
bottomthe bottom strut

Definition at line 743 of file kwindowsystem.cpp.

◆ setType()

void KWindowSystem::setType ( WId  win,
NET::WindowType  windowType 
)
static

Sets the type of window win to windowType.

Parameters
winthe id of the window
windowTypethe type of the window (see NET::WindowType)

Definition at line 585 of file kwindowsystem.cpp.

◆ setUserTime()

void KWindowSystem::setUserTime ( WId  win,
long  time 
)
static

Sets user timestamp time on window win.

The timestamp is expressed as XServer time. If a window is shown with user timestamp older than the time of the last user action, it won't be activated after being shown. The most common case is the special value 0 which means not to activate the window after being shown.

Deprecated:
since 5.101, use QX11Info::setAppUserTime().

Definition at line 702 of file kwindowsystem.cpp.

◆ showingDesktop()

bool KWindowSystem::showingDesktop ( )
static

Returns the state of showing the desktop.

Definition at line 689 of file kwindowsystem.cpp.

◆ showingDesktopChanged

void KWindowSystem::showingDesktopChanged ( bool  showing)
signal

The state of showing the desktop has changed.

◆ stackingOrder()

QList< WId > KWindowSystem::stackingOrder ( )
static

Returns the list of all toplevel windows currently managed by the window manager in the current stacking order (from lower to higher).

May be useful for pagers.

Returns
the list of all toplevel windows in stacking order
Deprecated:
since 5.101, use KX11Extras::stackingOrder()

Definition at line 407 of file kwindowsystem.cpp.

◆ stackingOrderChanged

void KWindowSystem::stackingOrderChanged ( )
signal

Emitted when the stacking order of the window changed.

The new order can be obtained with stackingOrder().

Deprecated:
since 5.101, use KX11Extras::stackingOrderChanged()

◆ strutChanged

void KWindowSystem::strutChanged ( )
signal

Something changed with the struts, may or may not have changed the work area.

Usually just using the workAreaChanged() signal is sufficient.

Deprecated:
since 5.101, use KX11Extras::strutChanged()

◆ transientFor()

WId KWindowSystem::transientFor ( WId  window)
static

Returns the WM_TRANSIENT_FOR property for the given window, i.e.

the mainwindow for this window.

Parameters
windowthe id of the window
Deprecated:
Since 5.0, use KWindowInfo::transientFor

Definition at line 501 of file kwindowsystem.cpp.

◆ unminimizeWindow() [1/2]

void KWindowSystem::unminimizeWindow ( WId  win)
static

Unminimizes the window with id win.

On X11 this follows the protocol described in ICCCM section 4.1.4.

Parameters
winThe window to unminimize
See also
minimizeWindow()
Deprecated:
since 5.101, use KX11Extras::unminimizeWindow() or QWindow::setState()

Definition at line 612 of file kwindowsystem.cpp.

◆ unminimizeWindow() [2/2]

void KWindowSystem::unminimizeWindow ( WId  win,
bool  animation 
)
static
Deprecated:
since 5.0 the animation is ignored.

Definition at line 628 of file kwindowsystem.cpp.

◆ updateStartupId()

void KWindowSystem::updateStartupId ( QWindow window)
static

Updates the platform-specific startup id, if any.

This method is to be called when a running application instance is reused for handling the request to start this application. A typical use would be in the handler of the KDBusService activation signal.

For X11, this updates the id for the Startup Notification protocol, taking the id from QX11Info::nextStartupId(), if not empty. For Wayland, this updates the token for the XDG Activation protocol, taking the token from the "XDG_ACTIVATION_TOKEN" environment variable and then unsetting it, if not empty.

Parameters
windowthe main window (needed by X11 platform)
Since
5.91

Definition at line 860 of file kwindowsystem.cpp.

◆ viewportToDesktop()

int KWindowSystem::viewportToDesktop ( const QPoint pos)
static

Returns mapped virtual desktop for the given position in the viewport.

Definition at line 797 of file kwindowsystem.cpp.

◆ viewportWindowToDesktop()

int KWindowSystem::viewportWindowToDesktop ( const QRect r)
static

Returns mapped virtual desktop for the given window geometry.

Definition at line 803 of file kwindowsystem.cpp.

◆ windowAdded

void KWindowSystem::windowAdded ( WId  id)
signal

A window has been added.

Parameters
idthe id of the window
Deprecated:
since 5.101, use KX11Extras::windowAdded()

◆ windowChanged [1/4]

void KWindowSystem::windowChanged ( WId  id)
signal

The window changed somehow.

Parameters
idthe id of the window
Deprecated:
since 5.80, use windowChanged(WId, NET::Properties, NET::Properties2);

◆ windowChanged [2/4]

QT_MOC_COMPAT void KWindowSystem::windowChanged ( WId  id,
const unsigned long *  properties 
)
signal

The window changed.

The properties parameter contains the NET properties that were modified (see netwm_def.h). First element are NET::Property values, second element are NET::Property2 values (i.e. the format is the same like for the NETWinInfo class constructor).

Parameters
idthe id of the window
propertiesthe properties that were modified
Deprecated:
since 5.0 use windowChanged(WId, NET::Properties, NET::Properties2)

◆ windowChanged [3/4]

void KWindowSystem::windowChanged ( WId  id,
NET::Properties  properties,
NET::Properties2  properties2 
)
signal

The window changed.

Carries the NET::Properties and NET::Properties2 that were changed.

Parameters
idthe id of the window
propertiesthe properties that were modified
properties2the properties2 that were modified
Since
5.0
Deprecated:
since 5.101, use KX11Extras::windowChanged()

◆ windowChanged [4/4]

QT_MOC_COMPAT void KWindowSystem::windowChanged ( WId  id,
unsigned int  properties 
)
signal

The window changed.

The unsigned int parameter contains the NET properties that were modified (see netwm_def.h).

Parameters
idthe id of the window
propertiesthe properties that were modified
Deprecated:
Since 5.0

◆ windowInfo()

KWindowInfo KWindowSystem::windowInfo ( WId  win,
NET::Properties  properties,
NET::Properties2  properties2 = NET::Properties2() 
)
static

Returns information about window win.

It is recommended to check whether the returned info is valid by calling the valid() method.

Parameters
winthe id of the window
propertiesall properties that should be retrieved (see NET::Property enum for details). Unlisted properties cause related information to be invalid in the returned data, but make this function faster when not all data is needed.
properties2additional properties (see NET::Property2 enum)
Returns
the window information
Deprecated:
Since 5.0, use KWindowInfo directly

Definition at line 393 of file kwindowsystem.cpp.

◆ windowRemoved

void KWindowSystem::windowRemoved ( WId  id)
signal

A window has been removed.

Parameters
idthe id of the window that has been removed
Deprecated:
since 5.101, use KX11Extras::windowRemoved()

◆ windows()

const QList< WId > & KWindowSystem::windows ( )
static

Returns the list of all toplevel windows currently managed by the window manager in the order of creation.

Please do not rely on indexes of this list: Whenever you enter Qt's event loop in your application, it may happen that entries are removed or added. Your module should perhaps work on a copy of this list and verify a window with hasWId() before any operations.

Iteration over this list can be done easily with

for (auto it = windows.cbegin(), end = windows.cend(); it != end; ++it) {
... do something here, (*it) is the current WId.
}
Returns
the list of all toplevel windows
Deprecated:
since 5.101, use KX11Extras::windows()

Definition at line 385 of file kwindowsystem.cpp.

◆ workArea() [1/2]

QRect KWindowSystem::workArea ( const QList< WId > &  excludes,
int  desktop = -1 
)
static

Returns the workarea for the specified desktop, or the current work area if no desktop has been specified.

Excludes struts of clients in the exclude List.

Parameters
excludesthe list of clients whose struts will be excluded
desktopthe number of the desktop to check, -1 for the current desktop
Returns
the size and position of the desktop
Deprecated:
since 5.101, use KX11Extras::workArea()

Definition at line 666 of file kwindowsystem.cpp.

◆ workArea() [2/2]

QRect KWindowSystem::workArea ( int  desktop = -1)
static

Returns the workarea for the specified desktop, or the current work area if no desktop has been specified.

Parameters
desktopthe number of the desktop to check, -1 for the current desktop
Returns
the size and position of the desktop
Deprecated:
since 5.101, use KX11Extras::workArea()

Definition at line 658 of file kwindowsystem.cpp.

◆ workAreaChanged

void KWindowSystem::workAreaChanged ( )
signal

The workarea has changed.

Deprecated:
since 5.101, use KX11Extras::workAreaChanged()

◆ xdgActivationTokenArrived

void KWindowSystem::xdgActivationTokenArrived ( int  serial,
const QString token 
)
signal

Activation token to pass to the client.

See also
requestXdgActivationToken
setCurrentXdgActivationToken
Since
5.83

The documentation for this class was generated from the following files:
QList::const_iterator cend() const const
static QList< WId > windows()
Returns the list of all toplevel windows currently managed by the window manager in the order of crea...
QList::const_iterator cbegin() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Dec 8 2023 04:12:20 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.