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 "kdemacros.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 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 00567 void restackRequest(Window window, Window above, int detail); 00568 00584 void event( XEvent* event, unsigned long* properties, int properties_size ); 00585 00597 unsigned long event(XEvent *event); 00598 00599 00600 protected: 00607 // virtual void addClient(Window window) { } 00608 virtual void addClient(Window) { } 00609 00616 // virtual void removeClient(Window window) { } 00617 virtual void removeClient(Window) { } 00618 00626 // virtual void addSystemTrayWin(Window window) { } 00627 virtual void addSystemTrayWin(Window) { } 00628 00636 // virtual void removeSystemTrayWin(Window window) { } 00637 virtual void removeSystemTrayWin(Window) { } 00638 00646 // virtual void changeNumberOfDesktops(int numberOfDesktops) { } 00647 virtual void changeNumberOfDesktops(int) { } 00648 00658 // virtual void changeDesktopGeometry(int desktop, const NETSize &geom) { } 00659 virtual void changeDesktopGeometry(int, const NETSize &) { } 00660 00670 // virtual void changeDesktopViewport(int desktop, const NETPoint &viewport) { } 00671 virtual void changeDesktopViewport(int, const NETPoint &) { } 00672 00680 // virtual void changeCurrentDesktop(int desktop) { } 00681 virtual void changeCurrentDesktop(int) { } 00682 00692 // virtual void changeActiveWindow(Window window) { } 00693 virtual KDE_DEPRECATED void changeActiveWindow(Window) { } 00694 00701 // virtual void closeWindow(Window window) { } 00702 virtual void closeWindow(Window) { } 00703 00717 // virtual void moveResize(Window window, int x_root, int y_root, 00718 // unsigned long direction) { } 00719 virtual void moveResize(Window, int, int, unsigned long) { } 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 }; 00735 00742 class NETRootInfo2 00743 : public NETRootInfo 00744 { 00745 public: 00746 NETRootInfo2(Display *display, Window supportWindow, const char *wmName, 00747 unsigned long properties[], int properties_size, 00748 int screen = -1, bool doActivate = true); 00753 void sendPing( Window window, Time timestamp ); 00754 protected: 00755 friend class NETRootInfo; 00762 // virtual void gotPing( Window window, Time timestamp ) {}; 00763 virtual void gotPing( Window, Time ) {}; 00774 // virtual void changeActiveWindow(Window window,NET::RequestSource src, 00775 // Time timestamp, Window active_window ) { } 00776 virtual void changeActiveWindow(Window,NET::RequestSource,Time,Window) { } 00786 // virtual void restackWindow(Window window, Window above, int detail) { } 00787 virtual void restackWindow(Window, Window, int) { } 00788 00796 // virtual void moveResizeWindow(Window window, int flags, int x, int y, int width, int height) { } 00797 virtual void moveResizeWindow( Window, int, int, int, int, int ) { } 00798 00799 // no private data, use NETRootInfoPrivate 00800 }; 00801 00816 class NETWinInfo : public NET { 00817 public: 00822 // update also NETWinInfoPrivate::properties[] size when extending this 00823 enum { PROTOCOLS, PROTOCOLS2, 00824 PROPERTIES_SIZE }; 00849 NETWinInfo(Display *display, Window window, Window rootWindow, 00850 const unsigned long properties[], int properties_size, 00851 Role role = Client); 00852 00859 NETWinInfo(Display *display, Window window, 00860 Window rootWindow, unsigned long properties, 00861 Role role = Client); 00862 00868 NETWinInfo(const NETWinInfo & wininfo); 00869 00873 virtual ~NETWinInfo(); 00874 00879 const NETWinInfo &operator=(const NETWinInfo &wintinfo); 00880 00889 bool hasNETSupport() const; 00890 00897 // KDE4 better name? 00898 const unsigned long* passedProperties() const; 00899 00909 unsigned long properties() const KDE_DEPRECATED; 00910 00916 NETRect iconGeometry() const; 00917 00924 unsigned long state() const; 00925 00931 NETStrut strut() const; 00932 00947 WindowType windowType( unsigned long supported_types ) const; 00948 00956 WindowType windowType() const KDE_DEPRECATED; 00957 00963 const char *name() const; 00964 00970 const char *visibleName() const; 00971 00981 const char *iconName() const; 00982 00992 const char *visibleIconName() const; 00993 01001 int desktop() const; 01002 01008 int pid() const; 01009 01015 Bool handledIcons() const; 01016 01023 Window kdeSystemTrayWinFor() const; 01024 01031 MappingState mappingState() const; 01032 01042 void setIcon(NETIcon icon, Bool replace = True); 01043 01049 void setIconGeometry(NETRect geometry); 01050 01056 void setStrut(NETStrut strut); 01057 01068 void setState(unsigned long state, unsigned long mask); 01069 01076 void setWindowType(WindowType type); 01077 01083 void setName(const char *name); 01084 01091 void setVisibleName(const char *visibleName); 01092 01098 void setIconName(const char *name); 01099 01106 void setVisibleIconName(const char *name); 01107 01115 void setDesktop(int desktop); 01116 01122 void setPid(int pid); 01123 01129 void setHandledIcons(Bool handled); 01130 01136 void setKDESystemTrayWinFor(Window window); 01137 01144 void setKDEFrameStrut(NETStrut strut); 01145 01157 NETIcon icon(int width = -1, int height = -1) const; 01158 01159 /* 01160 * Sets user timestamp @p time on the window (property _NET_WM_USER_TIME). 01161 * The timestamp is expressed as XServer time. If a window 01162 * is shown with user timestamp older than the time of the last 01163 * user action, it won't be activated after being shown, with the special 01164 * value 0 meaning not to activate the window after being shown. 01165 * @since 3.2 01166 */ 01167 void setUserTime( Time time ); 01168 01173 Time userTime() const; 01174 01175 /* 01176 * Sets the startup notification id @p id on the window. 01177 * @since 3.2 01178 */ 01179 void setStartupId( const char* startup_id ); 01180 01185 const char* startupId() const; 01186 01191 void setAllowedActions( unsigned long actions ); 01192 01197 unsigned long allowedActions() const; 01198 01199 /* 01200 * Returns the WM_TRANSIENT_FOR property for the window, i.e. the mainwindow 01201 * for this window. 01202 * @since 3.2 01203 */ 01204 Window transientFor() const; 01205 01210 Window groupLeader() const; 01211 01220 void kdeGeometry(NETRect &frame, NETRect &window); 01221 01237 void event( XEvent* event, unsigned long* properties, int properties_size ); 01238 01250 unsigned long event(XEvent *event); 01251 01258 static const int OnAllDesktops; 01259 01260 01261 protected: 01269 // virtual void changeDesktop(int desktop) { } 01270 virtual void changeDesktop(int) { } 01271 01281 virtual void changeState(unsigned long /*state*/, unsigned long /*mask*/) { } 01282 01283 private: 01284 void update( const unsigned long[] ); 01285 void updateWMState(); 01286 Role role; 01287 01288 protected: 01289 virtual void virtual_hook( int id, void* data ); 01290 private: 01291 NETWinInfoPrivate *p; 01292 }; 01293 01294 01295 //#define KWIN_FOCUS 01296 01297 #endif 01298 #endif // __net_wm_h
KDE Logo
This file is part of the documentation for kdecore Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 20 09:48:28 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003