kdecore Library API Documentation

NETWinInfo Class Reference

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

#include <netwm.h>

Inheritance diagram for NETWinInfo:

Inheritance graph
[legend]
Collaboration diagram for NETWinInfo:

Collaboration graph
[legend]
List of all members.

Public Types

enum  { PROTOCOLS, PROTOCOLS2, PROPERTIES_SIZE }

Public Member Functions

 NETWinInfo (Display *display, Window window, Window rootWindow, const unsigned long properties[], int properties_size, Role role=Client)
 NETWinInfo (Display *display, Window window, Window rootWindow, unsigned long properties, Role role=Client)
 NETWinInfo (const NETWinInfo &wininfo)
virtual ~NETWinInfo ()
const NETWinInfooperator= (const NETWinInfo &wintinfo)
bool hasNETSupport () const
const unsigned long * passedProperties () const
unsigned long properties () const KDE_DEPRECATED
NETRect iconGeometry () const
unsigned long state () const
NETExtendedStrut extendedStrut () const
NETStrut strut () const
WindowType windowType (unsigned long supported_types) const
WindowType windowType () const KDE_DEPRECATED
const char * name () const
const char * visibleName () const
const char * iconName () const
const char * visibleIconName () const
int desktop () const
int pid () const
Bool handledIcons () const
Window kdeSystemTrayWinFor () const
MappingState mappingState () const
void setIcon (NETIcon icon, Bool replace=True)
void setIconGeometry (NETRect geometry)
void setExtendedStrut (const NETExtendedStrut &extended_strut)
void setStrut (NETStrut strut)
void setState (unsigned long state, unsigned long mask)
void setWindowType (WindowType type)
void setName (const char *name)
void setVisibleName (const char *visibleName)
void setIconName (const char *name)
void setVisibleIconName (const char *name)
void setDesktop (int desktop)
void setPid (int pid)
void setHandledIcons (Bool handled)
void setKDESystemTrayWinFor (Window window)
void setKDEFrameStrut (NETStrut strut)
NETIcon icon (int width=-1, int height=-1) const
void setUserTime (Time time)
Time userTime () const
void setStartupId (const char *startup_id)
const char * startupId () const
void setAllowedActions (unsigned long actions)
unsigned long allowedActions () const
Window transientFor () const
Window groupLeader () const
const char * windowClassClass () const
const char * windowClassName () const
const char * windowRole () const
const char * clientMachine () const
void kdeGeometry (NETRect &frame, NETRect &window)
void event (XEvent *event, unsigned long *properties, int properties_size)
unsigned long event (XEvent *event)

Static Public Attributes

static const int OnAllDesktops = NET::OnAllDesktops

Protected Member Functions

virtual void changeDesktop (int desktop)
virtual void changeState (unsigned long state, unsigned long mask)
virtual void virtual_hook (int id, void *data)

Detailed Description

Common API for application window properties/protocols.

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.

Author:
Bradley T. Hughes <bhughes@trolltech.com>
See also:
NET

NETRootInfo

KWin

http://www.freedesktop.org/standards/wm-spec/

Definition at line 865 of file netwm.h.


Member Enumeration Documentation

anonymous enum
 

Indexes for the properties array.

Since:
3.2

Reimplemented from NET.

Definition at line 872 of file netwm.h.


Constructor & Destructor Documentation

NETWinInfo::NETWinInfo Display *  display,
Window  window,
Window  rootWindow,
const unsigned long  properties[],
int  properties_size,
Role  role = Client
 

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

Parameters:
display An X11 Display struct.
window The Window id of the application window.
rootWindow The Window id of the root window.
properties An array of elements listing all properties the client is interested in.The elements contain OR'ed values of constants from the NET base class, in the following order: [0]= NET::Property, [1]= NET::Property2. In future versions, the list may be extended. In case you pass less elements, the missing ones will be replaced with default values.
properties_size The number of elements in the properties array.
role Select the application role. If this argument is omitted, the role will default to Client.
Since:
3.2

Definition at line 2581 of file netwm.cpp.

NETWinInfo::NETWinInfo Display *  display,
Window  window,
Window  rootWindow,
unsigned long  properties,
Role  role = Client
 

This constructor differs from the above one only in the way it accepts the list of properties the client is interested in.

The properties argument is equivalent to the first element of the properties array in the above constructor.

Definition at line 2644 of file netwm.cpp.

NETWinInfo::NETWinInfo const NETWinInfo wininfo  ) 
 

Creates a shared copy of the specified NETWinInfo object.

Parameters:
wininfo the NETWinInfo to copy

Definition at line 2701 of file netwm.cpp.

References p.

NETWinInfo::~NETWinInfo  )  [virtual]
 

Destroys the NETWinInfo object.

Definition at line 2707 of file netwm.cpp.


Member Function Documentation

const NETWinInfo & NETWinInfo::operator= const NETWinInfo wintinfo  ) 
 

Assignment operator.

Ensures that the shared data reference counts are correct.

Definition at line 2716 of file netwm.cpp.

References p, and role.

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.

Since:
3.2
Returns:
true if the window has support for the NETWM spec

Definition at line 4210 of file netwm.cpp.

const unsigned long * NETWinInfo::passedProperties  )  const
 

Returns the properties argument passed to the constructor.

The size is the maximum array size the constructor accepts.

Since:
3.2

Definition at line 4247 of file netwm.cpp.

unsigned long NETWinInfo::properties  )  const
 

Deprecated:
Returns an OR'ed list of protocols passed to the constructor.

Returns:
an OR'ed list of protocols
See also:
NET::Property

Definition at line 4251 of file netwm.cpp.

NETRect NETWinInfo::iconGeometry  )  const
 

Returns the icon geometry.

Returns:
the geometry of the icon

Definition at line 4112 of file netwm.cpp.

unsigned long NETWinInfo::state  )  const
 

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

Returns:
the state of the window

Definition at line 4117 of file netwm.cpp.

Referenced by event(), and KWin::info().

NETExtendedStrut NETWinInfo::extendedStrut  )  const
 

Returns the extended (partial) strut specified by this client.

See _NET_WM_STRUT_PARTIAL in the spec.

Definition at line 4126 of file netwm.cpp.

NETStrut NETWinInfo::strut  )  const
 

Deprecated:
use strutPartial() Returns the strut specified by this client.

Returns:
the strut of the window

Definition at line 4122 of file netwm.cpp.

Referenced by KWin::info(), and KWinModule::workArea().

NET::WindowType NETWinInfo::windowType unsigned long  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.

Returns:
the type of the window
Since:
3.2

Definition at line 4154 of file netwm.cpp.

References NET::typeMatchesMask().

Referenced by KWin::info().

NET::WindowType NETWinInfo::windowType  )  const
 

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

Returns:
the type of the window

Definition at line 4165 of file netwm.cpp.

const char * NETWinInfo::name  )  const
 

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

Returns:
the name of the window

Definition at line 4170 of file netwm.cpp.

Referenced by KWin::info().

const char * NETWinInfo::visibleName  )  const
 

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

Returns:
the visible name of the window

Definition at line 4175 of file netwm.cpp.

Referenced by KWin::info().

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.

Returns:
the iconic name

Definition at line 4180 of file netwm.cpp.

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.

Returns:
the visible iconic name

Definition at line 4185 of file netwm.cpp.

int NETWinInfo::desktop  )  const
 

Returns the desktop where the window is residing.

Returns:
the number of the window's desktop
See also:
OnAllDesktops()

Definition at line 4190 of file netwm.cpp.

Referenced by KWin::info(), KWin::setOnAllDesktops(), and KWinModule::workArea().

int NETWinInfo::pid  )  const
 

Returns the process id for the client window.

Returns:
the process id of the window

Definition at line 4194 of file netwm.cpp.

Referenced by KWin::info().

Bool NETWinInfo::handledIcons  )  const
 

Returns whether or not this client handles icons.

Returns:
true if this client handles icons, false otherwise

Definition at line 4238 of file netwm.cpp.

Window NETWinInfo::kdeSystemTrayWinFor  )  const
 

Returns a Window id, telling the window manager which window we are representing.

Returns:
the window id

Definition at line 4243 of file netwm.cpp.

NET::MappingState NETWinInfo::mappingState  )  const
 

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

Returns:
the mapping state

Definition at line 4256 of file netwm.cpp.

Referenced by KWin::info().

void NETWinInfo::setIcon NETIcon  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.

Parameters:
icon the new icon
replace true to replace, false to append to the list of icons

Definition at line 2736 of file netwm.cpp.

References NETIcon::data, NETSize::height, NETIcon::size, and NETSize::width.

Referenced by KWin::setIcons().

void NETWinInfo::setIconGeometry NETRect  geometry  ) 
 

Set the icon geometry for the application window.

Parameters:
geometry the new icon geometry

Definition at line 2790 of file netwm.cpp.

References NETSize::height, NETRect::pos, NETRect::size, NETSize::width, NETPoint::x, and NETPoint::y.

void NETWinInfo::setExtendedStrut const NETExtendedStrut extended_strut  ) 
 

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

Parameters:
extended_strut the new strut

Definition at line 2806 of file netwm.cpp.

References NETExtendedStrut::bottom_end, NETExtendedStrut::bottom_start, NETExtendedStrut::bottom_width, NETExtendedStrut::left_end, NETExtendedStrut::left_start, NETExtendedStrut::left_width, NETExtendedStrut::right_end, NETExtendedStrut::right_start, NETExtendedStrut::right_width, NETExtendedStrut::top_end, NETExtendedStrut::top_start, and NETExtendedStrut::top_width.

Referenced by KWin::setExtendedStrut().

void NETWinInfo::setStrut NETStrut  strut  ) 
 

Deprecated:
use setExtendedStrut() Set the strut for the application window.

Parameters:
strut the new strut

Definition at line 2830 of file netwm.cpp.

References NETStrut::bottom, NETStrut::left, NETStrut::right, and NETStrut::top.

Referenced by KWin::setStrut().

void NETWinInfo::setState unsigned long  state,
unsigned long  mask
 

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

Note that the constructor needs to be passed NET::WMState in properties even if it's only used for setting the state without reading it.

Parameters:
state the name state
mask the mask for the state

Definition at line 2846 of file netwm.cpp.

Referenced by KWin::clearState(), KWin::demandAttention(), and KWin::setState().

void NETWinInfo::setWindowType WindowType  type  ) 
 

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

Parameters:
type the window type

Definition at line 3050 of file netwm.cpp.

References NET::Splash, and NET::Utility.

Referenced by KWin::setType().

void NETWinInfo::setName const char *  name  ) 
 

Sets the name for the application window.

Parameters:
name the new name of the window

Definition at line 3128 of file netwm.cpp.

void NETWinInfo::setVisibleName const char *  visibleName  ) 
 

For Window Managers only: set the visible name ( i.e.

xterm, xterm <2>, xterm <3>, ... )

Parameters:
visibleName the new visible name

Definition at line 3142 of file netwm.cpp.

void NETWinInfo::setIconName const char *  name  ) 
 

Sets the iconic name for the application window.

Parameters:
name the new iconic name

Definition at line 3156 of file netwm.cpp.

void NETWinInfo::setVisibleIconName const char *  name  ) 
 

For Window Managers only: set the visible iconic name ( i.e.

xterm, xterm <2>, xterm <3>, ... )

Parameters:
name the new visible iconic name

Definition at line 3170 of file netwm.cpp.

void NETWinInfo::setDesktop int  desktop  ) 
 

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

Parameters:
desktop the number of the new desktop
See also:
OnAllDesktops()

Definition at line 3184 of file netwm.cpp.

References OnAllDesktops.

Referenced by KWin::setOnAllDesktops(), and KWin::setOnDesktop().

void NETWinInfo::setPid int  pid  ) 
 

Set the application window's process id.

Parameters:
pid the window's process id

Definition at line 3228 of file netwm.cpp.

void NETWinInfo::setHandledIcons Bool  handled  ) 
 

Set whether this application window handles icons.

Parameters:
handled true if the window handles icons, false otherwise

Definition at line 3238 of file netwm.cpp.

void NETWinInfo::setKDESystemTrayWinFor Window  window  ) 
 

Set which window we are representing as a system tray window.

Parameters:
window the window that is represented by the system tray icon

Definition at line 3290 of file netwm.cpp.

Referenced by KWin::setSystemTrayWindowFor().

void NETWinInfo::setKDEFrameStrut NETStrut  strut  ) 
 

Set the frame decoration strut.

This is a KDE 2.0 extension to aid in writing pager applications.

Parameters:
strut the new strut

Definition at line 3300 of file netwm.cpp.

References NETStrut::bottom, NETStrut::left, NETStrut::right, and NETStrut::top.

NETIcon 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 first icon in the list is returned.

Parameters:
width the preferred width for the icon, -1 to ignore
height the preferred height for the icon, -1 to ignore
Returns:
the icon

Definition at line 3341 of file netwm.cpp.

References NETIcon::data, NETSize::height, NETIcon::size, and NETSize::width.

Referenced by KWin::icon().

Time NETWinInfo::userTime  )  const
 

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

Since:
3.2

Definition at line 4198 of file netwm.cpp.

const char * NETWinInfo::startupId  )  const
 

Returns the startup notification id of the window.

Since:
3.2

Definition at line 4202 of file netwm.cpp.

void NETWinInfo::setAllowedActions unsigned long  actions  ) 
 

Sets actions that the window manager allows for the window.

Since:
3.2

Definition at line 3257 of file netwm.cpp.

unsigned long NETWinInfo::allowedActions  )  const
 

Returns actions that the window manager allows for the window.

Since:
3.2

Definition at line 4206 of file netwm.cpp.

Window NETWinInfo::groupLeader  )  const
 

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

Since:
3.2

Definition at line 4218 of file netwm.cpp.

const char * NETWinInfo::windowClassClass  )  const
 

Returns the class component of the window class for the window (i.e.

WM_CLASS property).

Since:
3.3

Definition at line 4222 of file netwm.cpp.

const char * NETWinInfo::windowClassName  )  const
 

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

WM_CLASS property).

Since:
3.3

Definition at line 4226 of file netwm.cpp.

const char * NETWinInfo::windowRole  )  const
 

Returns the window role for the window (i.e.

WM_WINDOW_ROLE property).

Since:
3.3

Definition at line 4230 of file netwm.cpp.

const char * NETWinInfo::clientMachine  )  const
 

Returns the client machine for the window (i.e.

WM_CLIENT_MACHINE property).

Since:
3.3

Definition at line 4234 of file netwm.cpp.

void NETWinInfo::kdeGeometry NETRect frame,
NETRect window
 

Places the window frame geometry in frame, and the application window geometry in window.

Both geometries are relative to the root window.

Parameters:
frame the geometry for the frame
window the geometry for the window

Definition at line 3316 of file netwm.cpp.

References NETSize::height, NETRect::pos, NETRect::size, NETSize::width, NETPoint::x, and NETPoint::y.

Referenced by KWin::info().

void NETWinInfo::event XEvent *  event,
unsigned long *  properties,
int  properties_size
 

This function takes the passed XEvent and returns an OR'ed list of NETWinInfo properties that have changed in the properties argument.

The new information will be read immediately by the class. The elements of the properties argument are as they would be passed to the constructor, if the array is not large enough, changed properties that don't fit in it won't be listed there (they'll be updated in the class though).

Parameters:
event the event
properties properties that changed
properties_size size of the passed properties array
Since:
3.2

Definition at line 3386 of file netwm.cpp.

References changeDesktop(), changeState(), OnAllDesktops, state(), NET::WM2ClientMachine, NET::WM2WindowClass, and NET::WM2WindowRole.

Referenced by event().

unsigned long NETWinInfo::event XEvent *  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.

Parameters:
event the event
Returns:
the properties

Definition at line 3379 of file netwm.cpp.

References event().

virtual void NETWinInfo::changeDesktop int  desktop  )  [inline, protected, virtual]
 

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).

Parameters:
desktop the number of the desktop

Definition at line 1359 of file netwm.h.

Referenced by event().

virtual void NETWinInfo::changeState unsigned long  state,
unsigned long  mask
[inline, protected, virtual]
 

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).

Parameters:
state the new state
mask the mask for the state

Definition at line 1370 of file netwm.h.

Referenced by event().


Member Data Documentation

const int NETWinInfo::OnAllDesktops = NET::OnAllDesktops [static]
 

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

Returns:
the value to be on all desktops

Reimplemented from NET.

Definition at line 1348 of file netwm.h.

Referenced by event(), KWin::info(), setDesktop(), KWin::setOnAllDesktops(), and KWinModule::workArea().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdecore Library Version 3.4.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 9 07:55:21 2005 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003