| # kdecore Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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
    00567     void moveResizeWindowRequest(Window window, int flags, int x, int y, int width, int height );
    00568
    00573     void restackRequest(Window window, RequestSource source, Window above, int detail, Time timestamp);
    00578     void restackRequest(Window window, Window above, int detail);
    00579
    00595     void event( XEvent* event, unsigned long* properties, int properties_size );
    00596
    00608     unsigned long event(XEvent *event);
    00609
    00610
    00611 protected:
    00618     virtual void addClient(Window window) { Q_UNUSED(window); }
    00619
    00626     virtual void removeClient(Window window) { Q_UNUSED(window); }
    00627
    00635     virtual void addSystemTrayWin(Window window) { Q_UNUSED(window); }
    00636
    00644     virtual void removeSystemTrayWin(Window window) { Q_UNUSED(window); }
    00645
    00653     virtual void changeNumberOfDesktops(int numberOfDesktops) { Q_UNUSED(numberOfDesktops); }
    00654
    00664     virtual void changeDesktopGeometry(int desktop, const NETSize &geom) { Q_UNUSED(desktop); Q_UNUSED(geom); }
    00665
    00675     virtual void changeDesktopViewport(int desktop, const NETPoint &viewport) { Q_UNUSED(desktop); Q_UNUSED(viewport); }
    00676
    00684     virtual void changeCurrentDesktop(int desktop) { Q_UNUSED(desktop); }
    00685
    00695     virtual KDE_DEPRECATED void changeActiveWindow(Window window) { Q_UNUSED(window); }
    00696
    00703     virtual void closeWindow(Window window) { Q_UNUSED(window); }
    00704
    00718     virtual void moveResize(Window window, int x_root, int y_root,
    00719                     unsigned long direction) { Q_UNUSED(window); Q_UNUSED(x_root); Q_UNUSED(y_root); Q_UNUSED(direction); }
    00720
    00721
    00722 private:
    00723     void update( const unsigned long[] );
    00724     void setSupported();
    00725     void setDefaultProperties();
    00726     void updateSupportedProperties( Atom atom );
    00727     Role role;
    00728
    00729 protected:
    00730     virtual void virtual_hook( int id, void* data );
    00731 private:
    00732     NETRootInfoPrivate *p;
    00733     friend class NETRootInfo2;
    00734     friend class NETRootInfo3;
    00735 };
    00736
    00743 class KDECORE_EXPORT NETRootInfo2
    00744     : public NETRootInfo
    00745 {
    00746 public:
    00747     NETRootInfo2(Display *display, Window supportWindow, const char *wmName,
    00748         unsigned long properties[], int properties_size,
    00749                 int screen = -1, bool doActivate = true);
    00754     void sendPing( Window window, Time timestamp );
    00755 protected:
    00756     friend class NETRootInfo;
    00763     virtual void gotPing( Window window, Time timestamp ) { Q_UNUSED(window); Q_UNUSED(timestamp); }
    00774     virtual void changeActiveWindow(Window window,NET::RequestSource src,
    00775         Time timestamp, Window active_window ) { Q_UNUSED(window); Q_UNUSED(src); Q_UNUSED(timestamp); Q_UNUSED(active_window);}
    00785     virtual void restackWindow(Window window, Window above, int detail) { Q_UNUSED(window); Q_UNUSED(above); Q_UNUSED(detail); }
    00786
    00799     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); }
    00800
    00801 // no private data, use NETRootInfoPrivate
    00802 };
    00803
    00810 class KDECORE_EXPORT NETRootInfo3
    00811     : public NETRootInfo2
    00812 {
    00813 public:
    00814     NETRootInfo3(Display *display, Window supportWindow, const char *wmName,
    00815         unsigned long properties[], int properties_size,
    00816                 int screen = -1, bool doActivate = true);
    00824     void takeActivity( Window window, Time timestamp, long flags );
    00825 protected:
    00826     friend class NETRootInfo;
    00838     virtual void restackWindow(Window window, RequestSource source,
    00839            Window above, int detail, Time timestamp) { Q_UNUSED(window); Q_UNUSED(source); Q_UNUSED(above); Q_UNUSED(detail); Q_UNUSED(timestamp); }
    00847     virtual void gotTakeActivity(Window window, Time timestamp, long flags ) { Q_UNUSED(window); Q_UNUSED(timestamp); Q_UNUSED(flags); }
    00848 // no private data, use NETRootInfoPrivate
    00849 };
    00850
    00865 class KDECORE_EXPORT NETWinInfo : public NET {
    00866 public:
    00871     // update also NETWinInfoPrivate::properties[] size when extending this
    00872     enum { PROTOCOLS, PROTOCOLS2,
    00873         PROPERTIES_SIZE };
    00898     NETWinInfo(Display *display, Window window, Window rootWindow,
    00899                const unsigned long properties[], int properties_size,
    00900            Role role = Client);
    00901
    00908     NETWinInfo(Display *display, Window window,
    00909            Window rootWindow, unsigned long properties,
    00910            Role role = Client);
    00911
    00917     NETWinInfo(const NETWinInfo & wininfo);
    00918
    00922     virtual ~NETWinInfo();
    00923
    00928     const NETWinInfo &operator=(const NETWinInfo &wintinfo);
    00929
    00938     bool hasNETSupport() const;
    00939
    00946     // KDE4 better name?
    00947     const unsigned long* passedProperties() const;
    00948
    00958     unsigned long properties() const KDE_DEPRECATED;
    00959
    00965     NETRect iconGeometry() const;
    00966
    00973     unsigned long state() const;
    00974
    00979     NETExtendedStrut extendedStrut() const;
    00980
    00987     NETStrut strut() const;
    00988
    01003     WindowType windowType( unsigned long supported_types ) const;
    01004
    01012     WindowType windowType() const KDE_DEPRECATED;
    01013
    01019     const char *name() const;
    01020
    01026     const char *visibleName() const;
    01027
    01037     const char *iconName() const;
    01038
    01048     const char *visibleIconName() const;
    01049
    01057     int desktop() const;
    01058
    01064     int pid() const;
    01065
    01071     Bool handledIcons() const;
    01072
    01079     Window kdeSystemTrayWinFor() const;
    01080
    01087     MappingState mappingState() const;
    01088
    01098     void setIcon(NETIcon icon, Bool replace = True);
    01099
    01105     void setIconGeometry(NETRect geometry);
    01106
    01112     void setExtendedStrut(const NETExtendedStrut& extended_strut );
    01113
    01120     void setStrut(NETStrut strut);
    01121
    01132     void setState(unsigned long state, unsigned long mask);
    01133
    01140     void setWindowType(WindowType type);
    01141
    01147     void setName(const char *name);
    01148
    01155     void setVisibleName(const char *visibleName);
    01156
    01162     void setIconName(const char *name);
    01163
    01170     void setVisibleIconName(const char *name);
    01171
    01179     void setDesktop(int desktop);
    01180
    01186     void setPid(int pid);
    01187
    01193     void setHandledIcons(Bool handled);
    01194
    01200     void setKDESystemTrayWinFor(Window window);
    01201
    01208     void setKDEFrameStrut(NETStrut strut);
    01209
    01221     NETIcon icon(int width = -1, int height = -1) const;
    01222
    01223     /*
    01224      * Sets user timestamp @p time on the window (property _NET_WM_USER_TIME).
    01225      * The timestamp is expressed as XServer time. If a window
    01226      * is shown with user timestamp older than the time of the last
    01227      * user action, it won't be activated after being shown, with the special
    01228      * value 0 meaning not to activate the window after being shown.
    01229      * @since 3.2
    01230      */
    01231     void setUserTime( Time time );
    01232
    01237     Time userTime() const;
    01238
    01239     /*
    01240      * Sets the startup notification id @p id on the window.
    01241      * @since 3.2
    01242      */
    01243     void setStartupId( const char* startup_id );
    01244
    01249     const char* startupId() const;
    01250
    01255     void setAllowedActions( unsigned long actions );
    01256
    01261     unsigned long allowedActions() const;
    01262
    01263     /*
    01264      * Returns the WM_TRANSIENT_FOR property for the window, i.e. the mainwindow
    01265      * for this window.
    01266      * @since 3.2
    01267      */
    01268     Window transientFor() const;
    01269
    01274     Window groupLeader() const;
    01275
    01281     const char* windowClassClass() const;
    01282
    01288     const char* windowClassName() const;
    01289
    01294     const char* windowRole() const;
    01295
    01300     const char* clientMachine() const;
    01301
    01310     void kdeGeometry(NETRect &frame, NETRect &window);
    01311
    01327     void event( XEvent* event, unsigned long* properties, int properties_size );
    01328
    01340     unsigned long event(XEvent *event);
    01341
    01348     static const int OnAllDesktops;
    01349
    01350
    01351 protected:
    01359     virtual void changeDesktop(int desktop) { Q_UNUSED(desktop); }
    01360
    01370     virtual void changeState(unsigned long state, unsigned long mask) { Q_UNUSED(state); Q_UNUSED(mask); }
    01371
    01372 private:
    01373     void update( const unsigned long[] );
    01374     void updateWMState();
    01375     Role role;
    01376
    01377 protected:
    01378     virtual void virtual_hook( int id, void* data );
    01379 private:
    01380     NETWinInfoPrivate *p;
    01381 };
    01382
    01383
    01384 //#define KWIN_FOCUS
    01385
    01386 #endif
    01387 #endif // __net_wm_h

This file is part of the documentation for kdecore Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:18:13 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003