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

KDECore

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   __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 template <class Z> class NETRArray;
00043 
00044 
00058 class KDECORE_EXPORT NETRootInfo : public NET {
00059 public:
00064     // update also NETRootInfoPrivate::properties[] size when extending this
00065     enum { PROTOCOLS, WINDOW_TYPES, STATES, PROTOCOLS2, ACTIONS,
00066         PROPERTIES_SIZE };
00067 
00101     NETRootInfo(Display *display, Window supportWindow, const char *wmName,
00102         const unsigned long properties[], int properties_size,
00103                 int screen = -1, bool doActivate = true);
00104 
00111     NETRootInfo(Display *display, Window supportWindow, const char *wmName,
00112         unsigned long properties, int screen = -1, bool doActivate = true) KDE_DEPRECATED;
00113 
00136     NETRootInfo(Display *display, const unsigned long properties[], int properties_size,
00137                 int screen = -1, bool doActivate = true);
00138 
00145     NETRootInfo(Display *display, unsigned long properties, int screen = -1,
00146         bool doActivate = true);
00147 
00153     NETRootInfo(const NETRootInfo &rootinfo);
00154 
00158     virtual ~NETRootInfo();
00159 
00165     Display *x11Display() const;
00166 
00172     Window rootWindow() const;
00173 
00179     Window supportWindow() const;
00180 
00186     const char *wmName() const;
00187 
00193     int screenNumber() const;
00194 
00201     bool isSupported( NET::Property property ) const;
00206     bool isSupported( NET::Property2 property ) const;
00211     bool isSupported( NET::WindowType type ) const;
00216     bool isSupported( NET::State state ) const;
00217 
00222     bool isSupported( NET::Action action ) const;
00223 
00235     const unsigned long* supportedProperties() const;
00236 
00243     // KDE4 better name?
00244     const unsigned long* passedProperties() const;
00245 
00261     unsigned long supported() const KDE_DEPRECATED;
00262 
00270     const Window *clientList() const;
00271 
00279     int clientListCount() const;
00280 
00289     const Window *clientListStacking() const;
00290 
00298     int clientListStackingCount() const;
00299 
00307     const Window *kdeSystemTrayWindows() const;
00308 
00316     int kdeSystemTrayWindowsCount() const;
00317 
00328     NETSize desktopGeometry(int desktop) const;
00329 
00337     NETPoint desktopViewport(int desktop) const;
00338 
00346     NETRect workArea(int desktop) const;
00347 
00355     const char *desktopName(int desktop) const;
00356 
00364     const Window *virtualRoots( ) const;
00365 
00373     int virtualRootsCount() const;
00374 
00378     NET::Orientation desktopLayoutOrientation() const;
00379 
00384     QSize desktopLayoutColumnsRows() const;
00385 
00389     NET::DesktopLayoutCorner desktopLayoutCorner() const;
00390 
00396     int numberOfDesktops() const;
00397 
00403     int currentDesktop() const;
00404 
00410     Window activeWindow() const;
00411 
00420     void activate();
00421 
00429     // KDE4 'const Window*', also in the others below
00430     void setClientList(Window *windows, unsigned int count);
00431 
00440     void setClientListStacking(Window *windows, unsigned int count);
00441 
00449     void setKDESystemTrayWindows(Window *windows, unsigned int count);
00450 
00456     void setCurrentDesktop(int desktop);
00457 
00468     void setDesktopGeometry(int desktop, const NETSize &geometry);
00469 
00477     void setDesktopViewport(int desktop, const NETPoint &viewport);
00478 
00484     void setNumberOfDesktops(int numberOfDesktops);
00485 
00493     void setDesktopName(int desktop, const char *desktopName);
00494 
00507     void setActiveWindow(Window window, NET::RequestSource src,
00508         Time timestamp, Window active_window);
00509 
00516     void setActiveWindow(Window window);
00517 
00525     void setWorkArea(int desktop, const NETRect &workArea);
00526 
00534     void setVirtualRoots(Window *windows, unsigned int count);
00535     
00540     void setDesktopLayout(NET::Orientation orientation, int columns, int rows,
00541         NET::DesktopLayoutCorner corner);
00542 
00547     void setShowingDesktop( bool showing );
00552     bool showingDesktop() const;
00553 
00558     const NETRootInfo &operator=(const NETRootInfo &rootinfo);
00559 
00567     void closeWindowRequest(Window window);
00568 
00584     void moveResizeRequest(Window window, int x_root, int y_root,
00585                Direction direction);
00586 
00602     void moveResizeWindowRequest(Window window, int flags, int x, int y, int width, int height );
00603 
00608     void restackRequest(Window window, RequestSource source, Window above, int detail, Time timestamp);
00613     void restackRequest(Window window, Window above, int detail);
00614     
00630     void event( XEvent* event, unsigned long* properties, int properties_size );
00631     
00643     unsigned long event(XEvent *event);
00644 
00645 
00646 protected:
00653     virtual void addClient(Window window) { Q_UNUSED(window); }
00654 
00661     virtual void removeClient(Window window) { Q_UNUSED(window); }
00662 
00670     virtual void addSystemTrayWin(Window window) { Q_UNUSED(window); }
00671 
00679     virtual void removeSystemTrayWin(Window window) { Q_UNUSED(window); }
00680 
00688     virtual void changeNumberOfDesktops(int numberOfDesktops) { Q_UNUSED(numberOfDesktops); }
00689 
00699     virtual void changeDesktopGeometry(int desktop, const NETSize &geom) { Q_UNUSED(desktop); Q_UNUSED(geom); }
00700 
00710     virtual void changeDesktopViewport(int desktop, const NETPoint &viewport) { Q_UNUSED(desktop); Q_UNUSED(viewport); }
00711 
00719     virtual void changeCurrentDesktop(int desktop) { Q_UNUSED(desktop); }
00720 
00730     virtual KDE_DEPRECATED void changeActiveWindow(Window window) { Q_UNUSED(window); }
00731 
00738     virtual void closeWindow(Window window) { Q_UNUSED(window); }
00739 
00753     virtual void moveResize(Window window, int x_root, int y_root,
00754                     unsigned long direction) { Q_UNUSED(window); Q_UNUSED(x_root); Q_UNUSED(y_root); Q_UNUSED(direction); }
00755 
00756 
00757 private:
00758     void update( const unsigned long[] );
00759     void setSupported();
00760     void setDefaultProperties();
00761     void updateSupportedProperties( Atom atom );
00762     Role role;
00763 
00764 protected:
00765     virtual void virtual_hook( int id, void* data );
00766 private:
00767     NETRootInfoPrivate *p;
00768     friend class NETRootInfo2;
00769     friend class NETRootInfo3;
00770 };
00771 
00778 class KDECORE_EXPORT NETRootInfo2
00779     : public NETRootInfo
00780 {
00781 public:
00782     NETRootInfo2(Display *display, Window supportWindow, const char *wmName,
00783         unsigned long properties[], int properties_size,
00784                 int screen = -1, bool doActivate = true);
00788     NETRootInfo2(Display *display, const unsigned long properties[], int properties_size,
00789                 int screen = -1, bool doActivate = true);
00794     void sendPing( Window window, Time timestamp );
00795 protected:
00796     friend class NETRootInfo;
00803     virtual void gotPing( Window window, Time timestamp ) { Q_UNUSED(window); Q_UNUSED(timestamp); }
00814     virtual void changeActiveWindow(Window window,NET::RequestSource src,
00815         Time timestamp, Window active_window ) { Q_UNUSED(window); Q_UNUSED(src); Q_UNUSED(timestamp); Q_UNUSED(active_window);}
00825     virtual void restackWindow(Window window, Window above, int detail) { Q_UNUSED(window); Q_UNUSED(above); Q_UNUSED(detail); }
00826 
00839     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); }
00840 
00841 // no private data, use NETRootInfoPrivate
00842 };
00843 
00850 class KDECORE_EXPORT NETRootInfo3
00851     : public NETRootInfo2
00852 {
00853 public:
00854     NETRootInfo3(Display *display, Window supportWindow, const char *wmName,
00855         unsigned long properties[], int properties_size,
00856                 int screen = -1, bool doActivate = true);
00860     NETRootInfo3(Display *display, const unsigned long properties[], int properties_size,
00861                 int screen = -1, bool doActivate = true);
00869     void takeActivity( Window window, Time timestamp, long flags );
00870 protected:
00871     friend class NETRootInfo;
00883     virtual void restackWindow(Window window, RequestSource source,
00884            Window above, int detail, Time timestamp) { Q_UNUSED(window); Q_UNUSED(source); Q_UNUSED(above); Q_UNUSED(detail); Q_UNUSED(timestamp); }
00892     virtual void gotTakeActivity(Window window, Time timestamp, long flags ) { Q_UNUSED(window); Q_UNUSED(timestamp); Q_UNUSED(flags); }
00893 // no private data, use NETRootInfoPrivate
00894 };
00895 
00902 class KDECORE_EXPORT NETRootInfo4
00903     : public NETRootInfo3
00904 {
00905 public:
00906     NETRootInfo4(Display *display, Window supportWindow, const char *wmName,
00907         unsigned long properties[], int properties_size,
00908                 int screen = -1, bool doActivate = true);
00909     NETRootInfo4(Display *display, const unsigned long properties[], int properties_size,
00910                 int screen = -1, bool doActivate = true);
00911 
00912 protected:
00913     friend class NETRootInfo;
00921     virtual void changeShowingDesktop(bool showing) { Q_UNUSED(showing); }
00922 // no private data, use NETRootInfoPrivate
00923 };
00924 
00939 class KDECORE_EXPORT NETWinInfo : public NET {
00940 public:
00945     // update also NETWinInfoPrivate::properties[] size when extending this
00946     enum { PROTOCOLS, PROTOCOLS2,
00947         PROPERTIES_SIZE };
00972     NETWinInfo(Display *display, Window window, Window rootWindow,
00973                const unsigned long properties[], int properties_size,
00974            Role role = Client);
00975 
00982     NETWinInfo(Display *display, Window window,
00983            Window rootWindow, unsigned long properties,
00984            Role role = Client);
00985 
00991     NETWinInfo(const NETWinInfo & wininfo);
00992 
00996     virtual ~NETWinInfo();
00997 
01002     const NETWinInfo &operator=(const NETWinInfo &wintinfo);
01003 
01012     bool hasNETSupport() const;
01013 
01020     // KDE4 better name?
01021     const unsigned long* passedProperties() const;
01022 
01032     unsigned long properties() const KDE_DEPRECATED;
01033 
01039     NETRect iconGeometry() const;
01040 
01047     unsigned long state() const;
01048 
01053     NETExtendedStrut extendedStrut() const;
01054 
01061     NETStrut strut() const;
01062 
01077     WindowType windowType( unsigned long supported_types ) const;
01078 
01086     WindowType windowType() const KDE_DEPRECATED;
01087 
01093     const char *name() const;
01094 
01100     const char *visibleName() const;
01101 
01111     const char *iconName() const;
01112 
01122     const char *visibleIconName() const;
01123 
01131     int desktop() const;
01132 
01138     int pid() const;
01139 
01145     Bool handledIcons() const;
01146 
01153     Window kdeSystemTrayWinFor() const;
01154 
01161     MappingState mappingState() const;
01162 
01172     void setIcon(NETIcon icon, Bool replace = True);
01173 
01179     void setIconGeometry(NETRect geometry);
01180 
01186     void setExtendedStrut(const NETExtendedStrut& extended_strut );
01187 
01194     void setStrut(NETStrut strut);
01195 
01206     void setState(unsigned long state, unsigned long mask);
01207 
01214     void setWindowType(WindowType type);
01215 
01221     void setName(const char *name);
01222 
01229     void setVisibleName(const char *visibleName);
01230 
01236     void setIconName(const char *name);
01237 
01244     void setVisibleIconName(const char *name);
01245 
01253     void setDesktop(int desktop);
01254 
01260     void setPid(int pid);
01261 
01267     void setHandledIcons(Bool handled);
01268 
01274     void setKDESystemTrayWinFor(Window window);
01275 
01282     void setFrameExtents(NETStrut strut);
01283 
01290     void setKDEFrameStrut(NETStrut strut);
01291 
01303     NETIcon icon(int width = -1, int height = -1) const;
01304 
01305     /*    
01306      * Sets user timestamp @p time on the window (property _NET_WM_USER_TIME).
01307      * The timestamp is expressed as XServer time. If a window
01308      * is shown with user timestamp older than the time of the last
01309      * user action, it won't be activated after being shown, with the special
01310      * value 0 meaning not to activate the window after being shown.
01311      * @since 3.2
01312      */
01313     void setUserTime( Time time );
01314     
01319     Time userTime() const;
01320 
01321     /*    
01322      * Sets the startup notification id @p id on the window.
01323      * @since 3.2
01324      */
01325     void setStartupId( const char* startup_id );
01326     
01331     const char* startupId() const;
01332 
01337     void setAllowedActions( unsigned long actions );
01338 
01343     unsigned long allowedActions() const;
01344 
01345     /*
01346      * Returns the WM_TRANSIENT_FOR property for the window, i.e. the mainwindow
01347      * for this window.
01348      * @since 3.2
01349      */
01350     Window transientFor() const;
01351 
01356     Window groupLeader() const;
01357     
01363     const char* windowClassClass() const;
01364 
01370     const char* windowClassName() const;
01371 
01376     const char* windowRole() const;
01377 
01382     const char* clientMachine() const;
01383 
01392     void kdeGeometry(NETRect &frame, NETRect &window);
01393 
01409     void event( XEvent* event, unsigned long* properties, int properties_size );
01410 
01422     unsigned long event(XEvent *event);
01423 
01430     static const int OnAllDesktops;
01431 
01432 
01433 protected:
01441     virtual void changeDesktop(int desktop) { Q_UNUSED(desktop); }
01442 
01452     virtual void changeState(unsigned long state, unsigned long mask) { Q_UNUSED(state); Q_UNUSED(mask); }
01453 
01454 private:
01455     void update( const unsigned long[] );
01456     void updateWMState();
01457     void setIconInternal(NETRArray<NETIcon>& icons, int& icon_count, Atom property, NETIcon icon, Bool replace);
01458     NETIcon iconInternal(NETRArray<NETIcon>& icons, int icon_count, int width, int height) const;
01459     Role role;
01460 
01461 protected:
01462     virtual void virtual_hook( int id, void* data );
01463 private:
01464     NETWinInfoPrivate *p;
01465 };
01466 
01467 
01468 //#define KWIN_FOCUS
01469 
01470 #endif
01471 #endif // __net_wm_h

KDECore

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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
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