netwm.h
/*
Copyright (c) 2000 Troll Tech AS
Copyright (c) 2003 Lubos Lunak <l.lunak@kde.org>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef __net_wm_h
#define __net_wm_h
#include "kdelibs_export.h"
#include <qwidget.h>
#ifdef Q_WS_X11
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include "netwm_def.h"
// forward declaration
struct NETRootInfoPrivate;
struct NETWinInfoPrivate;
template <class Z> class NETRArray;
class KDECORE_EXPORT NETRootInfo : public NET {
public:
// update also NETRootInfoPrivate::properties[] size when extending this
enum { PROTOCOLS, WINDOW_TYPES, STATES, PROTOCOLS2, ACTIONS,
PROPERTIES_SIZE };
NETRootInfo(Display *display, Window supportWindow, const char *wmName,
const unsigned long properties[], int properties_size,
int screen = -1, bool doActivate = true);
NETRootInfo(Display *display, Window supportWindow, const char *wmName,
unsigned long properties, int screen = -1, bool doActivate = true) KDE_DEPRECATED;
NETRootInfo(Display *display, const unsigned long properties[], int properties_size,
int screen = -1, bool doActivate = true);
NETRootInfo(Display *display, unsigned long properties, int screen = -1,
bool doActivate = true);
NETRootInfo(const NETRootInfo &rootinfo);
virtual ~NETRootInfo();
Display *x11Display() const;
Window rootWindow() const;
Window supportWindow() const;
const char *wmName() const;
int screenNumber() const;
bool isSupported( NET::Property property ) const;
bool isSupported( NET::Property2 property ) const;
bool isSupported( NET::WindowType type ) const;
bool isSupported( NET::State state ) const;
bool isSupported( NET::Action action ) const;
const unsigned long* supportedProperties() const;
// KDE4 better name?
const unsigned long* passedProperties() const;
unsigned long supported() const KDE_DEPRECATED;
const Window *clientList() const;
int clientListCount() const;
const Window *clientListStacking() const;
int clientListStackingCount() const;
const Window *kdeSystemTrayWindows() const;
int kdeSystemTrayWindowsCount() const;
NETSize desktopGeometry(int desktop) const;
NETPoint desktopViewport(int desktop) const;
NETRect workArea(int desktop) const;
const char *desktopName(int desktop) const;
const Window *virtualRoots( ) const;
int virtualRootsCount() const;
NET::Orientation desktopLayoutOrientation() const;
QSize desktopLayoutColumnsRows() const;
NET::DesktopLayoutCorner desktopLayoutCorner() const;
int numberOfDesktops() const;
int currentDesktop() const;
Window activeWindow() const;
void activate();
// KDE4 'const Window*', also in the others below
void setClientList(Window *windows, unsigned int count);
void setClientListStacking(Window *windows, unsigned int count);
void setKDESystemTrayWindows(Window *windows, unsigned int count);
void setCurrentDesktop(int desktop);
void setDesktopGeometry(int desktop, const NETSize &geometry);
void setDesktopViewport(int desktop, const NETPoint &viewport);
void setNumberOfDesktops(int numberOfDesktops);
void setDesktopName(int desktop, const char *desktopName);
void setActiveWindow(Window window, NET::RequestSource src,
Time timestamp, Window active_window);
void setActiveWindow(Window window);
void setWorkArea(int desktop, const NETRect &workArea);
void setVirtualRoots(Window *windows, unsigned int count);
void setDesktopLayout(NET::Orientation orientation, int columns, int rows,
NET::DesktopLayoutCorner corner);
void setShowingDesktop( bool showing );
bool showingDesktop() const;
const NETRootInfo &operator=(const NETRootInfo &rootinfo);
void closeWindowRequest(Window window);
void moveResizeRequest(Window window, int x_root, int y_root,
Direction direction);
void moveResizeWindowRequest(Window window, int flags, int x, int y, int width, int height );
void restackRequest(Window window, RequestSource source, Window above, int detail, Time timestamp);
void restackRequest(Window window, Window above, int detail);
void event( XEvent* event, unsigned long* properties, int properties_size );
unsigned long event(XEvent *event);
protected:
virtual void addClient(Window window) { Q_UNUSED(window); }
virtual void removeClient(Window window) { Q_UNUSED(window); }
virtual void addSystemTrayWin(Window window) { Q_UNUSED(window); }
virtual void removeSystemTrayWin(Window window) { Q_UNUSED(window); }
virtual void changeNumberOfDesktops(int numberOfDesktops) { Q_UNUSED(numberOfDesktops); }
virtual void changeDesktopGeometry(int desktop, const NETSize &geom) { Q_UNUSED(desktop); Q_UNUSED(geom); }
virtual void changeDesktopViewport(int desktop, const NETPoint &viewport) { Q_UNUSED(desktop); Q_UNUSED(viewport); }
virtual void changeCurrentDesktop(int desktop) { Q_UNUSED(desktop); }
virtual KDE_DEPRECATED void changeActiveWindow(Window window) { Q_UNUSED(window); }
virtual void closeWindow(Window window) { Q_UNUSED(window); }
virtual void moveResize(Window window, int x_root, int y_root,
unsigned long direction) { Q_UNUSED(window); Q_UNUSED(x_root); Q_UNUSED(y_root); Q_UNUSED(direction); }
private:
void update( const unsigned long[] );
void setSupported();
void setDefaultProperties();
void updateSupportedProperties( Atom atom );
Role role;
protected:
virtual void virtual_hook( int id, void* data );
private:
NETRootInfoPrivate *p;
friend class NETRootInfo2;
friend class NETRootInfo3;
};
class KDECORE_EXPORT NETRootInfo2
: public NETRootInfo
{
public:
NETRootInfo2(Display *display, Window supportWindow, const char *wmName,
unsigned long properties[], int properties_size,
int screen = -1, bool doActivate = true);
NETRootInfo2(Display *display, const unsigned long properties[], int properties_size,
int screen = -1, bool doActivate = true);
void sendPing( Window window, Time timestamp );
protected:
friend class NETRootInfo;
virtual void gotPing( Window window, Time timestamp ) { Q_UNUSED(window); Q_UNUSED(timestamp); }
virtual void changeActiveWindow(Window window,NET::RequestSource src,
Time timestamp, Window active_window ) { Q_UNUSED(window); Q_UNUSED(src); Q_UNUSED(timestamp); Q_UNUSED(active_window);}
virtual void restackWindow(Window window, Window above, int detail) { Q_UNUSED(window); Q_UNUSED(above); Q_UNUSED(detail); }
virtual void moveResizeWindow(Window window, int flags, int x, int y, int width, int height) { Q_UNUSED(window); Q_UNUSED(flags); Q_UNUSED(x); Q_UNUSED(y); Q_UNUSED(width); Q_UNUSED(height); }
// no private data, use NETRootInfoPrivate
};
class KDECORE_EXPORT NETRootInfo3
: public NETRootInfo2
{
public:
NETRootInfo3(Display *display, Window supportWindow, const char *wmName,
unsigned long properties[], int properties_size,
int screen = -1, bool doActivate = true);
NETRootInfo3(Display *display, const unsigned long properties[], int properties_size,
int screen = -1, bool doActivate = true);
void takeActivity( Window window, Time timestamp, long flags );
protected:
friend class NETRootInfo;
virtual void restackWindow(Window window, RequestSource source,
Window above, int detail, Time timestamp) { Q_UNUSED(window); Q_UNUSED(source); Q_UNUSED(above); Q_UNUSED(detail); Q_UNUSED(timestamp); }
virtual void gotTakeActivity(Window window, Time timestamp, long flags ) { Q_UNUSED(window); Q_UNUSED(timestamp); Q_UNUSED(flags); }
// no private data, use NETRootInfoPrivate
};
class KDECORE_EXPORT NETRootInfo4
: public NETRootInfo3
{
public:
NETRootInfo4(Display *display, Window supportWindow, const char *wmName,
unsigned long properties[], int properties_size,
int screen = -1, bool doActivate = true);
NETRootInfo4(Display *display, const unsigned long properties[], int properties_size,
int screen = -1, bool doActivate = true);
protected:
friend class NETRootInfo;
virtual void changeShowingDesktop(bool showing) { Q_UNUSED(showing); }
// no private data, use NETRootInfoPrivate
};
class KDECORE_EXPORT NETWinInfo : public NET {
public:
// update also NETWinInfoPrivate::properties[] size when extending this
enum { PROTOCOLS, PROTOCOLS2,
PROPERTIES_SIZE };
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 NETWinInfo &operator=(const NETWinInfo &wintinfo);
bool hasNETSupport() const;
// KDE4 better name?
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 setFrameExtents(NETStrut strut);
void setKDEFrameStrut(NETStrut strut);
NETIcon icon(int width = -1, int height = -1) const;
/*
* Sets user timestamp @p 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.
* @since 3.2
*/
void setUserTime( Time time );
Time userTime() const;
/*
* Sets the startup notification id @p id on the window.
* @since 3.2
*/
void setStartupId( const char* startup_id );
const char* startupId() const;
void setAllowedActions( unsigned long actions );
unsigned long allowedActions() const;
/*
* Returns the WM_TRANSIENT_FOR property for the window, i.e. the mainwindow
* for this window.
* @since 3.2
*/
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 const int OnAllDesktops;
protected:
virtual void changeDesktop(int desktop) { Q_UNUSED(desktop); }
virtual void changeState(unsigned long state, unsigned long mask) { Q_UNUSED(state); Q_UNUSED(mask); }
private:
void update( const unsigned long[] );
void updateWMState();
void setIconInternal(NETRArray<NETIcon>& icons, int& icon_count, Atom property, NETIcon icon, Bool replace);
NETIcon iconInternal(NETRArray<NETIcon>& icons, int icon_count, int width, int height) const;
Role role;
protected:
virtual void virtual_hook( int id, void* data );
private:
NETWinInfoPrivate *p;
};
//#define KWIN_FOCUS
#endif
#endif // __net_wm_h
NETIcon
Simple icon class for NET classes.
Definition: netwm_def.h:122
NETStrut
Definition: netwm_def.h:195
NETExtendedStrut
Partial strut class for NET classes.
Definition: netwm_def.h:153
NETPoint
Simple point class for NET classes.
Definition: netwm_def.h:44
NETRect
Simple rectangle class for NET classes.
Definition: netwm_def.h:94
NET
Base namespace class.
Definition: netwm_def.h:235
NET::RequestSource
RequestSource
Source of the request.
Definition: netwm_def.h:630
NETSize
Simple size class for NET classes.
Definition: netwm_def.h:71

KDE Home | KDE Accessibility Home | Description of Access Keys