kdecore Library API Documentation

netwm.h

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   __net_wm_h
00028 #define   __net_wm_h
00029 
00030 #include "kdelibs_export.h"
00031 #include <qwidget.h>
00032 #ifdef Q_WS_X11
00033 #include <X11/Xlib.h>
00034 #include <X11/Xutil.h>
00035 #include <X11/Xatom.h>
00036 
00037 #include "netwm_def.h"
00038 
00039 // forward declaration
00040 struct NETRootInfoPrivate;
00041 struct NETWinInfoPrivate;
00042 
00043 
00057 class KDECORE_EXPORT NETRootInfo : public NET {
00058 public:
00063     // update also NETRootInfoPrivate::properties[] size when extending this
00064     enum { PROTOCOLS, WINDOW_TYPES, STATES, PROTOCOLS2, ACTIONS,
00065         PROPERTIES_SIZE };
00066 
00100     NETRootInfo(Display *display, Window supportWindow, const char *wmName,
00101         const unsigned long properties[], int properties_size,
00102                 int screen = -1, bool doActivate = true);
00103 
00110     NETRootInfo(Display *display, Window supportWindow, const char *wmName,
00111         unsigned long properties, int screen = -1, bool doActivate = true) KDE_DEPRECATED;
00112 
00135     NETRootInfo(Display *display, const unsigned long properties[], int properties_size,
00136                 int screen = -1, bool doActivate = true);
00137 
00144     NETRootInfo(Display *display, unsigned long properties, int screen = -1,
00145         bool doActivate = true);
00146 
00152     NETRootInfo(const NETRootInfo &rootinfo);
00153 
00157     virtual ~NETRootInfo();
00158 
00164     Display *x11Display() const;
00165 
00171     Window rootWindow() const;
00172 
00178     Window supportWindow() const;
00179 
00185     const char *wmName() const;
00186 
00192     int screenNumber() const;
00193 
00200     bool isSupported( NET::Property property ) const;
00205     bool isSupported( NET::Property2 property ) const;
00210     bool isSupported( NET::WindowType type ) const;
00215     bool isSupported( NET::State state ) const;
00216 
00221     bool isSupported( NET::Action action ) const;
00222 
00234     const unsigned long* supportedProperties() const;
00235 
00242     // KDE4 better name?
00243     const unsigned long* passedProperties() const;
00244 
00260     unsigned long supported() const KDE_DEPRECATED;
00261 
00269     const Window *clientList() const;
00270 
00278     int clientListCount() const;
00279 
00288     const Window *clientListStacking() const;
00289 
00297     int clientListStackingCount() const;
00298 
00306     const Window *kdeSystemTrayWindows() const;
00307 
00315     int kdeSystemTrayWindowsCount() const;
00316 
00327     NETSize desktopGeometry(int desktop) const;
00328 
00336     NETPoint desktopViewport(int desktop) const;
00337 
00345     NETRect workArea(int desktop) const;
00346 
00354     const char *desktopName(int desktop) const;
00355 
00363     const Window *virtualRoots( ) const;
00364 
00372     int virtualRootsCount() const;
00373 
00379     int numberOfDesktops() const;
00380 
00386     int currentDesktop() const;
00387 
00393     Window activeWindow() const;
00394 
00403     void activate();
00404 
00412     // KDE4 'const Window*', also in the others below
00413     void setClientList(Window *windows, unsigned int count);
00414 
00423     void setClientListStacking(Window *windows, unsigned int count);
00424 
00432     void setKDESystemTrayWindows(Window *windows, unsigned int count);
00433 
00439     void setCurrentDesktop(int desktop);
00440 
00451     void setDesktopGeometry(int desktop, const NETSize &geometry);
00452 
00460     void setDesktopViewport(int desktop, const NETPoint &viewport);
00461 
00467     void setNumberOfDesktops(int numberOfDesktops);
00468 
00476     void setDesktopName(int desktop, const char *desktopName);
00477 
00490     void setActiveWindow(Window window, NET::RequestSource src,
00491         Time timestamp, Window active_window);
00492 
00499     void setActiveWindow(Window window);
00500 
00508     void setWorkArea(int desktop, const NETRect &workArea);
00509 
00517     void setVirtualRoots(Window *windows, unsigned int count);
00518 
00523     const NETRootInfo &operator=(const NETRootInfo &rootinfo);
00524 
00532     void closeWindowRequest(Window window);
00533 
00549     void moveResizeRequest(Window window, int x_root, int y_root,
00550                Direction direction);
00551 
00562     void moveResizeWindowRequest(Window window, int flags, int x, int y, int width, int height );
00563 
00568     void restackRequest(Window window, RequestSource source, Window above, int detail, Time timestamp);
00573     void restackRequest(Window window, Window above, int detail);
00574     
00590     void event( XEvent* event, unsigned long* properties, int properties_size );
00591     
00603     unsigned long event(XEvent *event);
00604 
00605 
00606 protected:
00613     // virtual void addClient(Window window) { }
00614     virtual void addClient(Window) { }
00615 
00622     // virtual void removeClient(Window window) { }
00623     virtual void removeClient(Window) { }
00624 
00632     // virtual void addSystemTrayWin(Window window) { }
00633     virtual void addSystemTrayWin(Window) { }
00634 
00642     // virtual void removeSystemTrayWin(Window window) { }
00643     virtual void removeSystemTrayWin(Window) { }
00644 
00652     // virtual void changeNumberOfDesktops(int numberOfDesktops) { }
00653     virtual void changeNumberOfDesktops(int) { }
00654 
00664     // virtual void changeDesktopGeometry(int desktop, const NETSize &geom) { }
00665     virtual void changeDesktopGeometry(int, const NETSize &) { }
00666 
00676     // virtual void changeDesktopViewport(int desktop, const NETPoint &viewport) { }
00677     virtual void changeDesktopViewport(int, const NETPoint &) { }
00678 
00686     // virtual void changeCurrentDesktop(int desktop) { }
00687     virtual void changeCurrentDesktop(int) { }
00688 
00698     // virtual void changeActiveWindow(Window window) { }
00699     virtual KDE_DEPRECATED void changeActiveWindow(Window) { }
00700 
00707     // virtual void closeWindow(Window window) { }
00708     virtual void closeWindow(Window) { }
00709 
00723     // virtual void moveResize(Window window, int x_root, int y_root,
00724     //              unsigned long direction) { }
00725     virtual void moveResize(Window, int, int, unsigned long) { }
00726 
00727 
00728 private:
00729     void update( const unsigned long[] );
00730     void setSupported();
00731     void setDefaultProperties();
00732     void updateSupportedProperties( Atom atom );
00733     Role role;
00734 
00735 protected:
00736     virtual void virtual_hook( int id, void* data );
00737 private:
00738     NETRootInfoPrivate *p;
00739     friend class NETRootInfo2;
00740     friend class NETRootInfo3;
00741 };
00742 
00749 class KDECORE_EXPORT NETRootInfo2
00750     : public NETRootInfo
00751 {
00752 public:
00753     NETRootInfo2(Display *display, Window supportWindow, const char *wmName,
00754         unsigned long properties[], int properties_size,
00755                 int screen = -1, bool doActivate = true);
00760     void sendPing( Window window, Time timestamp );
00761 protected:
00762     friend class NETRootInfo;
00769     // virtual void gotPing( Window window, Time timestamp ) {};
00770     virtual void gotPing( Window, Time ) {};
00781     // virtual void changeActiveWindow(Window window,NET::RequestSource src,
00782     //     Time timestamp, Window active_window ) { }
00783     virtual void changeActiveWindow(Window,NET::RequestSource,Time,Window) { }
00793     // virtual void restackWindow(Window window, Window above, int detail) { }
00794     virtual void restackWindow(Window, Window, int) { }
00795 
00803     // virtual void moveResizeWindow(Window window, int flags, int x, int y, int width, int height) { }
00804     virtual void moveResizeWindow( Window, int, int, int, int, int ) { }
00805 
00806 // no private data, use NETRootInfoPrivate
00807 };
00808 
00815 class KDECORE_EXPORT NETRootInfo3
00816     : public NETRootInfo2
00817 {
00818 public:
00819     NETRootInfo3(Display *display, Window supportWindow, const char *wmName,
00820         unsigned long properties[], int properties_size,
00821                 int screen = -1, bool doActivate = true);
00829     void takeActivity( Window window, Time timestamp, long flags );
00830 protected:
00831     friend class NETRootInfo;
00843     // virtual void restackWindow(Window window, RequestSource source,
00844     //        Window above, int detail, Time timestamp) { }
00845     virtual void restackWindow(Window, RequestSource, Window, int, Time) { }
00853     //virtual void gotTakeActivity(Window, Time timestamp, long flags ) {}
00854     virtual void gotTakeActivity(Window, Time, long ) {}
00855 // no private data, use NETRootInfoPrivate
00856 };
00857 
00872 class KDECORE_EXPORT NETWinInfo : public NET {
00873 public:
00878     // update also NETWinInfoPrivate::properties[] size when extending this
00879     enum { PROTOCOLS, PROTOCOLS2,
00880         PROPERTIES_SIZE };
00905     NETWinInfo(Display *display, Window window, Window rootWindow,
00906                const unsigned long properties[], int properties_size,
00907            Role role = Client);
00908 
00915     NETWinInfo(Display *display, Window window,
00916            Window rootWindow, unsigned long properties,
00917            Role role = Client);
00918 
00924     NETWinInfo(const NETWinInfo & wininfo);
00925 
00929     virtual ~NETWinInfo();
00930 
00935     const NETWinInfo &operator=(const NETWinInfo &wintinfo);
00936 
00945     bool hasNETSupport() const;
00946 
00953     // KDE4 better name?
00954     const unsigned long* passedProperties() const;
00955 
00965     unsigned long properties() const KDE_DEPRECATED;
00966 
00972     NETRect iconGeometry() const;
00973 
00980     unsigned long state() const;
00981 
00986     NETExtendedStrut extendedStrut() const;
00987 
00994     NETStrut strut() const;
00995 
01010     WindowType windowType( unsigned long supported_types ) const;
01011 
01019     WindowType windowType() const KDE_DEPRECATED;
01020 
01026     const char *name() const;
01027 
01033     const char *visibleName() const;
01034 
01044     const char *iconName() const;
01045 
01055     const char *visibleIconName() const;
01056 
01064     int desktop() const;
01065 
01071     int pid() const;
01072 
01078     Bool handledIcons() const;
01079 
01086     Window kdeSystemTrayWinFor() const;
01087 
01094     MappingState mappingState() const;
01095 
01105     void setIcon(NETIcon icon, Bool replace = True);
01106 
01112     void setIconGeometry(NETRect geometry);
01113 
01119     void setExtendedStrut(const NETExtendedStrut& extended_strut );
01120 
01127     void setStrut(NETStrut strut);
01128 
01139     void setState(unsigned long state, unsigned long mask);
01140 
01147     void setWindowType(WindowType type);
01148 
01154     void setName(const char *name);
01155 
01162     void setVisibleName(const char *visibleName);
01163 
01169     void setIconName(const char *name);
01170 
01177     void setVisibleIconName(const char *name);
01178 
01186     void setDesktop(int desktop);
01187 
01193     void setPid(int pid);
01194 
01200     void setHandledIcons(Bool handled);
01201 
01207     void setKDESystemTrayWinFor(Window window);
01208 
01215     void setKDEFrameStrut(NETStrut strut);
01216 
01228     NETIcon icon(int width = -1, int height = -1) const;
01229 
01230     /*    
01231      * Sets user timestamp @p time on the window (property _NET_WM_USER_TIME).
01232      * The timestamp is expressed as XServer time. If a window
01233      * is shown with user timestamp older than the time of the last
01234      * user action, it won't be activated after being shown, with the special
01235      * value 0 meaning not to activate the window after being shown.
01236      * @since 3.2
01237      */
01238     void setUserTime( Time time );
01239     
01244     Time userTime() const;
01245 
01246     /*    
01247      * Sets the startup notification id @p id on the window.
01248      * @since 3.2
01249      */
01250     void setStartupId( const char* startup_id );
01251     
01256     const char* startupId() const;
01257 
01262     void setAllowedActions( unsigned long actions );
01263 
01268     unsigned long allowedActions() const;
01269 
01270     /*
01271      * Returns the WM_TRANSIENT_FOR property for the window, i.e. the mainwindow
01272      * for this window.
01273      * @since 3.2
01274      */
01275     Window transientFor() const;
01276 
01281     Window groupLeader() const;
01282     
01288     const char* windowClassClass() const;
01289 
01295     const char* windowClassName() const;
01296 
01301     const char* windowRole() const;
01302 
01307     const char* clientMachine() const;
01308 
01317     void kdeGeometry(NETRect &frame, NETRect &window);
01318 
01334     void event( XEvent* event, unsigned long* properties, int properties_size );
01335 
01347     unsigned long event(XEvent *event);
01348 
01355     static const int OnAllDesktops;
01356 
01357 
01358 protected:
01366     // virtual void changeDesktop(int desktop) { }
01367     virtual void changeDesktop(int) { }
01368 
01378     virtual void changeState(unsigned long /*state*/, unsigned long /*mask*/) { }
01379 
01380 private:
01381     void update( const unsigned long[] );
01382     void updateWMState();
01383     Role role;
01384 
01385 protected:
01386     virtual void virtual_hook( int id, void* data );
01387 private:
01388     NETWinInfoPrivate *p;
01389 };
01390 
01391 
01392 //#define KWIN_FOCUS
01393 
01394 #endif
01395 #endif // __net_wm_h
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.90.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 30 10:09:42 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003