• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

netwm.h

Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (c) 2000 Troll Tech AS
00004   Copyright (c) 2003 Lubos Lunak <l.lunak@kde.org>
00005 
00006   Permission is hereby granted, free of charge, to any person obtaining a
00007   copy of this software and associated documentation files (the "Software"),
00008   to deal in the Software without restriction, including without limitation
00009   the rights to use, copy, modify, merge, publish, distribute, sublicense,
00010   and/or sell copies of the Software, and to permit persons to whom the
00011   Software is furnished to do so, subject to the following conditions:
00012 
00013   The above copyright notice and this permission notice shall be included in
00014   all copies or substantial portions of the Software.
00015 
00016   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00017   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00018   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00019   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00020   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00021   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00022   DEALINGS IN THE SOFTWARE.
00023 
00024 */
00025 
00026 
00027 #ifndef   netwm_h
00028 #define   netwm_h
00029 
00030 #include <kdeui_export.h>
00031 #include <QtGui/QWidget>
00032 #ifdef Q_WS_X11
00033 #include <X11/Xlib.h>
00034 #include <X11/Xutil.h>
00035 #include <X11/Xatom.h>
00036 #include <fixx11h.h>
00037 
00038 #include "netwm_def.h"
00039 
00040 // forward declaration
00041 struct NETRootInfoPrivate;
00042 struct NETWinInfoPrivate;
00043 template <class Z> class NETRArray;
00044 
00045 
00058 class KDEUI_EXPORT NETRootInfo : public NET {
00059 public:
00063     // update also NETRootInfoPrivate::properties[] size when extending this
00064     enum { PROTOCOLS, WINDOW_TYPES, STATES, PROTOCOLS2, ACTIONS,
00065         PROPERTIES_SIZE };
00066 
00098     NETRootInfo(Display *display, Window supportWindow, const char *wmName,
00099         const unsigned long properties[], int properties_size,
00100                 int screen = -1, bool doActivate = true);
00101 
00102 
00124     NETRootInfo(Display *display, const unsigned long properties[], int properties_size,
00125                 int screen = -1, bool doActivate = true);
00126 
00133     NETRootInfo(Display *display, unsigned long properties, int screen = -1,
00134         bool doActivate = true);
00135 
00141     NETRootInfo(const NETRootInfo &rootinfo);
00142 
00146     virtual ~NETRootInfo();
00147 
00153     Display *x11Display() const;
00154 
00160     Window rootWindow() const;
00161 
00167     Window supportWindow() const;
00168 
00174     const char *wmName() const;
00175 
00181     int screenNumber() const;
00182 
00188     bool isSupported( NET::Property property ) const;
00192     bool isSupported( NET::Property2 property ) const;
00196     bool isSupported( NET::WindowType type ) const;
00200     bool isSupported( NET::State state ) const;
00201 
00205     bool isSupported( NET::Action action ) const;
00206 
00216     const unsigned long* supportedProperties() const;
00217 
00222     const unsigned long* passedProperties() const;
00223 
00231     const Window *clientList() const;
00232 
00240     int clientListCount() const;
00241 
00250     const Window *clientListStacking() const;
00251 
00259     int clientListStackingCount() const;
00260 
00275     NETSize desktopGeometry(int desktop) const;
00276 
00288     NETPoint desktopViewport(int desktop) const;
00289 
00297     NETRect workArea(int desktop) const;
00298 
00306     const char *desktopName(int desktop) const;
00307 
00315     const Window *virtualRoots( ) const;
00316 
00324     int virtualRootsCount() const;
00325 
00329     NET::Orientation desktopLayoutOrientation() const;
00330 
00335     QSize desktopLayoutColumnsRows() const;
00336 
00340     NET::DesktopLayoutCorner desktopLayoutCorner() const;
00341 
00353     int numberOfDesktops( bool ignore_viewport = false ) const;
00354 
00366     int currentDesktop( bool ignore_viewport = false ) const;
00367 
00373     Window activeWindow() const;
00374 
00383     void activate();
00384 
00392     void setClientList(const Window *windows, unsigned int count);
00393 
00402     void setClientListStacking(const Window *windows, unsigned int count);
00403 
00414     void setCurrentDesktop(int desktop, bool ignore_viewport = false);
00415 
00430     void setDesktopGeometry(int desktop, const NETSize &geometry);
00431 
00443     void setDesktopViewport(int desktop, const NETPoint &viewport);
00444 
00454     void setNumberOfDesktops(int numberOfDesktops);
00455 
00467     void setDesktopName(int desktop, const char *desktopName);
00468 
00479     void setActiveWindow(Window window, NET::RequestSource src,
00480         Time timestamp, Window active_window);
00481 
00488     void setActiveWindow(Window window);
00489 
00497     void setWorkArea(int desktop, const NETRect &workArea);
00498 
00506     void setVirtualRoots(const Window *windows, unsigned int count);
00507 
00512     void setDesktopLayout(NET::Orientation orientation, int columns, int rows,
00513         NET::DesktopLayoutCorner corner);
00514 
00518     void setShowingDesktop( bool showing );
00522     bool showingDesktop() const;
00523 
00528     const NETRootInfo &operator=(const NETRootInfo &rootinfo);
00529 
00537     void closeWindowRequest(Window window);
00538 
00554     void moveResizeRequest(Window window, int x_root, int y_root,
00555                Direction direction);
00556 
00570     void moveResizeWindowRequest(Window window, int flags, int x, int y, int width, int height );
00571 
00575     void restackRequest(Window window, RequestSource source, Window above, int detail, Time timestamp);
00576 
00581     void sendPing( Window window, Time timestamp );
00582 
00590     void takeActivity( Window window, Time timestamp, long flags );
00591 
00606     void event( XEvent* event, unsigned long* properties, int properties_size );
00607 
00619     unsigned long event(XEvent *event);
00620 
00621 
00622 protected:
00629     virtual void addClient(Window window) { Q_UNUSED(window); }
00630 
00637     virtual void removeClient(Window window) { Q_UNUSED(window); }
00638 
00646     virtual void changeNumberOfDesktops(int numberOfDesktops) { Q_UNUSED(numberOfDesktops); }
00647 
00657     virtual void changeDesktopGeometry(int desktop, const NETSize &geom) { Q_UNUSED(desktop); Q_UNUSED(geom); }
00658 
00668     virtual void changeDesktopViewport(int desktop, const NETPoint &viewport) { Q_UNUSED(desktop); Q_UNUSED(viewport); }
00669 
00677     virtual void changeCurrentDesktop(int desktop) { Q_UNUSED(desktop); }
00678 
00685     virtual void closeWindow(Window window) { Q_UNUSED(window); }
00686 
00700     virtual void moveResize(Window window, int x_root, int y_root,
00701                     unsigned long direction) { Q_UNUSED(window); Q_UNUSED(x_root); Q_UNUSED(y_root); Q_UNUSED(direction); }
00702 
00709     virtual void gotPing( Window window, Time timestamp ) { Q_UNUSED(window); Q_UNUSED(timestamp); }
00720     virtual void changeActiveWindow(Window window,NET::RequestSource src,
00721         Time timestamp, Window active_window ) { Q_UNUSED(window); Q_UNUSED(src); Q_UNUSED(timestamp); Q_UNUSED(active_window);}
00722 
00735     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); }
00736 
00748     virtual void restackWindow(Window window, RequestSource source,
00749            Window above, int detail, Time timestamp) { Q_UNUSED(window); Q_UNUSED(source); Q_UNUSED(above); Q_UNUSED(detail); Q_UNUSED(timestamp); }
00757     virtual void gotTakeActivity(Window window, Time timestamp, long flags ) { Q_UNUSED(window); Q_UNUSED(timestamp); Q_UNUSED(flags); }
00758 
00766     virtual void changeShowingDesktop(bool showing) { Q_UNUSED(showing); }
00767 
00768 private:
00769     void update( const unsigned long[] );
00770     void setSupported();
00771     void setDefaultProperties();
00772     void updateSupportedProperties( Atom atom );
00773 
00774 protected:
00778     virtual void virtual_hook( int id, void* data );
00779 private:
00780     NETRootInfoPrivate *p; // krazy:exclude=dpointer (implicitly shared)
00781 };
00782 
00796 class KDEUI_EXPORT NETWinInfo : public NET {
00797 public:
00801     // update also NETWinInfoPrivate::properties[] size when extending this
00802     enum { PROTOCOLS, PROTOCOLS2,
00803         PROPERTIES_SIZE };
00826     NETWinInfo(Display *display, Window window, Window rootWindow,
00827                const unsigned long properties[], int properties_size,
00828            Role role = Client);
00829 
00836     NETWinInfo(Display *display, Window window,
00837            Window rootWindow, unsigned long properties,
00838            Role role = Client);
00839 
00845     NETWinInfo(const NETWinInfo & wininfo);
00846 
00850     virtual ~NETWinInfo();
00851 
00856     const NETWinInfo &operator=(const NETWinInfo &wintinfo);
00857 
00865     bool hasNETSupport() const;
00866 
00871     const unsigned long* passedProperties() const;
00872 
00878     NETRect iconGeometry() const;
00879 
00886     unsigned long state() const;
00887 
00892     NETExtendedStrut extendedStrut() const;
00893 
00900     NETStrut strut() const;
00901 
00915     WindowType windowType( unsigned long supported_types ) const;
00916 
00922     bool hasWindowType() const;
00923 
00929     const char *name() const;
00930 
00936     const char *visibleName() const;
00937 
00947     const char *iconName() const;
00948 
00958     const char *visibleIconName() const;
00959 
00973     int desktop( bool ignore_viewport = false ) const;
00974 
00980     int pid() const;
00981 
00987     Bool handledIcons() const;
00988 
00995     MappingState mappingState() const;
00996 
01006     void setIcon(NETIcon icon, Bool replace = True);
01007 
01013     void setIconGeometry(NETRect geometry);
01014 
01020     void setExtendedStrut(const NETExtendedStrut& extended_strut );
01021 
01028     void setStrut(NETStrut strut);
01029 
01038     void setState(unsigned long state, unsigned long mask);
01039 
01046     void setWindowType(WindowType type);
01047 
01053     void setName(const char *name);
01054 
01061     void setVisibleName(const char *visibleName);
01062 
01068     void setIconName(const char *name);
01069 
01076     void setVisibleIconName(const char *name);
01077 
01090     void setDesktop(int desktop, bool ignore_viewport = false);
01091 
01097     void setPid(int pid);
01098 
01104     void setHandledIcons(Bool handled);
01105 
01111     void setFrameExtents(NETStrut strut);
01112 
01118     NETStrut frameExtents() const;
01119 
01131     NETIcon icon(int width = -1, int height = -1) const;
01132     
01138     const int* iconSizes() const;
01139 
01147     void setUserTime( Time time );
01148 
01152     Time userTime() const;
01153 
01157     void setStartupId( const char* startup_id );
01158 
01162     const char* startupId() const;
01163 
01167     void setOpacity( unsigned long opacity );
01168 
01172     unsigned long opacity() const;
01173 
01177     void setAllowedActions( unsigned long actions );
01178 
01182     unsigned long allowedActions() const;
01183 
01188     Window transientFor() const;
01189 
01193     Window groupLeader() const;
01194 
01199     const char* windowClassClass() const;
01200 
01205     const char* windowClassName() const;
01206 
01210     const char* windowRole() const;
01211 
01215     const char* clientMachine() const;
01216 
01225     void kdeGeometry(NETRect &frame, NETRect &window);
01226 
01240     void event( XEvent* event, unsigned long* properties, int properties_size );
01241 
01253     unsigned long event(XEvent *event);
01254 
01261     static const int OnAllDesktops;
01262 
01263 protected:
01271     virtual void changeDesktop(int desktop) { Q_UNUSED(desktop); }
01272 
01282     virtual void changeState(unsigned long state, unsigned long mask) { Q_UNUSED(state); Q_UNUSED(mask); }
01283 
01284 private:
01285     void update( const unsigned long[] );
01286     void updateWMState();
01287     void setIconInternal(NETRArray<NETIcon>& icons, int& icon_count, Atom property, NETIcon icon, Bool replace);
01288     NETIcon iconInternal(NETRArray<NETIcon>& icons, int icon_count, int width, int height) const;
01289 
01290 protected:
01294     virtual void virtual_hook( int id, void* data );
01295 private:
01296     NETWinInfoPrivate *p; // krazy:exclude=dpointer (implicitly shared)
01297     friend class NETWinInfo2;
01298 };
01299 
01300 
01307 class KDEUI_EXPORT NETWinInfo2 : public NETWinInfo {
01308 public:
01309     NETWinInfo2(Display *display, Window window, Window rootWindow,
01310                 const unsigned long properties[], int properties_size,
01311                 Role role = Client);
01312 
01313     NETWinInfo2(Display *display, Window window,
01314                 Window rootWindow, unsigned long properties,
01315                 Role role = Client);
01316 
01333     void setFullscreenMonitors(NETFullscreenMonitors topology);
01334 
01340     NETFullscreenMonitors fullscreenMonitors() const;
01341 
01342 protected:
01343     friend class NETWinInfo;
01352     virtual void changeFullscreenMonitors(NETFullscreenMonitors topology) { Q_UNUSED(topology); }
01353 };
01354 
01355 //#define KWIN_FOCUS
01356 
01357 #endif
01358 #endif // netwm_h

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  •     Sodep
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal