# kdecore Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KWin Class Reference

Convenience access to certain properties and features of the window manager. Class for interaction with the window manager. More...

`#include <kwin.h>`

List of all members.

## Static Public Member Functions

void | setActiveWindow (WId win)
| Sets window `win` to be the active window.
void | invokeContextHelp ()
| Invokes interactive context help.
void | setSystemTrayWindowFor (WId trayWin, WId forWin)
| Makes `trayWin` a system tray window for `forWin`.
Info | info (WId win)
| Returns information about window `win`.
QPixmap | icon (WId win, int width=-1, int height=-1, bool scale=false)
| Returns an icon for window `win`.
void | setIcons (WId win, const QPixmap &icon, const QPixmap &miniIcon)
| Sets an `icon` and a `miniIcon` on window `win`.
void | setType (WId win, NET::WindowType windowType)
| Sets the type of window `win` to `windowType`.
void | setState (WId win, unsigned long state)
| Sets the state of window `win` to `state`.
void | clearState (WId win, unsigned long state)
| Clears the state of window `win` from `state`.
void | setOnAllDesktops (WId win, bool b)
| Sets window `win` to be present on all virtual desktops if `is` true.
void | setOnDesktop (WId win, int desktop)
| Moves window `win` to desktop `desktop`.
void | setStrut (WId win, int left, int right, int top, int bottom)
| Sets the strut of window `win` to `left`, `right`, `top`, `bottom`.
int | currentDesktop ()
| Convenience function to access the current desktop.
int | numberOfDesktops ()
| Convenience function to access the number of desktops.
void | setCurrentDesktop (int desktop)
| Convenience function to set the current desktop to `desktop`.
void | iconifyWindow (WId win, bool animation=true)
| Iconifies a window.
void | deIconifyWindow (WId win, bool animation=true)
| DeIconifies a window.
void | appStarted ()
| This class or method is obsolete, it is provided for compatibility only. Use KStartupInfo::appStarted

## Detailed Description

Convenience access to certain properties and features of the window manager. Class for interaction with the window manager.

This class is not supposed to be instantiated. It exists mostly as a namespace for the static member functions.

In KDE 2 and KDE 3, communication with the windowmanager is done with the NET-protocol, a common window manager specification designed by various authors of X11 window managers (including those of the KDE project). The full specification can be found in kdebase/kwin/wm-spec/

To access features of the NET-protocol, use the classes NETRootInfo and NETWinInfo.

The purpose of this class is to to provide easy access to the most-commonly used NET-features with a simpler, KDEish interface.

In addition, it encapsulates KDE functionality not yet provided by the NET hints. Currently that is invokeContextHelp() and setSystemTrayWindowFor() only.

See also:
  NET

  NetWinInfo

Author:
  Matthias Ettrich (ettrich@kde.org)

Definition at line 57 of file kwin.h.

## Member Function Documentation

void KWin::setActiveWindow | ( | WId | win | ) | `[static]`

Sets window `win` to be the active window.

This is a request to the window manager. It may or may not be obeyed.

Parameters:

  win | the if of the window to make active

Definition at line 188 of file kwin.cpp.

References info().

Referenced by KUniqueApplication::newInstance().

void KWin::invokeContextHelp | ( |  | ) | `[static]`

| Invokes interactive context help. Definition at line 176 of file kwin.cpp.

void KWin::setSystemTrayWindowFor | ( | WId | trayWin,
|  | WId | forWin
| ) | `[static]`

Makes `trayWin` a system tray window for `forWin`.

A system tray window serves as an icon replacement. It's displayed inside the panel's system tray.

Parameters:

  trayWin | the id of the system tray window
  trayWin | the id of the window represented by the system tray window

Definition at line 181 of file kwin.cpp.

References info().

KWin::Info KWin::info | ( | WId | win | ) | `[static]`

Returns information about window `win`.

Parameters:

  win | the id of the windoe

Returns:
  the window information

Definition at line 194 of file kwin.cpp.

References KWin::Info::desktop, KWin::Info::frameGeometry, QString::fromLocal8Bit(), QString::fromUtf8(), KWin::Info::geometry, NETSize::height, KWin::Info::mappingState, KWin::Info::name, KWin::Info::onAllDesktops, KWin::Info::pid, NETRect::pos, QRect::setRect(), NETRect::size, KWin::Info::state, KWin::Info::strut, KWin::Info::visibleName, NETSize::width, KWin::Info::win, KWin::Info::windowType, NETPoint::x, and NETPoint::y.

Referenced by clearState(), currentDesktop(), icon(), numberOfDesktops(), setActiveWindow(), setCurrentDesktop(), setIcons(), setOnAllDesktops(), setOnDesktop(), setState(), setStrut(), setSystemTrayWindowFor(), and setType().

QPixmap KWin::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:

  win | the id of the window
  the | desired width, or -1
  the | desired height, or -1
  if | true the icon will be scaled to the desired size. Otherwise the icon will not be modified.

Returns:
  the icon of the window

Definition at line 238 of file kwin.cpp.

References QPixmap::convertFromImage(), QPixmap::convertToImage(), NETIcon::data, KIcon::DefaultState, QPixmap::detach(), NETSize::height, KInstance::iconLoader(), info(), KGlobal::instance(), QPixmap::isNull(), QImage::isNull(), KIconLoader::loadIcon(), QString::lower(), QImage::setAlphaBuffer(), QPixmap::setMask(), QImage::size(), NETIcon::size, QImage::smoothScale(), and NETSize::width.

void KWin::setIcons | ( | WId | win,
|  | const QPixmap & | icon,
|  | const QPixmap & | miniIcon
| ) | `[static]`

Sets an `icon` and a `miniIcon` on window `win`.

Parameters:

  win | the id of the window
  icon | the new icon
  miniIcon | the new mini icon

Definition at line 341 of file kwin.cpp.

References QImage::bits(), QPixmap::convertToImage(), NETIcon::data, NETSize::height, info(), QPixmap::isNull(), QImage::size(), NETIcon::size, and NETSize::width.

Referenced by KApplication::setTopWidget().

void KWin::setType | ( | WId | win,
|  | NET::WindowType | windowType
| ) | `[static]`

Sets the type of window `win` to `windowType`.

Possible values are NET::Normal, NET::Desktop, NET::Dock, NET::Tool, NET::Menu, NET::Dialog, NET::Override (== no decoration frame) or NET::TopMenu

Parameters:

  win | the id of the window
  windowType | the type of the window

Definition at line 361 of file kwin.cpp.

References info().

void KWin::setState | ( | WId | win,
|  | unsigned long | 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::StaysOnTop, NET::SkipPager

Parameters:

  win | the id of the window
  state | the new flags that will be set

Definition at line 367 of file kwin.cpp.

References info().

void KWin::clearState | ( | WId | win,
|  | unsigned long | 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::StaysOnTop, NET::SkipPager

Parameters:

  win | the id of the window
  state | the flags that will be cleared

Definition at line 373 of file kwin.cpp.

References info().

void KWin::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:

  win | the id of the window
  b | true to show the window on all desktops, false otherwise

Definition at line 379 of file kwin.cpp.

References info().

void KWin::setOnDesktop | ( | WId | win,
|  | int | desktop
| ) | `[static]`

Moves window `win` to desktop `desktop`.

Parameters:

  win | the id of the window
  desktop | the number of the new desktop

Definition at line 390 of file kwin.cpp.

References info().

void KWin::setStrut | ( | WId | win,
|  | int | left,
|  | int | right,
|  | int | top,
|  | int | bottom
| ) | `[static]`

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

Parameters:

  win | the id of the window
  left | the left strut
  right | the right strut
  top | the top strut
  bottom | the bottom strut

Definition at line 408 of file kwin.cpp.

References NETStrut::bottom, info(), NETStrut::left, NETStrut::right, and NETStrut::top.

int KWin::currentDesktop | ( |  | ) | `[static]`

Convenience function to access the current desktop.

See NETRootInfo.

Returns:
  the number of the current desktop

Definition at line 419 of file kwin.cpp.

References info().

int KWin::numberOfDesktops | ( |  | ) | `[static]`

Convenience function to access the number of desktops.

See NETRootInfo.

Returns:
  the number of desktops

Definition at line 427 of file kwin.cpp.

References info().

void KWin::setCurrentDesktop | ( | int | desktop | ) | `[static]`

Convenience function to set the current desktop to `desktop`.

See NETRootInfo.

Parameters:

  the | number of the new desktop

Definition at line 435 of file kwin.cpp.

References info().

void KWin::iconifyWindow | ( | WId | win,
|  | bool | animation = true
| ) | `[static]`

Iconifies a window.

Compatible to XIconifyWindow but has an additional parameter `animation`.

Parameters:

  win | the id of the window
  animation | true to show an animation

See also:
  deIconifyWindow()

Definition at line 442 of file kwin.cpp.

void KWin::deIconifyWindow | ( | WId | win,
|  | bool | animation = true
| ) | `[static]`

DeIconifies a window.

Compatible to XMapWindow but has an additional parameter `animation`.

Parameters:

  win | the id of the window
  animation | true to show an animation

See also:
  iconifyWindow()

Definition at line 450 of file kwin.cpp.

void KWin::appStarted | ( |  | ) | `[static]`

| This class or method is obsolete, it is provided for compatibility only. Use KStartupInfo::appStarted Definition at line 457 of file kwin.cpp.

The documentation for this class was generated from the following files:

- kwin.h
- kwin.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:51:51 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001