NETWinInfo Class

Common API for application window properties/protocols. More...

Header: #include <NETWM>
CMake: find_package(KF6 REQUIRED COMPONENTS KWindowSystem)
target_link_libraries(mytarget PRIVATE KF6::KWindowSystem)

Public Functions

NETWinInfo(xcb_connection_t *connection, xcb_window_t window, xcb_window_t rootWindow, int properties, int properties2, int role)
NETWinInfo(const NETWinInfo &wininfo)
(since 4.6) const char *activities() const
int allowedActions() const
(since 5.69) const char *appMenuObjectPath() const
(since 5.69) const char *appMenuServiceName() const
const char *clientMachine() const
int desktop(bool ignore_viewport = false) const
(since 5.28) const char *desktopFileName() const
int event(xcb_generic_event_t *event)
(since 5.0) void event(xcb_generic_event_t *event, int *properties, int *properties2 = nullptr)
int extendedStrut() const
(since 4.3) int frameExtents() const
(since 4.4) int frameOverlap() const
int fullscreenMonitors() const
xcb_window_t groupLeader() const
(since 5.91) const char *gtkApplicationId() const
(since 5.65) int gtkFrameExtents() const
bool handledIcons() const
bool hasNETSupport() const
bool hasWindowType() const
(since 5.7) xcb_pixmap_t icccmIconPixmap() const
(since 5.7) xcb_pixmap_t icccmIconPixmapMask() const
int icon(int width = -1, int height = -1) const
int iconGeometry() const
const char *iconName() const
(since 4.3) const int *iconSizes() const
(since 5.5) int initialMappingState() const
(since 5.3) bool input() const
(since 4.7) bool isBlockingCompositing() const
void kdeGeometry(int &frame, int &window)
int mappingState() const
const char *name() const
unsigned long opacity() const
qreal opacityF() const
(since 5.7) int opaqueRegion() const
(since 5.0) int passedProperties2() const
int passedProperties() const
int pid() const
(since 5.3) int protocols() const
(since 5.1) void setActivities(const char *activities)
void setAllowedActions(int actions)
(since 5.69) void setAppMenuObjectPath(const char *path)
(since 5.69) void setAppMenuServiceName(const char *name)
(since 4.7) void setBlockingCompositing(bool active)
void setDesktop(int desktop, bool ignore_viewport = false)
(since 5.28) void setDesktopFileName(const char *name)
void setExtendedStrut(const int &extended_strut)
void setFrameExtents(int strut)
(since 4.4) void setFrameOverlap(int strut)
void setFullscreenMonitors(int topology)
(since 5.65) void setGtkFrameExtents(int strut)
void setHandledIcons(bool handled)
void setIcon(int icon, bool replace = true)
void setIconGeometry(int geometry)
void setIconName(const char *name)
void setName(const char *name)
void setOpacity(unsigned long opacity)
void setOpacityF(qreal opacity)
void setPid(int pid)
void setStartupId(const char *startup_id)
void setState(int state, int mask)
void setUserTime(xcb_timestamp_t time)
void setVisibleIconName(const char *name)
void setVisibleName(const char *visibleName)
void setWindowType(int type)
const char *startupId() const
int state() const
(since 5.3) bool supportsProtocol(int protocol) const
xcb_window_t transientFor() const
(since 5.3) bool urgency() const
xcb_timestamp_t userTime() const
const char *visibleIconName() const
const char *visibleName() const
const char *windowClassClass() const
const char *windowClassName() const
const char *windowRole() const
int windowType(int supported_types) const
xcb_connection_t *xcbConnection() const

Static Public Members

const int OnAllDesktops

Protected Functions

virtual void changeDesktop(int desktop)
virtual void changeFullscreenMonitors(int topology)
virtual void changeState(int state, int mask)

Detailed Description

The NETWinInfo class provides a common API for clients and window managers to set/read/change properties on an application window as defined by the NET Window Manager Specification.

*

See also NET, NETRootInfo, and http://www.freedesktop.org/standards/wm-spec/.

Member Function Documentation

NETWinInfo::NETWinInfo(xcb_connection_t *connection, xcb_window_t window, xcb_window_t rootWindow, int properties, int properties2, int role)

Create a NETWinInfo object, which will be used to set/read/change information stored on an application window.

connection XCB connection

window The Window id of the application window.

rootWindow The Window id of the root window.

properties The NET::Properties flags

properties2 The NET::Properties2 flags

role Select the application role. If this argument is omitted, the role will default to Client. *

NETWinInfo::NETWinInfo(const NETWinInfo &wininfo)

Creates a shared copy of the specified NETWinInfo object.

wininfo the NETWinInfo to copy *

[since 4.6] const char *NETWinInfo::activities() const

returns a comma-separated list of the activities the window is associated with. FIXME this might be better as a NETRArray ?

This function was introduced in 4.6.

See also setActivities().

int NETWinInfo::allowedActions() const

Returns actions that the window manager allows for the window.

See also setAllowedActions().

[since 5.69] const char *NETWinInfo::appMenuObjectPath() const

Returns The menu object path of the window's application if present.

This function was introduced in 5.69.

See also setAppMenuObjectPath().

[since 5.69] const char *NETWinInfo::appMenuServiceName() const

Returns The menu service name of the window's application if present.

This function was introduced in 5.69.

See also setAppMenuServiceName().

[virtual protected] void NETWinInfo::changeDesktop(int desktop)

A Window Manager should subclass NETWinInfo and reimplement this function when it wants to know when a Client made a request to change desktops (ie. move to another desktop).

desktop the number of the desktop *

[virtual protected] void NETWinInfo::changeFullscreenMonitors(int topology)

A Window Manager should subclass NETWinInfo2 and reimplement this function when it wants to know when a Client made a request to change the fullscreen monitor topology for its fullscreen state.

topology A structure (top, bottom, left, right) representing the fullscreen monitor topology. *

[virtual protected] void NETWinInfo::changeState(int state, int mask)

A Window Manager should subclass NETWinInfo and reimplement this function when it wants to know when a Client made a request to change state (ie. to Shade / Unshade).

state the new state

mask the mask for the state *

const char *NETWinInfo::clientMachine() const

Returns the client machine for the window (i.e. WM_CLIENT_MACHINE property).

int NETWinInfo::desktop(bool ignore_viewport = false) const

Returns the desktop where the window is residing.

Note: KDE uses virtual desktops and does not directly support viewport in any way. It is however mapped to virtual desktops if needed.

ignore_viewport if false, viewport is mapped to virtual desktops

*

See also setDesktop() and OnAllDesktops().

[since 5.28] const char *NETWinInfo::desktopFileName() const

Returns The desktop file name of the window's application if present.

This function was introduced in 5.28.

See also setDesktopFileName.

int NETWinInfo::event(xcb_generic_event_t *event)

This function takes the pass XEvent and returns an OR'ed list of NETWinInfo properties that have changed. The new information will be read immediately by the class. This overloaded version returns only a single mask, and therefore cannot check state of all properties like the other variant.

event the event

Returns the properties *

[since 5.0] void NETWinInfo::event(xcb_generic_event_t *event, int *properties, int *properties2 = nullptr)

This function takes the passed in xcb_generic_event_t and returns the updated properties in the passed in arguments.

The new information will be read immediately by the class. It is possible to pass in a null pointer in the arguments. In that case the passed in argument will obviously not be updated, but the class will process the information nevertheless.

event the event

properties The NET::Properties that changed

properties2 The NET::Properties2 that changed

This function was introduced in 5.0.

int NETWinInfo::extendedStrut() const

Returns the extended (partial) strut specified by this client. See _NET_WM_STRUT_PARTIAL in the spec. *

See also setExtendedStrut().

[since 4.3] int NETWinInfo::frameExtents() const

Returns the frame decoration strut, i.e. the width of the decoration borders.

*

This function was introduced in 4.3.

See also setFrameExtents().

[since 4.4] int NETWinInfo::frameOverlap() const

Returns the frame overlap strut, i.e. how far the window frame extends behind the client area on each side.

*

This function was introduced in 4.4.

See also setFrameOverlap().

int NETWinInfo::fullscreenMonitors() const

Returns the desired fullscreen monitor topology for this client, should it be in fullscreen state. See _NET_WM_FULLSCREEN_MONITORS in the spec. *

See also setFullscreenMonitors().

xcb_window_t NETWinInfo::groupLeader() const

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

[since 5.91] const char *NETWinInfo::gtkApplicationId() const

Returns The GTK application id of the window if present.

This function was introduced in 5.91.

[since 5.65] int NETWinInfo::gtkFrameExtents() const

Returns the extents of the drop-shadow drawn by a GTK client.

*

This function was introduced in 5.65.

See also setGtkFrameExtents().

bool NETWinInfo::handledIcons() const

Returns whether or not this client handles icons. *

See also setHandledIcons().

bool NETWinInfo::hasNETSupport() const

Returns true if the window has any window type set, even if the type itself is not known to this implementation. Presence of a window type as specified by the NETWM spec is considered as the window supporting this specification. Returns true if the window has support for the NETWM spec *

bool NETWinInfo::hasWindowType() const

This function returns false if the window has not window type specified at all. Used by KWindowInfo::windowType() to return either NET::Normal or NET::Dialog as appropriate as a fallback. *

[since 5.7] xcb_pixmap_t NETWinInfo::icccmIconPixmap() const

Returns the icon pixmap as set in WM_HINTS. See ICCCM 4.1.2.4.

The default value is XCB_PIXMAP_NONE.

Using the ICCCM variant for the icon is deprecated and only offers a limited functionality compared to icon. Only use this variant as a fallback.

This function was introduced in 5.7.

See also icccmIconPixmapMask and icon.

[since 5.7] xcb_pixmap_t NETWinInfo::icccmIconPixmapMask() const

Returns the mask for the icon pixmap as set in WM_HINTS. See ICCCM 4.1.2.4.

The default value is XCB_PIXMAP_NONE.

This function was introduced in 5.7.

See also icccmIconPixmap.

int NETWinInfo::icon(int width = -1, int height = -1) const

Returns an icon. If width and height are passed, the icon returned will be the closest it can find (the next biggest). If width and height are omitted, then the largest icon in the list is returned.

width the preferred width for the icon, -1 to ignore

height the preferred height for the icon, -1 to ignore

Returns the icon *

See also setIcon().

int NETWinInfo::iconGeometry() const

Returns the icon geometry. *

See also setIconGeometry().

const char *NETWinInfo::iconName() const

Returns the iconic name of the window in UTF-8 format. Note that this has nothing to do with icons, but it's for "iconic" representations of the window (taskbars etc.), that should be shown when the window is in iconic state. See description of _NET_WM_ICON_NAME for details. *

See also setIconName().

[since 4.3] const int *NETWinInfo::iconSizes() const

Returns a list of provided icon sizes. Each size is pair width,height, terminated with pair 0,0. *

This function was introduced in 4.3.

[since 5.5] int NETWinInfo::initialMappingState() const

Returns the initial mapping state as set in WM_HINTS. See ICCCM 4.1.2.4 and 4.1.4.

The default value if Withdrawn in case the Client is mapped without a WM_HINTS property or without the initial state hint set.

This function was introduced in 5.5.

[since 5.3] bool NETWinInfo::input() const

Returns whether the Input flag is set in WM_HINTS. See ICCCM 4.1.2.4 and 4.1.7.

The default value is true in case the Client is mapped without a WM_HINTS property.

This function was introduced in 5.3.

[since 4.7] bool NETWinInfo::isBlockingCompositing() const

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

This function was introduced in 4.7.

void NETWinInfo::kdeGeometry(int &frame, int &window)

Places the window frame geometry in frame, and the application window geometry in window. Both geometries are relative to the root window.

frame the geometry for the frame

window the geometry for the window *

int NETWinInfo::mappingState() const

Returns the mapping state for the window (see the NET base class documentation for a description of mapping state). *

const char *NETWinInfo::name() const

Returns the name of the window in UTF-8 format. *

See also setName().

unsigned long NETWinInfo::opacity() const

Returns the opacity of the window.

See also setOpacity().

qreal NETWinInfo::opacityF() const

Returns the opacity of the window.

See also setOpacityF().

[since 5.7] int NETWinInfo::opaqueRegion() const

Returns The opaque region as specified by the Client.

This function was introduced in 5.7.

[since 5.0] int NETWinInfo::passedProperties2() const

Returns the properties2 argument passed to the constructor.

This function was introduced in 5.0.

See also passedProperties().

int NETWinInfo::passedProperties() const

Returns the properties argument passed to the constructor.

*

See also passedProperties2().

int NETWinInfo::pid() const

Returns the process id for the client window. *

See also setPid().

[since 5.3] int NETWinInfo::protocols() const

Returns The window manager protocols this Client supports.

This function was introduced in 5.3.

[since 5.1] void NETWinInfo::setActivities(const char *activities)

Sets the comma-separated list of activities the window is associated with.

This function was introduced in 5.1.

See also activities().

void NETWinInfo::setAllowedActions(int actions)

Sets actions that the window manager allows for the window.

See also allowedActions().

[since 5.69] void NETWinInfo::setAppMenuObjectPath(const char *path)

Sets the name as the D-BUS object path for the application menu.

This function was introduced in 5.69.

See also appMenuObjectPath().

[since 5.69] void NETWinInfo::setAppMenuServiceName(const char *name)

Sets the name as the D-BUS service name for the application menu.

This function was introduced in 5.69.

See also appMenuServiceName().

[since 4.7] void NETWinInfo::setBlockingCompositing(bool active)

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

This function was introduced in 4.7.

See also isBlockingCompositing().

void NETWinInfo::setDesktop(int desktop, bool ignore_viewport = false)

Set which window the desktop is (should be) on.

Note: KDE uses virtual desktops and does not directly support viewport in any way. It is however mapped to virtual desktops if needed.

desktop the number of the new desktop

ignore_viewport if false, viewport is mapped to virtual desktops

*

See also desktop() and OnAllDesktops().

[since 5.28] void NETWinInfo::setDesktopFileName(const char *name)

Sets the name as the desktop file name.

This is either the base name without full path and without file extension of the desktop file for the window's application (e.g. "org.kde.foo").

If the application's desktop file name is not at a standard location it should be the full path to the desktop file name (e.g. "/opt/kde/share/org.kde.foo.desktop").

If the window does not know the desktop file name, it should not set the name at all.

This function was introduced in 5.28.

See also desktopFileName().

void NETWinInfo::setExtendedStrut(const int &extended_strut)

Set the extended (partial) strut for the application window.

extended_strut the new strut *

See also extendedStrut().

void NETWinInfo::setFrameExtents(int strut)

Set the frame decoration strut, i.e. the width of the decoration borders.

strut the new strut *

See also frameExtents().

[since 4.4] void NETWinInfo::setFrameOverlap(int strut)

Sets the window frame overlap strut, i.e. how far the window frame extends behind the client area on each side.

Set the strut values to -1 if you want the window frame to cover the whole client area.

The default values are 0.

*

This function was introduced in 4.4.

See also frameOverlap().

void NETWinInfo::setFullscreenMonitors(int topology)

Sets the desired multiple-monitor topology (4 monitor indices indicating the top, bottom, left, and right edges of the window) when the fullscreen state is enabled. The indices are from the set returned by the Xinerama extension. See _NET_WM_FULLSCREEN_MONITORS for details.

topology A struct that models the desired monitor topology, namely: top is the monitor whose top edge defines the top edge of the fullscreen window, bottom is the monitor whose bottom edge defines the bottom edge of the fullscreen window, left is the monitor whose left edge defines the left edge of the fullscreen window, and right is the monitor whose right edge defines the right edge of the fullscreen window.

*

See also fullscreenMonitors().

[since 5.65] void NETWinInfo::setGtkFrameExtents(int strut)

Sets the extents of the drop-shadow drawn by the client.

*

This function was introduced in 5.65.

See also gtkFrameExtents().

void NETWinInfo::setHandledIcons(bool handled)

Set whether this application window handles icons.

handled true if the window handles icons, false otherwise *

See also handledIcons().

void NETWinInfo::setIcon(int icon, bool replace = true)

Set icons for the application window. If replace is True, then the specified icon is defined to be the only icon. If replace is False, then the specified icon is added to a list of icons.

icon the new icon

replace true to replace, false to append to the list of icons *

See also icon().

void NETWinInfo::setIconGeometry(int geometry)

Set the icon geometry for the application window.

geometry the new icon geometry *

See also iconGeometry().

void NETWinInfo::setIconName(const char *name)

Sets the iconic name for the application window.

name the new iconic name *

See also iconName().

void NETWinInfo::setName(const char *name)

Sets the name for the application window.

name the new name of the window *

See also name().

void NETWinInfo::setOpacity(unsigned long opacity)

Sets opacity (0 = transparent, 0xffffffff = opaque ) on the window.

See also opacity().

void NETWinInfo::setOpacityF(qreal opacity)

Sets opacity (0 = transparent, 1 = opaque) on the window.

See also opacityF().

void NETWinInfo::setPid(int pid)

Set the application window's process id.

pid the window's process id *

See also pid().

void NETWinInfo::setStartupId(const char *startup_id)

Sets the startup notification id id on the window.

See also startupId().

void NETWinInfo::setState(int state, int mask)

Set the state for the application window (see the NET base class documentation for a description of window state).

state the name state

mask the mask for the state *

See also state().

void NETWinInfo::setUserTime(xcb_timestamp_t time)

Sets user timestamp time on the window (property _NET_WM_USER_TIME). 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, with the special value 0 meaning not to activate the window after being shown.

See also userTime().

void NETWinInfo::setVisibleIconName(const char *name)

For Window Managers only: set the visible iconic name ( i.e. xterm, xterm <2>, xterm <3>, ... )

name the new visible iconic name *

See also visibleIconName().

void NETWinInfo::setVisibleName(const char *visibleName)

For Window Managers only: set the visible name ( i.e. xterm, xterm <2>, xterm <3>, ... )

visibleName the new visible name *

See also visibleName().

void NETWinInfo::setWindowType(int type)

Sets the window type for this client (see the NET base class documentation for a description of the various window types).

type the window type *

See also windowType().

const char *NETWinInfo::startupId() const

Returns the startup notification id of the window.

See also setStartupId().

int NETWinInfo::state() const

Returns the state of the window (see the NET base class documentation for a description of the various states). *

See also setState().

[since 5.3] bool NETWinInfo::supportsProtocol(int protocol) const

Returns true if the Client supports the protocol. protocol The window manager protocol to test for

This function was introduced in 5.3.

xcb_window_t NETWinInfo::transientFor() const

Returns the WM_TRANSIENT_FOR property for the window, i.e. the mainwindow for this window.

[since 5.3] bool NETWinInfo::urgency() const

Returns whether the UrgencyHint is set in the WM_HINTS.flags. See ICCCM 4.1.2.4.

This function was introduced in 5.3.

xcb_timestamp_t NETWinInfo::userTime() const

Returns the time of last user action on the window, or -1 if not set.

See also setUserTime().

const char *NETWinInfo::visibleIconName() const

Returns the visible iconic name as set by the window manager in UTF-8 format. Note that this has nothing to do with icons, but it's for "iconic" representations of the window (taskbars etc.), that should be shown when the window is in iconic state. See description of _NET_WM_VISIBLE_ICON_NAME for details. *

See also setVisibleIconName().

const char *NETWinInfo::visibleName() const

Returns the visible name as set by the window manager in UTF-8 format. *

See also setVisibleName().

const char *NETWinInfo::windowClassClass() const

Returns the class component of the window class for the window (i.e. WM_CLASS property).

const char *NETWinInfo::windowClassName() const

Returns the name component of the window class for the window (i.e. WM_CLASS property).

const char *NETWinInfo::windowRole() const

Returns the window role for the window (i.e. WM_WINDOW_ROLE property).

int NETWinInfo::windowType(int supported_types) const

Returns the window type for this client (see the NET base class documentation for a description of the various window types). Since clients may specify several windows types for a window in order to support backwards compatibility and extensions not available in the NETWM spec, you should specify all window types you application supports (see the NET::WindowTypeMask mask values for various window types). This method will return the first window type that is listed in the supported types, or NET::Unknown if none of the window types is supported. *

See also setWindowType().

xcb_connection_t *NETWinInfo::xcbConnection() const

Returns the xcb connection used.

Returns the XCB connection *

Member Variable Documentation

const int NETWinInfo::OnAllDesktops

Sentinel value to indicate that the client wishes to be visible on all desktops.

Returns the value to be on all desktops *